rockcarry / fanplayer

A portable video player based on ffmpeg for windows and android platform.
GNU Lesser General Public License v3.0
606 stars 161 forks source link

Couple seconds delay when playing tcp stream #72

Closed DanielKow closed 1 year ago

DanielKow commented 1 year ago

I have an h264 stream. The player reads it and plays it without noticeable delay (about 200ms) when we send it by RTSP. There is a problem when I'm passing TCP URL directly. I have a couple of seconds of delay (more than 5). The stream is the same. I tried changing the profile and level of my h264 stream but it did not help. Why is there no delay when I send the stream into RTSP and there is a couple of seconds of latency when I open TCP directly? I'm working on Android.

rockcarry commented 1 year ago

try change player parameter avts_syncmode

DanielKow commented 1 year ago

Thanks for your response. After changing avts_syncmode parameter delay was smaller, but still, it is 2 or 3 seconds. I have noticed an interesting thing after 4-6 minutes of streaming delay was reduced to 200ms. There is any buffer implemented in your player? In ffplay I can use -fflags nobuffer and -flags low_delay to achieve video without noticeable delay. Are there similar options in fanplayer?

rockcarry commented 1 year ago

try: avts_syncmode = 3; video_bufpktn = 0; video_frame_rate = ?; // set to actual frame rate

DanielKow commented 1 year ago

This combination of parameters worked like a charm. Thank you very much :)