[x264-devel] Problem with ffmpeg + x264 crf encoding

Georg Lippold georg.lippold at gmx.de
Mon Aug 24 15:12:09 CEST 2009


Hello,

I'm trying to convert a Canon AVCHD .MTS stream/file into a libx264 
compressed avi file using ffmpeg with libx264. I compiled ffmpeg and 
x264 from today's git (x264 head 
d0ee6f8864c1066fb14672faeb738ff511abc261, ffmpeg head 
b2ec810e87371f6c25c27818fb2f197316591d96). Whenever I execute my command 
line using libx264 with the CRF option, ffmpeg crashes. I'm using the 
following command line for converting:

----------------------------------------------------------------------

ffmpeg -i 00021.MTS -acodec copy -vcodec libx264 -crf 22 -r 30000/1001 
-deinterlace -vpre hq -vpre main -threads 0 00021.avi

----------------------------------------------------------------------

The command line should deinterlace the 1080i60 video produced by the 
camcorder and convert it to 1080p30.

Here's the output of running ffmpeg with the debugging options (-v 9 
-loglevel 99):

----------------------------------------------------------------------

ffmpeg -v 9 -loglevel 99 -i 00021.MTS -acodec copy -vcodec libx264 -crf 
22 -r 30000/1001 -deinterlace -vpre hq -vpre main -threads 0 00021.avi
FFmpeg version git-72d34b3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
   configuration: --prefix=/usr --enable-gpl --enable-nonfree 
--enable-avfilter --enable-avfilter-lavf --enable-pthreads 
--enable-bzlib --enable-libtheora --enable-libvorbis --enable-libx264 
--enable-libxvid --extra-cflags='-march=native -O4'
   libavutil     50. 3. 0 / 50. 3. 0
   libavcodec    52.32. 0 / 52.32. 0
   libavformat   52.38. 0 / 52.38. 0
   libavdevice   52. 2. 0 / 52. 2. 0
   libavfilter    0. 5. 0 /  0. 5. 0
   libswscale     0. 7. 1 /  0. 7. 1
   built on Aug 24 2009 22:30:06, gcc: 4.3.3
[mpegts @ 0x2798360]MAX_READ_SIZE:5000000 reached
Input #0, mpegts, from '00021.MTS':
   Duration: 00:00:21.02, start: 0.471633, bitrate: 16198 kb/s
   Program 1
     Stream #0.0[0x1011], 1/90000: Video: h264, yuv420p, 1920x1080 [PAR 
1:1 DAR 16:9], 1001/60000, 59.94 tbr, 90k tbn, 59.94 tbc
     Stream #0.1[0x1100], 1/90000: Audio: ac3, 48000 Hz, stereo, s16, 
256 kb/s
File '00021.avi' already exists. Overwrite ? [y/N] y
[libx264 @ 0x27b3c60]using mv_range_thread = 184
Segmentation fault

----------------------------------------------------------------------

And here's a gdb output of ffmpeg_g:

----------------------------------------------------------------------

gdb ffmpeg_g
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
(gdb) r -i /home/lippold/00021.MTS -acodec copy -vcodec libx264 -crf 22 
-r 30000/1001 -deinterlace -vpre hq -vpre main -threads 0 
/home/lippold/00021.avi
Starting program: /home/lippold/ffmpeg/ffmpeg_g -i 
/home/lippold/00021.MTS -acodec copy -vcodec libx264 -crf 22 -r 
30000/1001 -deinterlace -vpre hq -vpre main -threads 0 
/home/lippold/00021.avi
[Thread debugging using libthread_db enabled]
FFmpeg version git-72d34b3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
   configuration: --prefix=/usr --enable-gpl --enable-nonfree 
--enable-avfilter --enable-avfilter-lavf --enable-pthreads 
--enable-bzlib --enable-libtheora --enable-libvorbis --enable-libx264 
--enable-libxvid --extra-cflags='-march=native -O4'
   libavutil     50. 3. 0 / 50. 3. 0
   libavcodec    52.32. 0 / 52.32. 0
   libavformat   52.38. 0 / 52.38. 0
   libavdevice   52. 2. 0 / 52. 2. 0
   libavfilter    0. 5. 0 /  0. 5. 0
   libswscale     0. 7. 1 /  0. 7. 1
   built on Aug 24 2009 22:30:06, gcc: 4.3.3
