0
votes

Now I use the x264 library to compress the video (from camera) and transmit to client side by TCP. In the client side, use the ffmpeg library to decode the stream on the Win32. But I find the stream decoding always latency one frame. That is to say, if the client side received A,B,C three frame, when decode the A frame, can't get the image. Then decode the B frame, get the A frame image.

For the h.264 encode, i have set zerolatency - ultrafast - baseline. So I think there is no B frame.

For the ffmpeg decoder, i have tried to set the thread_type = 0 to disable frame buffering decoding. But no efficient! By the way, after decoded one frame, passing NULL to the decoder to flush the decoder can help this case. But i think this is not a good solution.

So how to set the ffmpeg library to avoid the one frame latency?

1
What do you mean with "no efficient"? Do you mean decoding got too slow? Or was there still a one-frame latency?Ronald S. Bultje
I want to say that "There was still a one-frame latency". Any suggestion? Thanks!rywang
@rywang Hi, I have the same issue. Did you solve this problem ? Thanks!user1886318

1 Answers

1
votes

If you are using av_parser_parse2, then there's a good chance that's where your one frame of latency is coming from. If you post your code on the decode side, people would probably be more able to help.