Log in

View Full Version : ffmpeg crashes on 2nd pass (plz help)


Offspring2099
21st February 2010, 01:17
Hello,

I'm trying to convert mpeg2 (PS) to mp4 (h.264). ffmpeg seems to fail/quit at random times during the 2nd pass. I don't see an error in event viewer, it just stops and goes to prompt
It's a Windows xp 32bit (sp3) box, 4G of ram, plenty HD space, e8400 cpu.
I know this is a lot to look at, but maybe someone that has done it a million times can spot something. I can convert a transport stream (ts) version of this video just fine but not mpeg2 (program stream).

Thanks in advance.


###################################################################
########################## 1st Pass #################################
###################################################################
C:\xtivo>c:/xtivo/ffmpeg/bin/ffmpeg -i c:/xtivo/skers_2.mpg -y -an -f mp4 -pass 1 -vcodec libx264 -s 1280x720 -vpre fastfirstpass -b 2900k -bt 100k -r 30000/100
1 -threads 0 c:/xtivo/skers.mp4
FFmpeg version SVN-r21915, Copyright (c) 2000-2010 the FFmpeg developers
built on Feb 20 2010 06:04:48 with gcc 4.4.2
configuration: --enable-memalign-hack --cross-prefix=i686-mingw32- --cc=ccache-i686-mingw32-gcc --arch=i686 --target-os=mingw32 --enable-runtime-cpudetect --e
nable-avisynth --enable-gpl --enable-version3 --enable-bzlib --enable-libgsm --enable-libfaad --enable-pthreads --enable-libvorbis --enable-libtheora --enable-l
ibspeex --enable-libmp3lame --enable-libopenjpeg --enable-libxvid --enable-libschroedinger --enable-libx264 --enable-libopencore_amrwb --enable-libopencore_amrn
b
libavutil 50. 9. 0 / 50. 9. 0
libavcodec 52.54. 0 / 52.54. 0
libavformat 52.52. 0 / 52.52. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0.10. 0 / 0.10. 0
[mpeg @ 0195d410]invalid dts/pts combination
Last message repeated 164 times
[mpeg @ 0195d410]MAX_READ_SIZE:5000000 reached

Seems stream 0 codec frame rate differs from container frame rate: 119.88 (120000/1001) -> 59.94 (120000/2002)
Input #0, mpeg, from 'c:/xtivo/skers_2.mpg':
Duration: 03:10:14.95, start: 0.200000, bitrate: 12789 kb/s
Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 38810 kb/s, 59.92 fps, 59.94 tbr, 90k tbn, 119.88 tbc
Stream #0.1[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
[libx264 @ 01abbc10]using SAR=1/1
[libx264 @ 01abbc10]using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 01abbc10]profile Main, level 3.1
Output #0, mp4, to 'c:/xtivo/skers.mp4':
Metadata:
encoder : Lavf52.52.0
Stream #0.0: Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=10-51, pass 1, 2900 kb/s, 30k tbn, 29.97 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
[mpeg @ 0195d410]invalid dts/pts combination
Last message repeated 208378 times238kB time=7123.78 bitrate=2892.4kbits/s dup=0 drop=206377
[mpeg2video @ 0195e590]warning: first frame is no keyframe
Last message repeated 1 times 2519035kB time=7138.73 bitrate=2890.7kbits/s dup=0 drop=206821
[mpeg @ 0195d410]invalid dts/pts combination
frame=342490 fps= 63 q=-2.0 Lsize= 4052000kB time=11442.10 bitrate=2901.0kbits/s dup=0 drop=334175
video:4047704kB audio:0kB global headers:0kB muxing overhead 0.106123%
Last message repeated 134694 times
[libx264 @ 01abbc10]frame I:1671 Avg QP:25.43 size: 66456
[libx264 @ 01abbc10]frame P:235613 Avg QP:29.37 size: 15461
[libx264 @ 01abbc10]frame B:105206 Avg QP:31.34 size: 3717
[libx264 @ 01abbc10]consecutive B-frames: 43.8% 43.5% 5.4% 7.4%
[libx264 @ 01abbc10]mb I I16..4: 39.8% 0.0% 60.2%
[libx264 @ 01abbc10]mb P I16..4: 17.3% 0.0% 0.0% P16..4: 51.0% 0.0% 0.0% 0.0% 0.0% skip:31.7%
[libx264 @ 01abbc10]mb B I16..4: 2.2% 0.0% 0.0% B16..8: 17.0% 0.0% 0.0% direct: 5.8% skip:75.0% L0:31.9% L1:45.6% BI:22.5%
[libx264 @ 01abbc10]final ratefactor: 26.88
[libx264 @ 01abbc10]direct mvs spatial:61.9% temporal:38.1%
[libx264 @ 01abbc10]coded y,uvDC,uvAC intra: 33.4% 37.4% 8.4% inter: 16.3% 10.3% 0.4%
[libx264 @ 01abbc10]i16 v,h,dc,p: 27% 35% 24% 14%
[libx264 @ 01abbc10]i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 28% 14% 6% 6% 6% 7% 6% 7%
[libx264 @ 01abbc10]Weighted P-Frames: Y:0.4%
[libx264 @ 01abbc10]kb/s:2901.60
C:\xtivo>

