Dương Phương Nam
Dương Phương Nam

Reputation: 49

How to use youtube-dl inside ffmpeg

I tried to record a live stream video by this code. I add that code inside render.cmd

ffmpeg -i $(youtube-dl -f 95 -g https://www.youtube.com/watch?v=v2_knJ1RwlQ) -c copy render.ts

but i got this error $(youtube-dl: No such file or directory

anyone help me please

Upvotes: 4

Views: 14033

Answers (3)

Soul Spark
Soul Spark

Reputation: 56

My answer is similar to @Daniel Taub Found an article to use youtube-dl with FFmpeg https://gist.github.com/mattiasghodsian/085586dd0e26f74c5cd66853259e16e9

I will just gist out things in it:

  • Get a copy of youtube-dl.exe, you can add it to your path or just keep the exe in a folder on Desktop.
  • Get a copy of FFmpeg latest build for your windows architecture. Copy root folder in the zip file and copy over to your directory and rename it to FFmpeg.
  • create a PowerShell script/ batch script.
.\youtube-dl.exe --ffmpeg-location "ffmpeg/bin" -f 95 "https://www.youtube.com/watch?v=v2_knJ1RwlQ"

Upvotes: 0

Dmitry Podyachev
Dmitry Podyachev

Reputation: 153

Looks, like no path to youtube-dl try check this:

  1. just run "youtube-dl --version" or "which youtube-dl" and check where it is
  2. if no file - install it
  3. try:

youtube-dl --external-downloader

Currently aria2c,avconv,axel,curl,ffmpeg,httpie and wget are supported.
For example,

youtube-dl -f 93 --external-downloader ffmpeg --external-downloader-args\
 "-hide_banner -reconnect 1 -reconnect_at_eof 1 \
-reconnect_streamed 1 -reconnect_delay_max 2 \
-fflags +genpts -user-agent proxy5 \
-c copy -sn -dn -hls_time 8 -hls_list_size 3000 \
-hls_wrap 80000 -hls_allow_cache 30 -hls_flags delete_segments i.m3u8" \
https://www.youtube.com/watch?v=8t3YhjKEYhw

or

ffmpeg -re -i $(youtube-dl -f 93 -g 8t3YhjKEYhw ) \
-hide_banner -reconnect 1 -reconnect_at_eof 1 \
-reconnect_streamed 1 -reconnect_delay_max 2 \
-fflags +genpts -user-agent proxy5 -c copy -sn -dn \
-hls_time 8 -hls_list_size 3000 -hls_wrap 80000 \
-hls_allow_cache 30 -hls_flags delete_segments i.m3u8

Upvotes: 0

Daniel Taub
Daniel Taub

Reputation: 5389

You need to use youtube-dl tfor call fmpeg

youtube-dl -f 95 -g https://www.youtube.com/watch?v=v2_knJ1RwlQ --ffmpeg-location /path/to/ffmpeg

Upvotes: 1

Related Questions