[Libav-user] Problema with RTP stream (h264)
Camera Man
i.like.privacy.too at gmail.com
Thu Oct 17 14:31:26 CEST 2013
On 10/15/2013 02:21 PM, Rafa Lopez wrote:
> ./ffmpeg -i "rtsp://192.168.0.95:554/profile1
> <http://192.168.0.95:554/profile1>" -y %6d.jpg -log-level debug
>
> The problem is that I always get corrupt images (example attached). I
> think the problem is
>
> [h264 @ 0x1c28d60] RTP: missed 146 packets
> [AVIOContext @ 0x7f3190016d20] Statistics: 0 seeks, 3 writeouts
> [h264 @ 0x1f82300] concealing 2237 DC, 2237 AC, 2237 MV errors in I frame
> [h264 @ 0x1fc7160] Frame num gap 8 6
>
> RTP missed packets. I attach the full log. Anyone can help me?
No way to properly solve with ffmpeg configuration at this point,
although adding "-rtsp_transport tcp" before "-y" will reduce the pain
for you.
Unfortunately, the udp layer will set it's SO_RCVBUF kernel buffer to at
most 64K, (which e.g. Linux will translate to a 128K buffer). That
practically guarantees that any single frame larger than 128K (e.g., an
average I-frame in an 1280x720 stream) will not fit within the kernel
socket buffers, resulting in at least one packet (and part of the frame)
dropped, thus the corruption you see.
I do not know of a way to ask FFMPEG to properly increase the UDP kernel
buffer size. I had patched my own ffmpeg to set SO_RCVBUF to 1024K, and
it worked for me. But then I switched to TCP and stopped worrying (Using
TCP instead DOES introduce latency and waste bandwidth, because packets
are getting lost and retransmitted, but I don't care about another 10ms
or 10% higher bandwidth as I'm on a local network).
The udp layer does have a "buffer_size" parameter, but there's no way
that I'm aware of to pass it to the udp layer through the rtsp layer.
More information about the Libav-user
mailing list