<br><br><div class="gmail_quote">On 11 May 2012 10:35, Kaarlo Räihä <span dir="ltr"><<a href="mailto:kaarlo.raiha@gmail.com" target="_blank">kaarlo.raiha@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

2012/5/11 Michael Ditum <span dir="ltr"><<a href="mailto:mike@mikeditum.co.uk" target="_blank">mike@mikeditum.co.uk</a>></span><br><div class="gmail_quote"><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>Hi,</div><div><br></div><div>I'm seeing a problem when using VLC to re-encode a video stream. The input stream is an MPEG-2 TS multicast stream of BBC One London (though I can get the same thing to happen with big_buck_bunny_720p_stereo.ogg so I don't think it's an input problem). I'm then converting it to h254 at 960x540 with a video bitrate of 1800. Finally I'm streaming the converted stream to a multicast address. The command I'm using is...</div>



<div><br></div><div>vlc -I dummy --verbose=3 --color udp://@<a href="http://239.72.0.0:1234" target="_blank">239.72.0.0:1234</a> ':sout=#duplicate{dst="transcode{threads=2,width=960,height=540,fps=25,vcodec=h264,vb=1800,venc=x264{aud,profile=baseline,level=30,keyint=30,bframes=0,ref=1,nocabac},acodec=aac,ab=40}:standard{access=udp{port=1234,miface=lo},mux=ts,dst=239.51.88.6}"}'</div>



<div><br></div><div>What I'm seeing is that the video will convert and stream fine for a little while (generally between 10 and 30 seconds, though every now and then it will last for a couple of minutes) and then die. The way it dies varies depending on the version of software I'm using. </div>



<div><br></div><div><b>VLC 2.0.0, with ffmpeg 0.10 and an x264 git snapshot from 2011-10-31</b></div><div>With this setup it will stream for a while and then the multicast output will stop, the CPU usage will drop considerably (implying that the actual transcoding has stopped) however if I leave it for a while I can see dvbpsi messages about XXX. When it dies I get the following type of messages:</div>



<div><br></div><div>[0xb5205a88] access_output_udp access out debug: late packet for UDP input (870951)</div><div>[0xb5205a88] access_output_udp access out debug: late packet for UDP input (867002)</div><div>[0xb5205a88] access_output_udp access out debug: late packet for UDP input (863041)</div>



<div>x264 [warning]: internal error (MV out of thread range)</div><div>x264 [warning]: recovering by using intra mode</div><div>[0xb5205a88] access_output_udp access out debug: packet has been sent too late (1019555)</div>



<div>x264 [error]: Input picture width (960) is greater than stride (544)</div><div>[0xb5205a88] access_output_udp access out debug: late packet for UDP input (859091)</div><div>[0xb5205a88] access_output_udp access out debug: packet has been sent too late (1019234)</div>



<div>[0xb5205a88] access_output_udp access out debug: packet has been sent too late (1015323)</div><div>x264 [warning]: internal error (MV out of thread range)</div><div>x264 [warning]: internal error (MV out of thread range)</div>



<div>x264 [warning]: recovering by using intra mode</div><div>x264 [warning]: internal error (MV out of thread range)</div><div>x264 [warning]: recovering by using intra mode</div><div>x264 [warning]: internal error (MV out of thread range)</div>



<div>x264 [warning]: recovering by using intra mode</div><div>x264 [warning]: internal error (MV out of thread range)</div><div>x264 [warning]: recovering by using intra mode</div><div>x264 [warning]: internal error (MV out of thread range)</div>



<div>x264 [warning]: recovering by using intra mode</div><div><br></div><div><b>VLC master git, FFMPEG master git and x264 master git all from yesterday afternoon</b></div><div>With this setup it will stream for a while and then VLC will seg fault. You don't get a period where it stops transcoding but VLC is still running like you do with vlc 2.0.0.</div>



<div><br></div><div>When it dies you get messages like the following:</div><div>[0x80cc1a8] access_output_udp access out debug: packet has been sent too late (29413565)</div><div>[0x80cc1a8] access_output_udp access out debug: packet has been sent too late (29406435)</div>



<div>[0x80cc1a8] access_output_udp access out debug: packet has been sent too late (29399305)</div><div>[0x80cc1a8] access_output_udp access out debug: packet has been sent too late (29392175)</div><div>[0x80cc1a8] access_output_udp access out debug: packet has been sent too late (29385046)</div>



<div>[0x80cc1a8] access_output_udp access out debug: packet has been sent too late (29377921)</div><div>[0x80cc1a8] access_output_udp access out debug: packet has been sent too late (29370793)</div><div>[0x80ccd58] main mux warning: late buffer for mux input (30373100)</div>



<div>[0x80ccd58] main mux warning: late buffer for mux input (146514)</div><div>[0x80ccd58] main mux warning: late buffer for mux input (130690)</div><div>[0x80ccd58] main mux warning: late buffer for mux input (110274)</div>



<div>[0x80ccd58] main mux warning: late buffer for mux input (140198)</div><div>[0x80ccd58] main mux warning: late buffer for mux input (136323)</div><div>[0x80ccd58] main mux warning: late buffer for mux input (133104)</div>