###################################################################
########################## 2nd Pass #################################
###################################################################
C:\xtivo>c:/xtivo/ffmpeg/bin/ffmpeg -i c:/xtivo/skers_2.mpg -y -ab 192k -ac 2 -f mp4 -pass 2 -vcodec libx264 -s 1280x720 -vpre hq -b 2900k -bt 100k -r 30000/100
1 -threads 0 c:/xtivo/skers.mp4
FFmpeg version SVN-r21915, Copyright (c) 2000-2010 the FFmpeg developers
built on Feb 20 2010 06:04:48 with gcc 4.4.2
configuration: --enable-memalign-hack --cross-prefix=i686-mingw32- --cc=ccache-i686-mingw32-gcc --arch=i686 --target-os=mingw32 --enable-runtime-cpudetect --e
nable-avisynth --enable-gpl --enable-version3 --enable-bzlib --enable-libgsm --enable-libfaad --enable-pthreads --enable-libvorbis --enable-libtheora --enable-l
ibspeex --enable-libmp3lame --enable-libopenjpeg --enable-libxvid --enable-libschroedinger --enable-libx264 --enable-libopencore_amrwb --enable-libopencore_amrn
b
libavutil 50. 9. 0 / 50. 9. 0
libavcodec 52.54. 0 / 52.54. 0
libavformat 52.52. 0 / 52.52. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0.10. 0 / 0.10. 0
[mpeg @ 0195d410]invalid dts/pts combination
Last message repeated 164 times
[mpeg @ 0195d410]MAX_READ_SIZE:5000000 reached

Seems stream 0 codec frame rate differs from container frame rate: 119.88 (120000/1001) -> 59.94 (120000/2002)
Input #0, mpeg, from 'c:/xtivo/skers_2.mpg':
Duration: 03:10:14.95, start: 0.200000, bitrate: 12789 kb/s
Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 38810 kb/s, 59.92 fps, 59.94 tbr, 90k tbn, 119.88 tbc
Stream #0.1[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
[libx264 @ 01b1cb50]using SAR=1/1
[libx264 @ 01b1cb50]using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 01b1cb50]profile High, level 3.1
Output #0, mp4, to 'c:/xtivo/skers.mp4':
Metadata:
encoder : Lavf52.52.0
Stream #0.0: Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=10-51, pass 2, 2900 kb/s, 30k tbn, 29.97 tbc
Stream #0.1: Audio: aac, 48000 Hz, 2 channels, s16, 192 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
[mpeg @ 0195d410]invalid dts/pts combination
frame=30648 fps= 12 q=33.0 size= 405613kB time=1020.84 bitrate=3254.9kbits/s dup=0 drop=29639
C:\xtivo>

ffmpeg
21st February 2010, 07:49
How to reproduce your problem?
I wanna fix this bug

Offspring2099
21st February 2010, 10:31
Thank you for responding.

I just though maybe some of my argument were incorrect, but if they look alright, it might indeed be a bug or maybe just my PC. Perhaps it's a good idea to try this operation on a different box, I will do it this week.

I can reproduce this problem at 100% rate. I just need a large mpeg2 program stream file, mine is 16gigs, and run two passes, with x264 presets.

It's hard to see what's wrong because there no error. I don't see anything in windows event viewer.

Dark Shikari
21st February 2010, 10:35
Post a backtrace from a debug build.

Offspring2099
21st February 2010, 23:59
Post a backtrace from a debug build.
I need just a bit of direction here. I will need to get the source and compile a debug version of ffmpeg using MinGW? Or are there debug binaries availble. I looked on http://ffmpeg.arrozcru.org/autobuilds/ and don't see anything.

ffmpeg
22nd February 2010, 08:24
I will provide the latest FFmpeg build with latest x264

Please download it from:

http://groups.google.com/group/nextplayer

in the file section: ffmpeg_r21955.7z

right click it and select "save as"

If ffmpeg_r21955 is still broken , I will provide the debug version of ffmpeg, so you can obtain the stack callback.

Offspring2099
22nd February 2010, 18:03
I will provide the latest FFmpeg build with latest x264

Please download it from:

http://groups.google.com/group/nextplayer

in the file section: ffmpeg_r21955.7z

right click it and select "save as"

If ffmpeg_r21955 is still broken , I will provide the debug version of ffmpeg, so you can obtain the stack callback.
Got it.
Awesome, Thank you. I will run this overnight.

