Opened 13 years ago

Closed 12 years ago

#387 closed defect (fixed)

ffmpeg '-profile baseline' no longer works with libx264

Reported by: Andrew Wason Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Recent ffmpeg seems to be parsing the libavcodec/libx264.c "-profile" codec option as the "-profile" option defined in libavcodec/options.c

So "-profile baseline" is eval'ed and fails to parse.

$ ./ffmpeg -i /tmp/in.avi -vcodec libx264 -profile baseline -y /tmp/out.mp4                                        ffmpeg version N-31788-g0d4ea7b, Copyright (c) 2000-2011 the FFmpeg developers
  built on Aug 10 2011 01:45:04 with gcc 4.4.3
  configuration: --extra-cflags=-I/opt/motionbox/foundation/6.2.2-2-gee5a36a-dirty/include --extra-ldflags=-L/opt/motionbox/foundation/6.2.2-2-gee5a36a-dirty/lib --enable-libx264 --enable-gpl
  libavutil    51. 11. 1 / 51. 11. 1
  libavcodec   53. 10. 0 / 53. 10. 0
  libavformat  53.  6. 0 / 53.  6. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 28. 1 /  2. 28. 1
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Input #0, avi, from '/tmp/in.avi':
  Duration: 00:00:29.98, start: 0.000000, bitrate: 40887 kb/s
    Stream #0.0: Video: fraps, yuvj420p, 640x512, 60 fps, 60 tbr, 60 tbn, 60 tbc
    Stream #0.1: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
[buffer @ 0x2bd0680] w:640 h:512 pixfmt:yuvj420p tb:1/1000000 sar:0/1 sws_param:
[libx264 @ 0x2bcee80] Default settings detected, using medium profile
[libx264 @ 0x2bcee80] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
[libx264 @ 0x2bcee80] profile Constrained Baseline, level 3.1
[libx264 @ 0x2bcee80] 264 - core 116 0b9c261 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[NULL @ 0x2bd5e60] [Eval @ 0x7fffa8a577d0] Undefined constant or missing '(' in 'baseline'
[NULL @ 0x2bd5e60] Unable to parse option value "baseline"
[NULL @ 0x2bd5e60] Error setting option profile to value baseline.
Output #0, mp4, to '/tmp/out.mp4':
    Stream #0.0: Video: libx264, yuvj420p, 640x512, q=2-31, 200 kb/s, 90k tbn, 60 tbc
    Stream #0.1: Audio: aac, 44100 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height

Change History (9)

comment:1 by Carl Eugen Hoyos, 13 years ago

Status: newopen

Please add complete, uncut output of latest git head (your output is missing the version information).

comment:2 by styleproject, 13 years ago

I don't have a linux machine right now, but same problem here with the latest packaged Windows x64 static build (N-31774-g6c4e9ca). But it works fine if I turn off audio transcoding with "-an"

C:\Users\user\Desktop>ffmpeg -i d:\video\test.avi -acodec aac -ab 192k -vcodec l
ibx264 -profile baseline -crf 21 -level 30 -f ipod -s 320x136 -y -t 720 -strict
experimental "test.m4v"
ffmpeg version N-31774-g6c4e9ca, Copyright (c) 2000-2011 the FFmpeg developers
  built on Aug  6 2011 22:25:16 with gcc 4.6.1
  configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-
runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo
pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --
enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
 --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enabl
e-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil    51. 11. 1 / 51. 11. 1
  libavcodec   53.  9. 1 / 53.  9. 1
  libavformat  53.  6. 0 / 53.  6. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 28. 0 /  2. 28. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Input #0, avi, from 'd:\video\test.avi':
  Duration: 01:58:28.89, start: 0.000000, bitrate: 1560 kb/s
    Stream #0.0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 720x306 [SAR 1
:1 DAR 40:17], 23.98 tbr, 23.98 tbn, 23.98 tbc
    Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 128 kb/s