Input #0, mpegts, from '/home/lippold/00021.MTS':
   Duration: 00:00:21.02, start: 0.471633, bitrate: 16198 kb/s
   Program 1
     Stream #0.0[0x1011]: Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 
16:9], 59.94 tbr, 90k tbn, 59.94 tbc
     Stream #0.1[0x1100]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
[New Thread 0x7f80179176f0 (LWP 2559)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f80179176f0 (LWP 2559)]
0x00007f8015923c40 in strlen () from /lib/libc.so.6
(gdb) bt
#0  0x00007f8015923c40 in strlen () from /lib/libc.so.6
#1  0x00007f8015923996 in strdup () from /lib/libc.so.6
#2  0x000000000086ab87 in x264_encoder_open ()
#3  0x0000000000717885 in X264_init (avctx=0x1e47c60) at 
libavcodec/libx264.c:291
#4  0x00000000004a0377 in avcodec_open (avctx=0x1e47c60, codec=0xc49660)
     at libavcodec/utils.c:484
#5  0x000000000040bdfd in av_encode (output_files=0xc4be20, 
nb_output_files=1,
     input_files=0xc4a3c0, nb_input_files=1, stream_maps=0xc4cb60,
     nb_stream_maps=0) at ffmpeg.c:2018
#6  0x000000000040d66c in main (argc=<value optimized out>,
     argv=<value optimized out>) at ffmpeg.c:3970
(gdb) disass $pc-32 $pc+32
Dump of assembler code from 0x7f8015923c20 to 0x7f8015923c60:
0x00007f8015923c20 <strerror_r+288>:    test   %r13,%r13
0x00007f8015923c23 <strerror_r+291>:    je     0x7f8015923b5e 
<strerror_r+94>
0x00007f8015923c29 <strerror_r+297>:    jmp    0x7f8015923bef 
<strerror_r+239>
0x00007f8015923c2b:     nop
0x00007f8015923c2c:     nop
0x00007f8015923c2d:     nop
0x00007f8015923c2e:     nop
0x00007f8015923c2f:     nop
0x00007f8015923c30 <strlen+0>:  mov    %rdi,%rcx
0x00007f8015923c33 <strlen+3>:  and    $0x7,%ecx
0x00007f8015923c36 <strlen+6>:  mov    %rdi,%rax
0x00007f8015923c39 <strlen+9>:  je     0x7f8015923c50 <strlen+32>
0x00007f8015923c3b <strlen+11>: neg    %ecx
0x00007f8015923c3d <strlen+13>: add    $0x8,%ecx
0x00007f8015923c40 <strlen+16>: cmpb   $0x0,(%rax)
0x00007f8015923c43 <strlen+19>: je     0x7f8015923d15 <strlen+229>
0x00007f8015923c49 <strlen+25>: inc    %rax
0x00007f8015923c4c <strlen+28>: dec    %ecx
0x00007f8015923c4e <strlen+30>: jne    0x7f8015923c40 <strlen+16>
0x00007f8015923c50 <strlen+32>: mov    $0xfefefefefefefeff,%r8
0x00007f8015923c5a <strlen+42>: nopw   0x0(%rax,%rax,1)
End of assembler dump.
(gdb) info all-registers
rax            0x3f0000003f19999a       4539628425448102298
rbx            0x1e52f40        31797056
rcx            0x6      6
rdx            0x0      0
rsi            0x9f2160 10428768
rdi            0x3f0000003f19999a       4539628425448102298
rbp            0x3f0000003f19999a       0x3f0000003f19999a
rsp            0x7fff1f941c88   0x7fff1f941c88
r8             0x1e5aa70        31828592
r9             0x3      3
r10            0x7f8015c10a70   140188097514096
r11            0x1      1
r12            0x1e53330        31798064
r13            0x1e52f40        31797056
r14            0x1e48610        31753744
r15            0x2      2
rip            0x7f8015923c40   0x7f8015923c40 <strlen+16>
eflags         0x10217  [ CF PF AF IF RF ]
cs             0x33     51
ss             0x2b     43
ds             0x0      0
es             0x0      0
fs             0x0      0
gs             0x0      0
st0            -nan(0x8080808080808080) (raw 0xffff8080808080808080)
st1            -nan(0x8080808080808080) (raw 0xffff8080808080808080)
st2            -nan(0x07d7d7d7d)        (raw 0xffff000000007d7d7d7d)
st3            -nan(0x080808080)        (raw 0xffff0000000080808080)
st4            -nan(0x080808080)        (raw 0xffff0000000080808080)
st5            -nan(0x07c7c7c7c)        (raw 0xffff000000007c7c7c7c)
st6            -nan(0x20002000200020)   (raw 0xffff0020002000200020)
st7            -inf     (raw 0xffff0000000000000000)
fctrl          0x37f    895
fstat          0x0      0
ftag           0xffff   65535
fiseg          0x0      0
fioff          0x0      0
foseg          0x0      0
fooff          0x0      0
fop            0x0      0
xmm0           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
   v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 
