[FFmpeg-user] How to download video stream starting at an earlier time?

Bo Berglund bo.berglund at gmail.com
Tue Aug 17 08:58:34 EEST 2021


On Mon, 16 Aug 2021 23:29:22 +0200, "Carlos E. R." <robin.listas at telefonica.net>
wrote:

>Google: download youtube video cut with ffmpeg
>
><https://ostechnix.com/download-a-portion-of-youtube-video-with-youtube-dl-and-ffmpeg/>
>
>$ youtube-dl --external-downloader ffmpeg --external-downloader-args
>"-ss 00:01:00.00 -to 00:02:00.00" -f best
>"https://www.youtube.com/watch?v=dc7I-i7sPrg"
>
>or
>
>$ ffmpeg -ss 00:01:00 -to 00:02:00 -i "$(youtube-dl -f best --get-url
>'https://www.youtube.com/watch?v=dc7I-i7sPrg')" -c:v copy -c:a copy
>kiosk.mp4
>
Thanks for your suggestions!

First I tried the second one as follows:

ffmpeg -ss 06:06:00 -to 06:10:00 -i "$(youtube-dl -f 93 --get-url
'https://www.youtube.com/watch?v=DM-I6UugaFs')" -c:v copy -c:a copy
testpastvideo.mp4

I assumed that it would start recording 6h 6m from the start of the stream
(which is 12 hours long) and last until 6h 10m into the stream (duration 4
minutes).
But in fact it recorded from current time and did not stop after the 4 minutes
so I had to manually stop it using the keyboard q key.
So this attempt did not go into the past as requested.

Then I tried this:

youtube-dl --external-downloader ffmpeg --external-downloader-args "-ss
06:06:00.00 -to 06:10:00.00" -f 93 "https://www.youtube.com/watch?v=DM-I6UugaFs"
-o testpastvideo3.mp4

Again the recording did not stop after 4 minutes but had to be manually stopped,
this time using Ctrl-C (since youtube-dl was the main program).
This also recorded from current time rather than from the beginning of the
stream plus the 6 hour offset

So both commands failed to start in the past of the stream and did not stop
after the requested duration.

Did I misunderstand the arguments to use to record starting at an earlier time?

It is my understanding that youtube-dl is unable to start downloading from an
earlier than current time.

Streamlink used to be able to do this but that stopped working some time ago
(maybe spring 2020).

It is unfortunate since both FireFox and Chrome are able to view the streams at
earlier times, whereas download seems impossible.

That is why I asked here if maybe ffmpeg itself would be able to...


-- 
Bo Berglund
Developer in Sweden



More information about the ffmpeg-user mailing list