[buffer @ 0000000001961380] w:720 h:306 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_
param:
[scale @ 0000000001A23200] w:720 h:306 fmt:yuv420p -> w:320 h:136 fmt:yuv420p fl
ags:0x4
[libx264 @ 0000000001A5D000] Default settings detected, using medium profile
[libx264 @ 0000000001A5D000] using SAR=1/1
[libx264 @ 0000000001A5D000] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64

[libx264 @ 0000000001A5D000] profile Constrained Baseline, level 3.0
[libx264 @ 0000000001A5D000] 264 - core 116 r2044 392e762 - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=0 r
ef=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed
_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pski
p=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=23
 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60
 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[NULL @ 0000000001A5E780] [Eval @ 000000000022EA30] Undefined constant or missin
g '(' in 'baseline'
[NULL @ 0000000001A5E780] Unable to parse option value "baseline"
[NULL @ 0000000001A5E780] Error setting option profile to value baseline.
Output #0, ipod, to 'test.m4v':
    Stream #0.0: Video: libx264, yuv420p, 320x136 [SAR 1:1 DAR 40:17], q=2-31, 2
00 kb/s, 90k tbn, 23.98 tbc
    Stream #0.1: Audio: aac, 48000 Hz, stereo, s16, 192 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.1 - maybe incorrect parameters
such as bit_rate, rate, width or height

comment:3 by Andrew Wason, 13 years ago

Sorry, was a copy/paste error that missed the version info:
ffmpeg version N-31789-g6481a36, Copyright (c) 2000-2011 the FFmpeg developers

It looks like "-profile" is being parsed as the aac audio profile option declared in libavcodec/options.c instead of the x264 profile option declared in libavcodec/libx264.c (which may be why it works when audio is turned off with -an)

comment:4 by llogan, 13 years ago

This was also mentioned on ffmpeg-devel: -profile option broken(?).

comment:5 by Carl Eugen Hoyos, 13 years ago

Work-around is to use -vprofile.

comment:6 by patronanejo, 13 years ago

As a practical matter, would it be insufficient to have ffmpeg pass -coder 0 to x264? Unless you intend to apply CABAC-dependent features, turning off entropy coding is one way to access baseline profile.


EDIT: Oops, this isn't working for me! I'm using ffmpeg version N-32071-g276f43b, Copyright (c) 2000-2011 the FFmpeg developers, built on Aug 23 2011 11:01:40 with gcc 4.6.1 using x264 git-392e7621. Accessed from http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-git-276f43b-win32-static.7z


F:\Formula One\Week XII - Spa-Francorchamps - 28.08.2011>ffmpeg -i "Formula_1_
-_2011_The_Belgian_Grand_Prix.flv" -s hd480 -vcodec libx264 -acodec copy -coder 0 "F:\Formula One\Week XII - Spa-Francorchamps -

28.08.2011\F1.Test.mp4"

ffmpeg version N-32071-g276f43b, Copyright (c) 2000-2011 the FFmpeg developers

built on Aug 23 2011 11:01:40 with gcc 4.6.1
configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enabl

e-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-
libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-lib
gsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschr
oedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv
px --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib

libavutil 51. 13. 0 / 51. 13. 0
libavcodec 53. 11. 0 / 53. 11. 0
libavformat 53. 9. 0 / 53. 9. 0
libavdevice 53. 3. 0 / 53. 3. 0
libavfilter 2. 34. 2 / 2. 34. 2
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0

[flv @ 01A6A020] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'Formula_1_-_2011_The_Belgian_Grand_Prix.flv':

Metadata:

duration : 12159
moovPosition : 2275431702
width : 832
height : 468
videocodecid : avc1
audiocodecid : mp4a
avcprofile : 77
avclevel : 30
aacaot : 2
videoframerate : 25
audiosamplerate : 24000
audiochannels : 2

Duration: 03:22:38.89, start: 0.000000, bitrate: N/A

Stream #0.0: Video: h264 (Main), yuv420p, 832x468 [SAR 117:117 DAR 16:9],