0x0, 0x0,
     0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0},
   uint128 = 0x00000000000000000000000000000000}
xmm1           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
   v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 
0x0, 0x0,
     0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0},
   uint128 = 0x00000000000000000000000000000000}
xmm2           {v4_float = {0x0, 0xfffffffe, 0x0, 0x0}, v2_double = {
     0xfffffffffffffffb, 0x0}, v16_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0x14,
     0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 
0x0, 0x0,
     0xc014, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0xc0140000, 0x0, 0x0},
   v2_int64 = {0xc014000000000000, 0x0},
   uint128 = 0x0000000000000000c014000000000000}
xmm3           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
   v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 
0x0, 0x0,
     0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0},
   uint128 = 0x00000000000000000000000000000000}
xmm4           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {
     0x8000000000000000, 0x0}, v16_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 
0xf8,
     0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 
0x0, 0x0,
     0xfff8, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0xfff80000, 0x0, 0x0},
   v2_int64 = {0xfff8000000000000, 0x0},
   uint128 = 0x0000000000000000fff8000000000000}
xmm5           {v4_float = {0x0, 0xffffffff, 0x0, 0x0}, v2_double = 
{0x0, 0x0},
   v16_int8 = {0x17, 0x11, 0xbe, 0x76, 0x67, 0x6b, 0xd3, 0xbf, 0x0, 0x0, 
0x0,
     0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x1117, 0x76be, 0x6b67, 
0xbfd3, 0x0,
     0x0, 0x0, 0x0}, v4_int32 = {0x76be1117, 0xbfd36b67, 0x0, 0x0}, 
v2_int64 = {
     0xbfd36b6776be1117, 0x0}, uint128 = 0x0000000000000000bfd36b6776be1117}
---Type <return> to continue, or q <return> to quit---
xmm6           {v4_float = {0x0, 0xfffffffd, 0x0, 0x0}, v2_double = {
     0xffffffffffffffd3, 0x0}, v16_int8 = {0xc0, 0x9, 0xf2, 0x16, 0xb5, 
0xdf,
     0x46, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = 
{0x9c0,
     0x16f2, 0xdfb5, 0xc046, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x16f209c0,
     0xc046dfb5, 0x0, 0x0}, v2_int64 = {0xc046dfb516f209c0, 0x0},
   uint128 = 0x0000000000000000c046dfb516f209c0}
xmm7           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
   v16_int8 = {0x54, 0xec, 0x35, 0x16, 0xb3, 0xe9, 0x8f, 0xbd, 0x0, 0x0, 
0x0,
     0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0xec54, 0x1635, 0xe9b3, 
0xbd8f, 0x0,
     0x0, 0x0, 0x0}, v4_int32 = {0x1635ec54, 0xbd8fe9b3, 0x0, 0x0}, 
v2_int64 = {
     0xbd8fe9b31635ec54, 0x0}, uint128 = 0x0000000000000000bd8fe9b31635ec54}
xmm8           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
   v16_int8 = {0x29, 0xf2, 0x88, 0x6c, 0xa6, 0x49, 0xde, 0x3e, 0x0, 0x0, 
0x0,
     0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0xf229, 0x6c88, 0x49a6, 
0x3ede, 0x0,
     0x0, 0x0, 0x0}, v4_int32 = {0x6c88f229, 0x3ede49a6, 0x0, 0x0}, 
v2_int64 = {
     0x3ede49a66c88f229, 0x0}, uint128 = 0x00000000000000003ede49a66c88f229}
