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

Bo Berglund bo.berglund at gmail.com
Tue Aug 17 14:44:20 EEST 2021

On Tue, 17 Aug 2021 08:06:39 +0100, DEF <shaker.doc at gmail.com> wrote:

>If you want to use youtube-dl in addition to ffmpeg, then remember
>that  the command youtube-dl --get-url generates a two line stream.
>One for the video and another for the audio..
>you need a small shell script that handles both..
>Try this (and notice that I have changed  4 minutes to seconds and use
>-t instead.)
>ffmpeg $(youtube-dl -g 'https://www.youtube.com/watch?v=DM-I6UugaFs' |
>sed "s/.*/-ss 06:06:00 -i &/") -t 240  -c copy testpassvideo.mp4

I ran this command to tr an capture stuff from earlier, since the stream is 12
hours I tried 9 hours as the position in teh stream to get a recording from 3
hours ago:

ffmpeg $(youtube-dl -g 'https://www.youtube.com/watch?v=DM-I6UugaFs' | sed
"s/.*/-ss 09:00:00 -i &/") -t 240  -c copy testpastvideo4.mp4

This worked as far as recording goes and ends at the 4 minute duration mark, so
that is an improvement.
However rather than recording from the earlier time it records from now, which
is not what I want. I do have scripts that download from now until a set
duration using youtube-dl, but what I need is a way to record earlier video that
is still accessible in the stream (as shown in a browser).
But that seems not possible using youtube-dl as the engine.

And as I said before streamlink no longer works for this, so my script using
that to get earlier parts is not operational.

Bo Berglund
Developer in Sweden

More information about the ffmpeg-user mailing list