1

I have a rtsp, udp multicast stream. I read frames by calling av_read_frame() method in a loop and it works as expected. My problem is, If I sleep my loop (let's say) for 500 ms, I'm not receiving recent frames.

Since, I'm not reading a regular video file, is there any way to get recent frames ? (For e.g. which buffer should I disable or resize... I focused on ffmpeg internal buffers which may be wrong approach ?)

Ali Can
  • 564
  • 3
  • 15
  • 1
    You could read the frames without sleeping and put them in a ring buffer and do what you need to do in another thread. – aergistal Sep 23 '15 at 15:47
  • 1
    don't sleep! create a new thread if you must. – szatmary Sep 23 '15 at 18:55
  • You guys (@aergistal and @szatmary) right, actually I read the ffplay code. There is 3 separate threads, one for read, one for visualize and another one for decoding. But CPU usage is also one of my concerns. So far, my expectancies satisfied by using %20 of CPU. I thought, flushing buffer may be a solution. – Ali Can Sep 23 '15 at 21:02
  • @szatmary is there no way to disable ffmpeg internal buffers? I'm using a new thread but I think I'm getting frames slower than ffmpeg fills their own buffer... – guijob Aug 05 '18 at 05:06

0 Answers0