xmm9           {v4_float = {0x9689a800, 0x0, 0x0, 0x0}, v2_double = 
{0x0, 0x0},
   v16_int8 = {0x6a, 0xa2, 0x65, 0x50, 0xf2, 0xea, 0x8f, 0xbd, 0x0, 0x0, 
0x0,
     0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0xa26a, 0x5065, 0xeaf2, 
0xbd8f, 0x0,
     0x0, 0x0, 0x0}, v4_int32 = {0x5065a26a, 0xbd8feaf2, 0x0, 0x0}, 
v2_int64 = {
     0xbd8feaf25065a26a, 0x0}, uint128 = 0x0000000000000000bd8feaf25065a26a}
xmm10          {v4_float = {0x0, 0x1, 0x0, 0x0}, v2_double = {0x1, 0x0},
   v16_int8 = {0x6d, 0x7d, 0xbf, 0xbb, 0x27, 0xaf, 0xf5, 0x3f, 0x0, 0x0, 
0x0,
     0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x7d6d, 0xbbbf, 0xaf27, 
0x3ff5, 0x0,
     0x0, 0x0, 0x0}, v4_int32 = {0xbbbf7d6d, 0x3ff5af27, 0x0, 0x0}, 
v2_int64 = {
     0x3ff5af27bbbf7d6d, 0x0}, uint128 = 0x00000000000000003ff5af27bbbf7d6d}
xmm11          {v4_float = {0x0, 0xfffffffd, 0x0, 0x0}, v2_double = {
     0xffffffffffffffd2, 0x0}, v16_int8 = {0xe0, 0xe6, 0x35, 0x67, 0x9e, 
0x6,
     0x47, 0xc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = 
{0xe6e0,
     0x6735, 0x69e, 0xc047, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x6735e6e0,
     0xc047069e, 0x0, 0x0}, v2_int64 = {0xc047069e6735e6e0, 0x0},
   uint128 = 0x0000000000000000c047069e6735e6e0}
xmm12          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
   v16_int8 = {0xb3, 0x12, 0x58, 0x17, 0x64, 0x46, 0xe6, 0x3b, 0x0, 0x0, 
0x0,
     0x0, 0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x12b3, 0x1758, 0x4664, 
0x3be6, 0x0,
     0x0, 0x0, 0x0}, v4_int32 = {0x175812b3, 0x3be64664, 0x0, 0x0}, 
v2_int64 = {
     0x3be64664175812b3, 0x0}, uint128 = 0x00000000000000003be64664175812b3}
xmm13          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
   v16_int8 = {0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 
0x0, 0x0,
     0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0},
   uint128 = 0x00000000000000000000000000000000}
xmm14          {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
   v16_int8 = {0x0, 0x0, 0x46, 0x84, 0x24, 0x59, 0xd6, 0x3e, 0x0, 0x0, 
0x0, 0x0,
     0x0, 0x0, 0x0, 0x0}, v8_int16 = {0x0, 0x8446, 0x5924, 0x3ed6, 0x0, 
0x0, 0x0,
     0x0}, v4_int32 = {0x84460000, 0x3ed65924, 0x0, 0x0}, v2_int64 = {
     0x3ed6592484460000, 0x0}, uint128 = 0x00000000000000003ed6592484460000}
xmm15          {v4_float = {0x0, 0x1, 0x0, 0x0}, v2_double = {0x1, 0x0},
   v16_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf0, 0x3f, 0x0, 0x0, 0x0, 
0x0, 0x0,
     0x0, 0x0, 0x0}, v8_int16 = {0x0, 0x0, 0x0, 0x3ff0, 0x0, 0x0, 0x0, 
0x0},
   v4_int32 = {0x0, 0x3ff00000, 0x0, 0x0}, v2_int64 = 
{0x3ff0000000000000, 0x0},
   uint128 = 0x00000000000000003ff0000000000000}
mxcsr          0x1fa1   [ IE PE IM DM ZM OM UM PM ]

----------------------------------------------------------------------

I would appreciate it if somebody could tell me how to use ffmpeg with 
libx264 and crf encoding, as I understand that this should give the best 
quality for 1-pass encodings. I can run ffmpeg with mpeg4 encoding just 
fine, so I assume that it is a bug in x264.

If required, I can post the MTS file somewhere.

Thanks for taking time to look at my bug report.

Cheers,

Georg


More information about the x264-devel mailing list