[Libav-user] Problema with RTP stream (h264)

Rafa Lopez rafaware at gmail.com
Tue Oct 22 16:37:30 CEST 2013

Hi Camera Man

Thanks for the reply. I have also patched my own ffmpeg (2.0.2) with the
following lines in udp.c (avformat directory):

// #define UDP_TX_BUF_SIZE 32768 old value
#define UDP_TX_BUF_SIZE 65536

// #define UDP_MAX_PKT_SIZE 65536 old value
#define UDP_MAX_PKT_SIZE 131072

and still fails. I have algo patch with UDP_MAX_PKT_SIZE 524288 (and
UDP_MAX_PKT_SIZE 1048576) and still fails. Testing and testing I have found
that that with version 0.8.15  (with UDP_MAX_PKT_SIZE 65536) it happens
less. Are you sure it depends on that parameter? Any other ideas I can try?

If I reduce the resolution of the camera, it work properly. The original
resolucion (1280x960) always fails

Thanks in advance

2013/10/17 Camera Man <i.like.privacy.too at gmail.com>

> On 10/15/2013 02:21 PM, Rafa Lopez wrote:
>> ./ffmpeg -i "rtsp://**profile1<><
>>**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.
> ______________________________**_________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/**listinfo/libav-user<http://ffmpeg.org/mailman/listinfo/libav-user>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20131022/c2334804/attachment.html>

More information about the Libav-user mailing list