EDIT:
Btw, I ran handbrake last night and it crashed as well, but it did give me gener error (event id: 1000, source: application error). I can post it when I get home. Correct me if I'm wrong but doesn't handbrake uses the same x264 library? Maybe that's what is crashing.

Offspring2099
23rd February 2010, 07:04
I gave r21955 a go. I'm crashing just a few minutes into pass 1.


C:\xtivo>c:/xtivo/ffmpeg/bin/ffmpeg -i c:/xtivo/skers_2.mpg -y -an -f mp4 -pass 1 -vcodec libx264 -s 1280x720 -vpre fastfirstpass -b 2900k -bt 100k -r 30000/100
1 -threads 0 c:/xtivo/skers.mp4
FFmpeg version SVN-r394, Copyright (c) 2000-2010 the FFmpeg developers
built on Feb 22 2010 15:06:47 with gcc 4.4.3 (x86.generic.Komisar)
configuration: --prefix=/e/ffmpeg_build/svn_r21955 --enable-gpl --enable-nonfree --enable-version3 --enable-pthreads --enable-memalign-hack --enable-shared --
disable-static --enable-mpegaudio-hp --enable-bzlib --enable-postproc --enable-avisynth --disable-decoder=aac --disable-encoder=aac --disable-decoder=amrnb --di
sable-encoder=vorbis --disable-decoder=snow --disable-encoder=snow --enable-libaacplus --enable-encoder=libaacplus --enable-libdirac --enable-decoder=libdirac -
-enable-encoder=libdirac --enable-libfaac --enable-encoder=libfaac --enable-libfaad --enable-decoder=libfaad --enable-libmp3lame --enable-encoder=libmp3lame --e
nable-libgsm --enable-decoder=libgsm --enable-encoder=libgsm --enable-libopenjpeg --enable-decoder=libopenjpeg --enable-libschroedinger --enable-decoder=libschr
oedinger --enable-encoder=libschroedinger --enable-libspeex --enable-decoder=libspeex --enable-libtheora --enable-encoder=libtheora --enable-libvorbis --enable-
encoder=libvorbis --enable-libx264 --enable-encoder=libx264 --enable-libxvid --enable-encoder=libxvid --enable-decoder=libxvid --enable-libopencore-amrnb --enab
le-encoder=libopencore-amrnb --enable-decoder=libopencore-amrnb --enable-libopencore-amrwb --enable-encoder=libopencore-amrwb --enable-decoder=libopencore-amrwb
--enable-libnut --enable-demuxer=libnut --enable-muxer=linbut --disable-demuxer=nut --disable-muxer=nut --enable-avfilter --enable-avfilter-lavf --extra-cflags
='-U__STRICT_ANSI__ -fno-strict-aliasing -I/usr/local/include -I/usr/local/include/schroedinger-1.0 -I/usr/local/include/dirac' --extra-ldflags=-L/usr/local/lib
--extra-libs=-lstdc++
libavutil 50. 9. 0 / 50. 9. 0
libavcodec 52.55. 0 / 52.55. 0
libavformat 52.52. 0 / 52.52. 0
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.17. 0 / 1.17. 0
libswscale 0.10. 0 / 0.10. 0
libpostproc 51. 2. 0 / 51. 2. 0
-------------------------------------------------------
Compiled by ffmpeg@gmail.com and next@nextplayer.net
Support/discussion group : http://www.nextplayer.net
-----------------------Enjoy it!-----------------------

[mpeg @ 004dd270]invalid dts/pts combination
Last message repeated 164 times
[mpeg @ 004dd270]MAX_READ_SIZE:5000000 reached

Seems stream 0 codec frame rate differs from container frame rate: 119.88 (120000/1001) -> 59.94 (120000/2002)
Input #0, mpeg, from 'c:/xtivo/skers_2.mpg':
Duration: 03:10:14.95, start: 0.200000, bitrate: 12789 kb/s
Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 38810 kb/s, 59.920 fps, 59.940 tbr, 90k tbn, 119.880 tbc
Stream #0.1[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
[libx264 @ 00eaf010]using SAR=1/1
[libx264 @ 00eaf010]using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 00eaf010]profile Main, level 3.1
Output #0, mp4, to 'c:/xtivo/skers.mp4':
Metadata:
encoder : Lavf52.52.0
Stream #0.0: Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=10-51, pass 1, 2900 kb/s, 30k tbn, 29.970 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
[mpeg @ 004dd270]invalid dts/pts combination
frame= 6158 fps= 63 q=34.0 size= 72180kB time=203.84 bitrate=2900.8kbits/s dup=0 drop=6155


Here is the windows error:

Event Type: Error
Event Source: Application Error
Event Category: None
Event ID: 1000
Date: 2/22/2010
Time: 9:59:14 PM
User: N/A
Computer: SKYNET2099
Description:
Faulting application ffmpeg.exe, version 0.0.0.0, faulting module avcodec.dll, version 0.52.55.0, fault address 0x008548b6.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 41 70 70 6c 69 63 61 74 Applicat
0008: 69 6f 6e 20 46 61 69 6c ion Fail
0010: 75 72 65 20 20 66 66 6d ure ffm
0018: 70 65 67 2e 65 78 65 20 peg.exe
0020: 30 2e 30 2e 30 2e 30 20 0.0.0.0
0028: 69 6e 20 61 76 63 6f 64 in avcod
0030: 65 63 2e 64 6c 6c 20 30 ec.dll 0
0038: 2e 35 32 2e 35 35 2e 30 .52.55.0
0040: 20 61 74 20 6f 66 66 73 at offs
0048: 65 74 20 30 30 38 35 34 et 00854
0050: 38 62 36 0d 0a 8b6..

ffmpeg
23rd February 2010, 10:30
According to your crash info:

Faulting application ffmpeg.exe, version 0.0.0.0, faulting module avcodec.dll, version 0.52.55.0, fault address 0x008548b6.

I disassemble avcodec.dll which contains the latest static git version of x264

I trace the offset 0x008548b6 into x264's function:
static void refine_subpel( x264_t *h, x264_me_t *m, int hpel_iters, int qpel_iters, int *p_halfpel_thresh, int b_refine_qpel )

Disassemble code of refine_subpel():http://pastebin.com/YTeE8XFt

the crash instruction is the code from:
661154b5: 8b 44 24 7c mov 0x7c(%esp),%eax
in:
66115498: 8b 44 24 50 mov 0x50(%esp),%eax
6611549c: 01 c8 add %ecx,%eax
6611549e: 8b 4c 24 44 mov 0x44(%esp),%ecx
661154a2: 03 44 24 78 add 0x78(%esp),%eax
661154a6: 39 c8 cmp %ecx,%eax
661154a8: 89 84 24 98 00 00 00 mov %eax,0x98(%esp)
661154af: 0f 8d 66 01 00 00 jge 6611561b <_refine_subpel+0xa2b>
661154b5: 8b 44 24 7c mov 0x7c(%esp),%eax
661154b9: 85 c0 test %eax,%eax
661154bb: 0f 84 5a 01 00 00 je 6611561b <_refine_subpel+0xa2b>
661154c1: 8b 4c 24 48 mov 0x48(%esp),%ecx
661154c5: 03 8c 24 8c 00 00 00 add 0x8c(%esp),%ecx
661154cc: 8b 44 24 74 mov 0x74(%esp),%eax
661154d0: 89 54 24 10 mov %edx,0x10(%esp)
661154d4: 89 4c 24 50 mov %ecx,0x50(%esp)
661154d8: 8b 4c 24 6c mov 0x6c(%esp),%ecx
661154dc: 89 54 24 40 mov %edx,0x40(%esp)
661154e0: 89 44 24 1c mov %eax,0x1c(%esp)
661154e4: 8b 44 24 50 mov 0x50(%esp),%eax
661154e8: c7 44 24 04 08 00 00 movl $0x8,0x4(%esp)

I am not an expert on x264 development

Maybe some x264 developers could check this bug

Dark Shikari
23rd February 2010, 10:30
A backtrace without debug symbols is useless. I need a line of code.

ffmpeg
23rd February 2010, 10:34
Dear Dark Shikari:

Is the ASM code useless to you?

Dark Shikari
23rd February 2010, 10:35
Dear Dark Shikari:

Is the ASM code useless to you?Yes, asm code is useless.

I need a gdb backtrace, run on a debug build, built with debug x264.

ffmpeg
23rd February 2010, 10:38
if Offspring2099 has GDB , I can provide the debug version of ffmpeg and x264

Offspring2099
24th February 2010, 18:17
Last night ran ffmpeg (2 passes) with my original bios settings. My PC was overclocked. And ffmpeg didn't crash. I think my overclock was too aggressive, I guess it was a gomer move by me, but I have a stable 24hr overclock running Large FFTs, and never had problems encoding anything. Eh...anyways, I think that was the problem. I'm also testing if this file will transcode with handbrake, currently. I think it would be a moot point trying to debug in an unstable environment.
Thank you both for your time, it's greatly appreciated.

Dark Shikari
24th February 2010, 19:08
Last night ran ffmpeg (2 passes) with my original bios settings. My PC was overclocked. And ffmpeg didn't crash. I think my overclock was too aggressive, I guess it was a gomer move by me, but I have a stable 24hr overclock running Large FFTsPast history has shown that x264 is much better at crashing overclocked machines than Prime95 :devil:

Offspring2099
25th February 2010, 05:46
Past history has shown that x264 is much better at crashing overclocked machines than Prime95 :devil:
Wonderful. Now I know.