[Ffmpeg-devel] ffmpeg hanging when transcoding mpeg4
Aaron Williams
aaronw
Sat Oct 21 22:49:15 CEST 2006
Aaron Williams wrote:
> Aaron Williams wrote:
>
>> Michael Niedermayer wrote:
>>
>>
>>> Hi
>>>
>>> On Sat, Oct 21, 2006 at 02:32:11AM -0700, Aaron Williams wrote:
>>>
>>>
>>>
>>>> I am trying to transcode a video for a friend into MPEG2 for use with a
>>>> hardware MPEG decoder and am running into problems with FFMPEG stopping
>>>> at the same place in the video and consuming all of the CPU. I seem to
>>>> be unable to do any source level debugging with gdb (even when compiled
>>>> with -O2 and -g) so I cannot find the source of the hang. It always
>>>> occurs at about time 236.2 in the file.
>>>>
>>>>
>>>>
>>> you do use ffmpeg_g for debugging right?
>>> and maybe try valgrind
>>>
>>>
>>>
>> I do not see ffmpeg_g. Do I need to do something special in configure
>> to build that? Also, valgrind is reporting problems, but again there
>> appears to be no debugging information.
>>
>> I do see the following though:
>> ==20851== Conditional jump or move depends on uninitialised value(s)
>> ==20851== at 0x4DEE61F: ff_mpeg4_decode_mb (in
>> /usr/local/lib/libavcodec.so.51.20.0)
>> ==20851== by 0x4DFFB83: (within /usr/local/lib/libavcodec.so.51.20.0)
>> ==20851== by 0x4E00F40: ff_h263_decode_frame (in
>> /usr/local/lib/libavcodec.so.51.20.0)
>> ==20851== by 0x4CCF222: avcodec_decode_video (in
>> /usr/local/lib/libavcodec.so.51.20.0)
>> ==20851== by 0x40A5D3: (within /usr/local/bin/ffmpeg)
>> ==20851== by 0x40C2C4: main (in /usr/local/bin/ffmpeg)
>>
>>
>> I can get the file to transcode if I scale it to certain resolutions.
>> The source is MPEG4 at 720x380, encoded with an aspect ratio of 16:9.
>> If I scale it to 720x480 it hangs. If I scale it to 720x352 and add 64
>> pixels of padding above and below it works. It seems to be a bug
>> somewhere in the scaling code. If I convert to h264 instead of mpeg2
>> then it seems to go through OK.
>>
>> I think the original video was improperly scaled for a 16:9 aspect ratio
>> as well.
>>
>> I am trying to cut the size of the source file as well so I can post a
>> link to a smaller file, but this is failing as well:
>>
>> /usr/local/bin/ffmpeg -i DCF-Brick-DivX-high.avi -vcodec copy -acodec
>> copy -y -ss 220 -t 30 DCF-Brick3-hang.avi
>> FFmpeg version SVN-r6280, Copyright (c) 2000-2006 Fabrice Bellard, et al.
>> configuration: --enable-libogg --enable-vorbis --enable-faad
>> --enable-faac --enable-xvid --enable-x264 --enable-a52 --enable-dts
>> --enable-shared --enable-dc1394 --enable-gpl --enable-mp3lame
>> libavutil version: 49.0.1
>> libavcodec version: 51.20.0
>> libavformat version: 50.6.0
>> built on Oct 21 2006 02:51:51, gcc: 4.1.0 (SUSE Linux)
>>
>> Seems that stream 0 comes from film source: 29.98 (65534/2186) -> 29.97
>> (2997/100)
>> Input #0, avi, from 'DCF-Brick-DivX-high.avi':
>> Duration: 00:07:09.6, start: 0.000000, bitrate: 865 kb/s
>> Stream #0.0: Video: mpeg4, yuv420p, 720x380, 29.97 fps(r)
>> Stream #0.1: Audio: mp3, 48000 Hz, stereo, 128 kb/s
>> Output #0, avi, to 'DCF-Brick3-hang.avi':
>> Stream #0.0: Video: mpeg4, yuv420p, 720x380, q=2-31, 29.98 fps(c)
>> Stream #0.1: Audio: mp3, 48000 Hz, stereo, 128 kb/s
>> Stream mapping:
>> Stream #0.0 -> #0.0
>> Stream #0.1 -> #0.1
>> Press [q] to stop encoding
>> error, non monotone timestamps 9170 >= 9170
>> error, non monotone timestamps 9173 >= 9173
>> ...
>> frame= 900 q=0.0 Lsize= 3589kB time=250.0 bitrate= 117.6kbits/s
>> video:3039kB audio:476kB global headers:0kB muxing overhead 2.103378%
>>
>> -Aaron
>>
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at mplayerhq.hu
>> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>>
>>
>>
>>
>>
>>
>>
> I found the ffmpeg_g and that works a lot better for debugging.
> It looks like it is stuck in the MPV_encode_picture where it
> continuously goes back to vbv_retry.
>
>
> (gdb) p s->pb
> $3 = {bit_buf = 0, bit_left = 32, buf = 0x2b726eaa4010 "",
> buf_ptr = 0x2b726eab3dba, buf_end = 0x2b726ebf5810 }
> (gdb) p s->rc_context.buffer_index
> $4 = 1544315
> (gdb)
> (gdb) p s->next_lambda
> $5 = 0
> (gdb) p s->lambda
> $6 = 0
> (gdb) p s->qscale
> $7 = 2
>
> It looks like the problem is that s->lambda is zero and will never
> scale, hence it gets stuck in an endless loop.
>
> -Aaron
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>
>
>
>
It looks a bit more fundamental than that. In this case, s->qscale is
also 2, so even if s->lambda is 1 it will also never increase.
-Aaron
More information about the ffmpeg-devel
mailing list