Search code examples
videoffmpegyoutube-dlyt-dlp

Error: "No such option: -l" when running yt-dlp


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?


Solution

  • 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.