<div dir="ltr">Hi Camera Man<div><br></div><div>Thanks for the reply. I have also patched my own ffmpeg (2.0.2) with the following lines in udp.c (avformat directory):</div><div><br></div><div><div>// #define UDP_TX_BUF_SIZE 32768 old value</div>



<div>#define UDP_TX_BUF_SIZE 65536<br></div><div><br></div><div>// #define UDP_MAX_PKT_SIZE 65536 old value</div></div><div>#define UDP_MAX_PKT_SIZE 131072<br></div><div><br></div><div>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?</div>

<div><br></div><div style>If I reduce the resolution of the camera, it work properly. The original resolucion (1280x960) always fails</div><div><br></div><div style>Thanks in advance</div><div><br></div></div><div class="gmail_extra">

<br><br><div class="gmail_quote">2013/10/17 Camera Man <span dir="ltr"><<a href="mailto:i.like.privacy.too@gmail.com" target="_blank">i.like.privacy.too@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

On 10/15/2013 02:21 PM, Rafa Lopez wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
./ffmpeg -i "rtsp://<a href="http://192.168.0.95:554/profile1" target="_blank">192.168.0.95:554/<u></u>profile1</a> <<a href="http://192.168.0.95:554/profile1" target="_blank">http://192.168.0.95:554/<u></u>profile1</a>>" -y %6d.jpg -log-level debug<div class="im">

<br>
<br>
The problem is that I always get corrupt images (example attached). I think the problem is<br>
<br>
[h264 @ 0x1c28d60] RTP: missed 146 packets<br>
[AVIOContext @ 0x7f3190016d20] Statistics: 0 seeks, 3 writeouts<br>
[h264 @ 0x1f82300] concealing 2237 DC, 2237 AC, 2237 MV errors in I frame<br>
[h264 @ 0x1fc7160] Frame num gap 8 6<br>
<br>
RTP missed packets. I attach the full log. Anyone can help me?<br>
</div></blockquote>
<br>
No way to properly solve with ffmpeg configuration at this point, although adding "-rtsp_transport tcp" before "-y" will reduce the pain for you.<br>
<br>
<br>
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.<br>


<br>
<br>
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).<br>


<br>
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.<br>
______________________________<u></u>_________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/<u></u>listinfo/libav-user</a><br>
</blockquote></div><br></div>