[FFmpeg-devel] [PATCH] FFPlay on a HLS stream skips audio from time to time.

Marton Balint cus at passwd.hu
Sat Jun 11 12:18:49 CEST 2016

On Wed, 8 Jun 2016, Adrian Cruceru wrote:

> On Tue Jun 7 Marton Balint wrote:
>> On Wed, 1 Jun 2016, Adrian Cruceru wrote:
>> >/Hi, />//>/Patch is attached, />//>/Quick notes: />/- Playing HLS streams 
> - FFPlay stalls a bit before each segment download />/- Stalls accumulate and 
> FFPlay falls behind />/- We get log warning and segment skip. />//>/Fix: />/- 
> Just make sure HLS is marked as a real time stream. /
>> I guess using -infbuf fixes your usecase as well, right? Without -infbuf
>> ffplay buffers 25 frames, so for 25 fps video content, if playing stops,
>> this means that it is unable to acquire the first few packets of a
>> new segment within 1 second. Is this really the case?
>> Do you have a public test stream where this can be tested?
>> Thanks,
>> Marton
> Hi Marton,
> You are correct in both items:
> 1) "-infBuf" fixes the issue - the patch just adds code to avoid 
> manually setting flag.
> 2) "unable to acquire first few packets" - yes, that's the case:
> - if download takes longer then the 25 frames then we skip a bit at each 
> download.
> - the skips accumulate over time
> - the streaming server will eventually age out old frames and cause a 
> full segment skip (as detailed in initial email).
> You can find some public streams here: 
> http://www.addictradio.net/en/labs/ but takes a while to reproduce
> Let me know if I can help with any logs / if you want me to test out 
> other patches or look into a different area for a fix

Ok, so these are audio only HLS streams. That can cause smaller buffers, 
because audio frames can be shorter than 40ms, and ffplay buffering logic 
is based on the number of frames and not the duration of them.

I will post a series of ffplay patches which will keep track of the total 
duration of the buffered packets. Could you please test that? I wonder if 
1 second buffering time is enough, or for networked input we should use a 
larger one by default.


More information about the ffmpeg-devel mailing list