[x264-devel] libx264 encoding parameters that influence SPS and PPS
declan harrison
harrison.declan at gmail.com
Sat Sep 18 15:23:29 CEST 2010
Hi
Using ffmpeg command line (see below) with an input flash video file
to create an output flash video file whose size is smaller than the
input file and bitrate differ but in most other ways the files should
be the same (profile, level etc).
So I'm trying to create this output file to have basically the same
SPS and PPS that the input flash video file has.
So I need to create the file with the same profile (Main) and level
(30), this is done easily. However I still find that when I analyse
the streams using H264Visa that the SPS and PPS values are still
different. The profile and level values are correct in that they both
have profile of "Main" and level "30" but there are still differences
that affect playback on most players.
I have manually taken the SPS and PPS values from the original input
file file and used these values to replace the SPS/PPS on the output
file. Problem with this is the video no longer is visible, I see
green or grey screen only.
Can you advise me what x264 parameters influence the values inserted
into the SPS and PPS so that I could change these so that they more
reflect the input flash video files. The SPS and PPS values that I
notice are quite different are the following;
I can provide more information as required.
The analysis of the streams and differences are shown below
Thanks
Parameter test.bbc.flv
test.bbc.10.demux.encode.flv
==================== ============
=============================
log2_max_frame_num_minu4 2
5
log2_max_pic_order_cnt_lib_minus4 2
6
number_ref_frames 3
2
VUI Parameters
aspect_ratio_info_present_flag 1
Not Preset
aspect_ratio_idc 1
Not Preset
num_units_in_tick 40
1
time_scale 1998
2000
fixed_frame_rate_flag 1
0
num_reorder_frames 0
1
max_dec_frame_buffering 3
2
PPS differences
Parameter
test.bbc.flv test.bbc.encode.flv
==================== ============
=============================
pic_init_qp_minus26 0
2
ffmpeg command line
================
ffmpeg -i test.bbc.flv -vcodec libx264 -crf 30 -coder 1 -flags -loop
-cmp -chroma -me_method epzs -subq 1 -me_range 16 -g 250 -keyint_min
25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 0 -qcomp 0.6 -qmin 10
-qmax 51 -qdiff 4 -refs 1 -directpred 1 -trellis 0 -bf 1 -flags2
-wpred-dct8x8+mbtree -partitions
-parti8x8-parti4x4-partp8x8-partp4x4-partb8x8 -level 30 -b 640k
-acodec libfaac -ab 32k test.bbc.out.flv
libavutil 50.23. 0 / 50.23. 0
libavcore 0. 2. 0 / 0. 2. 0
libavcodec 52.84. 2 / 52.84. 2
libavformat 52.78. 0 / 52.78. 0
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.27. 0 / 1.27. 0
libswscale 0.11. 0 / 0.11. 0
[flv @ 0xda97470] Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate:
49.95 (999/20) -> 49.92 (599/12)
Input #0, flv, from 'test.bbc.flv':
Metadata:
duration : 40
starttime : 0
totalduration : 40
width : 640
height : 360
videodatarate : 796
audiodatarate : 108
totaldatarate : 902
framerate : 25
bytelength : 4567175
canseekontime : true
sourcedata : B4A7DD024
Duration: 00:00:39.96, start: 0.000000, bitrate: 926 kb/s
Stream #0.0: Video: h264, yuv420p, 640x360 [PAR 1:1 DAR 16:9], 815
kb/s, 49.92 tbr, 1k tbn, 49.95 tbc
Stream #0.1: Audio: aac, 44100 Hz, stereo, s16, 110 kb/s
File 'test.bbc.out.flv' already exists. Overwrite ? [y/N] y
[buffer @ 0xda9bb80] w:640 h:360 pixfmt:yuv420p
[libx264 @ 0xda9aae0] using SAR=1/1
[libx264 @ 0xda9aae0] MB rate (45923) > level limit (40500)
[libx264 @ 0xda9aae0] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle SSE4.1 Cache64
[libx264 @ 0xda9aae0] profile Main, level 3.0
[libx264 @ 0xda9aae0] 264 - core 102 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2010 - http://www.videolan.org/x264.html - options:
cabac=1 ref=1 deblock=0:0:0 analyse=0x1:0 me=dia subme=1 psy=1
psy_rd=0.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0
8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0
threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0
constrained_intra=0 bframes=1 b_pyramid=0 b_adapt=0 b_bias=0 direct=1
weightb=0 open_gop=0 weightp=0 keyint=250 keyint_min=25 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=30.0 qcomp=0.60
qpmin=10 qpmax=51 qpstep=4 ip_ratio=1.41 aq=1:1.00
Output #0, flv, to 'test.bbc.out.flv':
Metadata:
encoder : Lavf52.78.0
Stream #0.0: Video: libx264, yuv420p, 640x360 [PAR 1:1 DAR 16:9],
q=10-51, 640 kb/s, 1k tbn, 49.92 tbc
Stream #0.1: Audio: libfaac, 44100 Hz, stereo, s16, 32 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
frame= 999 fps= 94 q=-1.0 Lsize= 1701kB time=39.95 bitrate= 348.9kbits/s
video:1365kB audio:288kB global headers:0kB muxing overhead 2.950560%
[libx264 @ 0xda9aae0] frame I:9 Avg QP:26.54 size: 7001
[libx264 @ 0xda9aae0] frame P:497 Avg QP:29.76 size: 2214
[libx264 @ 0xda9aae0] frame B:493 Avg QP:33.49 size: 473
[libx264 @ 0xda9aae0] consecutive B-frames: 0.4% 99.6%
[libx264 @ 0xda9aae0] mb I I16..4: 53.8% 0.0% 46.2%
[libx264 @ 0xda9aae0] mb P I16..4: 22.1% 0.0% 0.0% P16..4: 33.6%
0.0% 0.0% 0.0% 0.0% skip:44.3%
[libx264 @ 0xda9aae0] mb B I16..4: 2.7% 0.0% 0.0% B16..8: 10.4%
0.0% 0.0% direct: 2.1% skip:84.8% L0:41.4% L1:48.9% BI: 9.7%
[libx264 @ 0xda9aae0] coded y,uvDC,uvAC intra: 22.9% 29.3% 4.0% inter:
5.1% 7.3% 0.1%
[libx264 @ 0xda9aae0] i16 v,h,dc,p: 43% 26% 16% 15%
[libx264 @ 0xda9aae0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 21% 17% 4%
6% 4% 4% 5% 5%
[libx264 @ 0xda9aae0] i8c dc,h,v,p: 45% 20% 28% 7%
[libx264 @ 0xda9aae0] kb/s:279.30
# mediainfo test.bbc.out.flv
General
Complete name : test.bbc.out.flv
Format : Flash Video
File size : 1.66 MiB
Duration : 40s 446ms
Overall bit rate : 345 Kbps
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main at L3.0
Format settings, CABAC : Yes
Format settings, ReFrames : 2 frames
Muxing mode : Container profile=Unknown at 3.0
Duration : 40s 446ms
Bit rate : 625 Kbps
Width : 640 pixels
Height : 360 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 49.917 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.054
Stream size : 3.01 MiB
Writing library : x264 core 102
Encoding settings : cabac=1 / ref=1 / deblock=0:0:0 /
analyse=0x1:0 / me=dia / subme=1 / psy=1 / psy_rd=0.00:0.00 /
mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0
/ deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=1 /
sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 /
constrained_intra=0 / bframes=1 / b_pyramid=0 / b_adapt=0 / b_bias=0 /
direct=1 / weightb=0 / open_gop=0 / weightp=0 / keyint=250 /
keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 /
rc=crf / mbtree=1 / crf=30.0 / qcomp=0.60 / qpmin=10 / qpmax=51 /
qpstep=4 / ip_ratio=1.41 / aq=1:1.00
Audio
Format : AAC
Format/Info : Advanced Audio Codec
Format version : Version 4
Format profile : LC
Format settings, SBR : No
Duration : 40s 446ms
Bit rate : 31.2 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz
Bit depth : 16 bits
Stream size : 154 KiB (9%)
More information about the x264-devel
mailing list