-3

I have adapted code from this Stack Overflow answer to try to download a video and use ffmpeg to alter it

yt-dlp    "https://www.youtube.com/watch?v=PtkqwslbLY8" -o  ffmpeg -i in.mp4 -vcodec libx264 -crf 23 -preset fast -profile:v baseline \
-level 3 -refs 6 -vf "scale=640:-1,pad=iw:480:0:(oh-ih)/2,format=yuv420p" \
-acodec copy output.mp4

However, when I run this I'm getting the error:

yt-dlp: error: no such option: -l

Any ideas of how to fix this?

garson
  • 1,505
  • 3
  • 22
  • 56
  • **(1)** You didn't use `L` in your command so don't know how you got that error from the shown code. Is it possible you made an edit that you're not telling us about? **(2)** What happens if you try a video download only (no FFmpeg extra commands), does the video save correctly? Trying to see if your error is from YT-dl side or from FFmpeg side... – VC.One Jun 12 '22 at 13:12

1 Answers1

1

yt-dlp "https://www.youtube.com/watch?v=PtkqwslbLY8" -o - | ffmpeg -i - -vcodec libx264 -crf 23 -preset fast -profile:v baseline -level 3 -refs 6 -vf "scale=640:-1,pad=iw:480:0:(oh-ih)/2,format=yuv420p" -acodec copy output.mp4

  1. yt-dlp must write to STDOUT with -o - , not in a regular file
  2. Then pipe to ffmpeg, not -i in.mp4 but | ffmpeg -i -
    This is a smart way to do that.
pierpy
  • 897
  • 3
  • 14
  • 18
  • This works. Any suggestions for how to dynamically name the output after the name of the Youtube video? I can also make a separate SO post. Thanks – garson Jun 13 '22 at 05:10
  • @garson a separate post will be more useful for everyone – pierpy Jun 13 '22 at 15:46