[FFmpeg-user] [hw] strange stream behaviour

hw hw at adminart.net
Sat Aug 12 23:43:07 EEST 2017


Mettavihari D <tv.lists at gmail.com> writes:

> Greetings
>
> I note you did not have a reply to this long and exhaustive mail
>
> if you have solved it I would be happy to know the solution

I don´t have a solution with ffmpeg yet, so I´m planning to write
something myself that figures out which snippets to get from the server
and downloads them.  Once the snippets have been saved, I can use ffmpeg
to concatenate them as I do now, the only difference being that I´ll
have more snippets than otherwise --- and no annoying jumps in the
recordings when I get all snippets.

They do have about half an hour of video available on the server at any
given time, and since I´m not watching life, it doesn´t matter in which
order the snippets are being downloaded.  I only need to concatenate
them in the right order once I have them.

It´s simply ffmpeg failing to download the snippets.

> If not try to put -report into the command line.
>
> ffmpeg -n -loglevel 8 -report -i http://example.com/foo.m3u8 -codec
> copy -t 00:10:00 -f mpegts example

Hm, thanks, that seems to confirm what I already suspected:

Ffmpeg just sits there, waiting indefinitely for an answer to its GET
request from the server that never arrives.  What it needs to do is time
out the GET requests and retry them if no timely answer arrives.

Perhaps that isn´t beeing done because there´s some assumption that the
stream needs to be recorded life so that snippets are not re-requested
once their assumed lifetime is over.  Re-requesting them would also
involve some sort of cache which ffmpeg doesn´t seem to have.

However, mplayer does have a cache and doesn´t do any better.

I doubt that this ever will be fixed.


You could try something like this:


for i in $(curl 'http://example.m3u8' | sed -e 's/#EXTINF:10.000,//'); do ./wg.sh $i; done


wg.sh:


#!/bin/sh

wget -T 7 "$1" &
exit


If you do that over and over again, you´ll end up with all the snippets
you need.  It just needs to be refined so that the snippets are being
downloaded in a more controlled manner, and not all of them at once.

That definitely works where ffmpeg fails to get the snippets.  I can
concatenate them and play the resulting video, which plays flawless for
about half an hour.  That´s how I know that they do have half an hour of
video on the server all the time.

As for the programming, what I´m having trouble with is doing the
required multitasking in perl without forking lots of processes.  But
I´ll find a way.


More information about the ffmpeg-user mailing list