25 tbr, 1k tbn, 50 tbc

Stream #0.1: Audio: aac, 48000 Hz, stereo, s16

[buffer @ 01A6FFA0] w:832 h:468 pixfmt:yuv420p tb:1/1000000 sar:117/117 sws_pa
ram:
[scale @ 037981E0] w:832 h:468 fmt:yuv420p -> w:852 h:480 fmt:yuv420p flags:0x
4
[libx264 @ 034B0060] using SAR=1/1
[libx264 @ 034B0060] using cpu capabilities: MMX2 SSE2Slow SlowCTZ
[libx264 @ 034B0060] profile High, level 3.0
[libx264 @ 034B0060] 264 - core 116 r2044 392e762 - H.264/MPEG-4 AVC codec - C
opyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=3

deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_r

ef=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pski
p=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=
0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0

direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40

intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qp
max=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'F:\Formula One\Week XII - Spa-Francorchamps - 28.08.2011\F
1.Test.mp4':

Metadata:

duration : 12159
moovPosition : 2275431702
width : 832
height : 468
videocodecid : avc1
audiocodecid : mp4a
avcprofile : 77
avclevel : 30
aacaot : 2
videoframerate : 25
audiosamplerate : 24000
audiochannels : 2
encoder : Lavf53.9.0
Stream #0.0: Video: h264 (![0][0][0] / 0x0021), yuv420p, 852x480 [SAR 117:

117 DAR 71:40], q=2-31, 25 tbn, 25 tbc

Stream #0.1: Audio: aac (@[0][0][0] / 0x0040), 48000 Hz, stereo

Stream mapping:

Stream #0.0 -> #0.0: h264 -> libx264
Stream #0.1 -> #0.1: copy

Press [q] to stop, ? for help
frame= 37 fps= 0 q=0.0 size= 0kB time=00:00:00.00 bitrate= 0.0kbits
frame= 44 fps= 43 q=31.0 size= 1kB time=00:00:00.04 bitrate= 176.8kbit
frame= 54 fps= 34 q=28.0 size= 7kB time=00:00:00.44 bitrate= 125.0kbit
frame= 60 fps= 27 q=28.0 size= 18kB time=00:00:00.68 bitrate= 211.1kbit
frame= 64 fps= 23 q=28.0 size= 26kB time=00:00:00.84 bitrate= 255.6kbit
frame= 69 fps= 21 q=28.0 size= 35kB time=00:00:01.04 bitrate= 275.7kbit
frame= 74 fps= 19 q=28.0 size= 45kB time=00:00:01.24 bitrate= 294.5kbit
frame= 79 fps= 18 q=28.0 size= 52kB time=00:00:01.44 bitrate= 298.4kbit
frame= 82 fps= 16 q=28.0 size= 62kB time=00:00:01.56 bitrate= 326.0kbit
frame= 86 fps= 16 q=28.0 size= 74kB time=00:00:01.72 bitrate= 352.2kbit
frame= 90 fps= 15 q=28.0 size= 84kB time=00:00:01.88 bitrate= 365.9kbit
frame= 94 fps= 14 q=28.0 size= 109kB time=00:00:02.04 bitrate= 437.1kbit
frame= 96 fps= 13 q=28.0 size= 127kB time=00:00:02.12 bitrate= 489.6kbit
frame= 98 fps= 12 q=28.0 size= 166kB time=00:00:02.20 bitrate= 619.4kbit
s/s dup=1 drop=0

Last edited 13 years ago by patronanejo (previous) (diff)

comment:7 by Carl Eugen Hoyos, 13 years ago

@patronanejo: Does -vprofile baseline not work for you?

comment:8 by zimbatm, 12 years ago

-vprofile works fine with on HEAD for me even if it's undocumented (unless the -profile option) when running ffmpeg -h

comment:9 by Michael Niedermayer, 12 years ago

Reproduced by developer: set
Resolution: fixed
Status: openclosed

will be fixed in my next git push

Note: See TracTickets for help on using tickets.