View Full Version : x264 - errors in parameter parsing ?
pkirill
3rd December 2009, 09:10
Hi guys,
I have a trouble.
I`m trying to understand what kind of h264 video my mobile phone can hadle well so i`m trying a lot of configurations
- profiles
- +- cabac
- +- weightb
- different about of ref-frames
and i have a trouble with --ref <N> parameter
for example, following command line:
x264.exe --ref 1 --no-weightb --crf 21.0 --output tmp.mp4 s1.avs
gives me 2 ReFrames instean of one
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.0
Format settings, CABAC : Yes
Format settings, ReFrames : 2 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 10mn 28s
Bit rate mode : Variable
Bit rate : 817 Kbps
Maximum bit rate : 7 101 Kbps
Width : 768 pixels
Height : 432 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 25.000 fps
Resolution : 24 bits
Colorimetry : 4:2:0
Scan type : Progressive
Bits/(Pixel*Frame) : 0.098
Stream size : 61.2 MiB (100%)
Writing library : x264 core 79 r1354 636f98f
Encoding settings : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.0:0.0 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=-2 / threads=3 / nr=0 / decimate=1 / mbaff=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / wpredb=0 / wpredp=2 / keyint=250 / keyint_min=25 / scenecut=40 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=21.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
what i`m doing wrong ?
Thanks
Lam3rD
3rd December 2009, 09:36
Best option is to check sample videos the phone have (if it has any) also see manufacturer's site and/or the manufacturers of other phones, based on the same CPU what video is supported. Some mention the maximum their phone is capable of playing back. http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles Don't use high, but baseline profile.
Other tips:
Use the screen native resolution, so it doesn't need to resize the video during playback. Consider lowering the level if your screen resolution is 320x240 (or something like that) here is a reference of the levels http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels
Resize the source to the size of the screen and use something like that:
x264.exe --profile baseline --no-cabac --partitions none --crf 21.0 --output tmp.mp4 s1.avs
Note that most phones are too weak to handle AVC video, also most doesn't have support out of the box and require extra software. If everything fails you should consider using ASP as an alternative, which most phones can handle (often using extra software like CorePlayer). If your phone handles AVC and this (or other) comandline works try increasing some setting until it stops playing the result :-) This way you would know the maximum it is capable of.
LoRd_MuldeR
3rd December 2009, 11:39
for example, following command line:
x264.exe --ref 1 --no-weightb --crf 21.0 --output tmp.mp4 s1.avs
gives me 2 ReFrames instean of one
...
Writing library : x264 core 79 r1354 636f98f
Encoding settings : cabac=1 / ref=1 / deblock=1:0:0 / ...
what i`m doing wrong ?
Nothing. You got exactly what you requested. At least according to your MediaInfo report...
MatLz
3rd December 2009, 12:03
Hi.
If it can help, my crapold K850i can play avc baseline with 4refs frames, not more.
I use:--profile baseline --partitions p8x8,i4x4 --no-fast-pskip --ref 4 --rc-lookahead 250 --me tesa --subme 9 --merange 64 --psy-rd 0.00:0.00 --aq-mode 0
Chengbin
3rd December 2009, 13:11
Don't use high profile. Use baseline.
lexor
3rd December 2009, 15:16
Nothing. You got exactly what you requested. At least according to your MediaInfo report...
Really? That's not what I'm seeing, the report (the part that you quoted) says the command line has ref=1, but the actual output files (as seen in ReFrames field) has 2 ref frames.
LoRd_MuldeR
3rd December 2009, 15:29
You are right, in a way. MediaInfo shows contradictory information. On the one hand it shows "ReFrames: 2 frames", but on the other hand it shows "Encoding settings: [...] / ref=1".
The former was (obviously) detected by MediaInfo itself by analysing the H.264 stream, the latter is info that x264 writes to the stream and MediaInfo just reads from the file as plain text.
So x264 parsed and validated his parameters successfully. That's for sure. x264 only writes the parameters to the stream that it actually uses.
However the question remains why MediaInfo detects 2 ref frames, when x264 used only 1. So there's either a bug in MediaInfo detecting the number of ref frames or there's a bug in x264.
If there really was a bug in x264, that bug wouldn't be related to parameter parsing. It would mean that x264 uses more ref frames than it should with the given configuration.
But my guess is that MediaInfo is wrong here about the number of ref frames...
pkirill
3rd December 2009, 16:23
But my guess is that MediaInfo is wrong here about the number of ref frames...
I got an answer on this:
The "2 Reference Frames" likely refers to the fact that the total maximum combined size of both reference lists is 2. You cannot get less than this without disabling B-frames.
About phone (1Gz Snapdragon with HW CPU AVC decoder):
I was given a video that plays perfectly on my phone and it has high profile and following attributes:
Writing application : Lavf52.39.2
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.0
Format settings, CABAC : Yes
Format settings, ReFrames : 1 frame
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1mn 59s
Bit rate mode : Variable
Bit rate : 1 997 Kbps
Width : 800 pixels
Height : 450 pixels
Display aspect ratio : 16/9
Frame rate mode : Constant
Frame rate : 29.992 fps
Resolution : 24 bits
Colorimetry : 4:2:0
Scan type : Progressive
Bits/(Pixel*Frame) : 0.185
as u can see it contains 1-ReFrames and cabac on.
So question is : is it reasonable to set High profile + CABAC and turn off B-frames ?
DarkZell666
3rd December 2009, 19:00
There's a feature that increases the number of refs by at least 1. Wasn't that weight-p, which is enabled by default ?
- Cmd line = 1 ref
- Stream = 2 refs = 1 configured ref + 1 ref created by weight-p
Everything's ok AFAIK ;)
nurbs
3rd December 2009, 19:38
The ref frames you get for free from reordering don't show up in the mediainfo log.
vlada
11th January 2012, 15:53
Sorry to reopen this very old thread, but I think the problem wasn't explained and I'm getting the same confused information from MediaInfo. I have one file, which has these parameters:
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 4
Duration : 4s 40ms
Bit rate : 8000 Kbps
Nominal bit rate : 8000 Kbps
Width : 1920 pixels
Height : 1080 pixels
Display aspect ratio : 16/9
Frame rate : 25.000 fps
Colorimetry : 4:2:0
Scan type : Progressive
Bits/(Pixel*Frame) : 0.154
Writing library : x264 - core 116 r2074 2641b9e
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=6 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=24 / keyint_min=2 / scenecut=40 / intra_refresh=0 / rc_lookahead=25 / rc=2pass / mbtree=1 / bitrate=8000 / ratetol=1.0 / qcomp=0.50 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=16500 / vbv_bufsize=16500 / nal_hrd=vbr / ip_ratio=1.10 / aq=1:1.00
This file plays OK as AVCHD video on SD card. However this file doesn't play correctly:
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 3
Duration : 4s 40ms
Width : 1920 pixels
Height : 1080 pixels
Display aspect ratio : 16/9
Frame rate : 25.000 fps
Colorimetry : 4:2:0
Writing library : x264 - core 120 r2120 0c7dab9
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / sliced_threads=0 / slices=4 / nr=0 / decimate=1 / interlaced=fake / bluray_compat=1 / constrained_intra=0 / bframes=3 / b_pyramid=1 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=1 / weightp=1 / keyint=24 / keyint_min=2 / scenecut=40 / intra_refresh=0 / rc_lookahead=25 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / vbv_maxrate=14000 / vbv_bufsize=14000 / crf_max=0.0 / nal_hrd=vbr / ip_ratio=1.40 / aq=1:1.00
Both file were created with MeGUI and using AVCHD preset. The only obvious difference I can see is the ReFrames number.
Do you have any idea why the number in the first stream differes from what is set by the commandline and why the second file won't play?
sneaker_ger
11th January 2012, 16:02
Do you have any idea why the number in the first stream differes from what is set by the commandline
The number may vary depending on the b-pyramid setting.
and why the second file won't play?
Only a guess: the first is encoded as progressive, the second as fake-interlaced. Maybe your player does not like that, even though the latter is allowed in Blu-Ray/AVCHD, and the former not. (for 1080p25)
Other differences are slices, open-gop, b-pyramid etc.
Did you mux/create those files in exactly the same way, aside from the x264 revision and command-line?
vlada
11th January 2012, 22:11
Did you mux/create those files in exactly the same way, aside from the x264 revision and command-line?
Well, I thought I did. But apparently it isn't true. Since it is a longer time since I created the first video, I don't remember exactly how I encoded it. I thought I used the AVCHD preset in MeGUI, but that doesn't seem to be possible.
It is strange that many of the settings (for example the B-pyramid) used in the first video shouldn't be compatible with AVCHD but it plays while the other doesn't.
I need the video to play in Panasonic TV from SD card. I created some samples with different settings and tomorrow I will try to play them...
06_taro
12th January 2012, 03:32
sps->vui.i_num_reorder_frames = param->i_bframe_pyramid ? 2 : param->i_bframe ? 1 : 0;
sps->i_num_ref_frames = X264_MIN(X264_REF_MAX, X264_MAX4(param->i_frame_reference, 1 + sps->vui.i_num_reorder_frames,
param->i_bframe_pyramid ? 4 : 1, param->i_dpb_size));
sps->i_num_ref_frames -= param->i_bframe_pyramid == X264_B_PYRAMID_STRICT;
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.