<div><br></div><div>At times in this setup I'll also see the x264 errors "internal error (MV out of thread range) recovering by using intra mode" and "Input picture width (960) is greater than stride (544)", which I get relatively regularly with vlc 2.0.0. If I lower the width and height of the outputed video so the width is 544 (and the height is proportionate) then vlc will happily convert the video for hours on end.</div>



<div><br></div><div>I've captured a number of log files:</div><div><a href="http://pastebin.com/NkhhEyFU" target="_blank">http://pastebin.com/NkhhEyFU</a> is the output of the problem occuring using vlc 2.0.0.</div><div>


<a href="http://pastebin.com/Lsf3S04M" target="_blank">http://pastebin.com/Lsf3S04M</a> is using the git versions and where it died almost straight away</div>
<div><br></div><div>Does anyone know what could be causing this problem? </div><div>Is this a mis-configuration from me or a bug in VLC / x264? (the seg fault seems like a bug to me) </div><div>Is there any way of specifying this "stride" in x264 so it's larger?</div>



<div>Is there anything extra I can do to provide extra debugging information to help fix this issue?</div></blockquote><div><br></div></div></div><div>gdb backtrace is usually useful if the VLC crashes.</div></div></blockquote>

<div><br></div><div>Ok, I've compiled vlc with -g3 and -O0 and run it through gdb. When it crashes I get the following...</div><div><br></div><div><div>Program received signal SIGSEGV, Segmentation fault.</div><div>[Switching to Thread 0xb788ab90 (LWP 16817)]</div>

<div>0xb749f24c in EncodeAudio (p_enc=0x8124900, p_aout_buf=0x961f3c8) at encoder.c:1110</div><div><div>1110<span class="Apple-tab-span" style="white-space:pre">     </span>        i_out = avcodec_encode_audio( p_sys->p_context, p_block->p_buffer,</div>
</div><div><span style="white-space:pre-wrap">      </span>in encoder.c</div>
<div>(gdb) where</div><div>#0  0xb749f24c in EncodeAudio (p_enc=0x8124900, p_aout_buf=0x961f3c8) at encoder.c:1110</div><div>#1  0xb7c4d118 in transcode_audio_process (p_stream=0x80cf2a0, id=0x80f2558, in=0x960e330, out=0xb788a22c) at audio.c:361</div>

<div>#2  0xb7c4b171 in Send (p_stream=0x80cf2a0, id=0x80f2558, p_buffer=0x960e330) at transcode.c:656</div><div>#3  0xb7c693d1 in sout_StreamIdSend (s=0x80cf2a0, id=0x80f2558, b=0x960e330) at ../../include/vlc_sout.h:225</div>

<div>#4  0xb7c692df in Send (p_stream=0x80c55a0, id=0x80fcbc8, p_buffer=0x960e330) at duplicate.c:294</div><div>#5  0xb802ec1d in sout_InputSendBuffer (p_input=0x80f99b8, p_buffer=0x960e330) at stream_output/stream_output.c:237</div>

<div>#6  0xb7fb8442 in DecoderPlaySout (p_dec=0x80f3ad8, p_sout_block=0x960e330) at input/decoder.c:1671</div><div>#7  0xb7fb8819 in DecoderProcessSout (p_dec=0x80f3ad8, p_block=0x957e430) at input/decoder.c:1793</div><div>

#8  0xb7fb8edc in DecoderProcess (p_dec=0x80f3ad8, p_block=0x957e430) at input/decoder.c:1994</div><div>#9  0xb7fb67d2 in DecoderThread (p_data=0x80f3ad8) at input/decoder.c:938</div><div>#10 0x4e93c5ab in start_thread () from /lib/libpthread.so.0</div>

<div>#11 0x4e892cfe in clone () from /lib/libc.so.6</div></div><div><br></div><div>The line it's failed on is </div><div><br></div><div>i_out = avcodec_encode_audio( p_sys->p_context, p_block->p_buffer, </div><div>

                         p_block->i_buffer, p_samples );</div><div><br></div><div>and printing the vars gives me...</div><div><br></div><div><div>(gdb) p p_sys</div><div>$1 = (encoder_sys_t *) 0x812c548</div><div>(gdb) p p_block</div>

<div>$2 = (block_t *) 0x0</div></div><div><br></div><div>So p_block is a null pointer. It's created further up the function with...</div><div><br></div><div><div>        p_block = block_New( p_enc, p_sys->i_buffer_out );</div>

</div><div><br></div><div>but there's no check afterwards to see if it was created properly. I added some extra printfs to the block_Alloc function and it's failing on the malloc call with the text....</div><div>
<br></div><div>Couldn't alloc -6844316907737747320</div><div><br></div><div>Watching top whilst it's running, the memory usage was quickly rising... when it got to about 3GB VIRT the process segfaulted.</div><div>
<br></div><div>So it looks like there's a memory leak somewhere. I'll try running it under valgrind and see if I can find it.</div><div><br></div><div>Mike</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<div><br></div><div>Thanks in advance for all your help!</div><div><br></div><div>Mike</div>
<br></div>_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="http://mailman.videolan.org/listinfo/vlc-devel" target="_blank">http://mailman.videolan.org/listinfo/vlc-devel</a><br>
<br></blockquote></div><br>
<br>_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="http://mailman.videolan.org/listinfo/vlc-devel" target="_blank">http://mailman.videolan.org/listinfo/vlc-devel</a><br>
<br></blockquote></div><br>