[FFmpeg-user] How do I make ffplay play without high latency?

Jesse Gordon tojesseg at gmail.com
Wed Nov 28 07:18:22 CET 2012


On 11/27/2012 06:53 AM, Roger Pack wrote:
>> Would I be better off requesting a feature? Do features like that get
>> added as a result of user requests? Realtime low latency streaming video
>> is a growing field these days and I think a feature like this would be
>> extremely helpful to a small percentage but significant number of ffmpeg
>> users.
> You could add a feature request for ffplay to "ignore timestamps and
> display frames as fast as possible" though..I'm not entirely convinced
> that this is your problem here...maybe it's some latency in the mpeg4
> decoder itself?

I suspect TCP is the issue. Basically, tcp has buffers to make things 
run smoothly which is great for file transfers, but not great for things 
where a fraction of a second for a small group of bytes matters. TCP 
does have  a "PUSH" flag that one end can send to ask the other to send 
whatever it's got buffered, so it may be that the windows client (at 
only about 5 frames of latency) is tweaking the tcp stream parameters to 
get keep the pipe flushed, as well as keeping its own buffers short. The 
tcp handling in ffmpeg is probably just regular, and not optimized for 
realtime video.

> What about ffplay/ffmpeg with -loglevel debug, does it show it
> receiving frames quickly?  Did you try the other tricks mentioned on
> the website?
-loglevel debug showed a few green lines on startup but nothing 
pertaining to the frames.

I did try the other tricks that were mentioned on the website which 
pertained to playing a video. However, much of them were specific to 
encoding a video with low latency -- but my encoding is done in the 
camera and I have no control over it (and besides, with windows/mpeg4 or 
mjpeg on firefox in linux, it gets those frames sent out and displayed 
within 4 or 5 frames, so I know the camera can do it.)

I've given up for now on getting ffmpeg/ffplay to play with low latency. 
Perhaps as I learn more about ffmpeg I can eventually begin to 
understand the source code enough to start trying things to optimize for 
my application, but I'll cross that bridge when I'm there.

Thanks,

Jesse Gordon





More information about the ffmpeg-user mailing list