Log in

View Full Version : CBR encoding for specific video players


Santa
4th November 2011, 16:56
Hi all, I need to encode 2 video streams, left + right for a 3D movie.
I'll work in a situation that will consist of 2 projectors with polarized filters, specific glasses and 2 video players (1 for the left eye one for the right eye).

These 2 video players can play H264 L4.1 video files with a bitrate that must not exceed 20mbps.
To reach a perfect synchronization the bitrate should be constant, so that the 2 players, once the "play" command is sent, will continuously play the 2 files in sync.

I tried different encodings and noticed that in fact, a variable bitrate, produce some little sync. problem.

Now, which is the best way to produce 2 different video streams at the same constant bitrate?

I tried the following:

x264.exe --level 4.1 --bitrate 13000 --deblock 1:-1 --b-adapt 2 --ref 4 --qpmin 10 --qpmax 51 --vbv-bufsize 12500 --vbv-maxrate 13000 --ratetol 0.1 --merange 32 --me umh --partitions all --trellis 2 --no-fast-pskip --sar 1:1 --output "output" "input"

than muxed with ts muxer (is it important to set tsmuxer in CBR/VBR mode?) in a .ts container.

the result is a file that plays correctly but in some scenes I see some artifacts, like coloured macroblocks that lasts for 1 second or so...

I noticed that mediainfo see a max bitrate of 40000kbps even if i set the vbv-maxrate at a value of 13000:

General
ID : 1 (0x1)
Complete name : left_CBR.ts
Format : MPEG-TS
File size : 662 MiB
Duration : 8mn 4s
Overall bit rate mode : Variable
Overall bit rate : 11.5 Mbps
Maximum Overall bit rate : 35.5 Mbps

Video
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : 27
Duration : 8mn 5s
Bit rate mode : Variable
Bit rate : 10.9 Mbps
Nominal bit rate : 13.0 Mbps
Maximum bit rate : 40.0 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.219
Stream size : 630 MiB (95%)
Writing library : x264 core 119 r2106 07efeb4
Encoding settings : cabac=1 / ref=4 / deblock=1:1:-1 / analyse=0x3:0x133 / me=umh / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=12 / 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=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=cbr / mbtree=1 / bitrate=13000 / ratetol=0.1 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / vbv_maxrate=13000 / vbv_bufsize=12500 / nal_hrd=none / ip_ratio=1.40 / aq=1:1.0


what am I doing wrong? where are my mistakes?

Dark Shikari
4th November 2011, 19:06
I noticed that mediainfo see a max bitrate of 40000kbps even if i set the vbv-maxrate at a value of 13000:MediaInfo does not correctly measure maximum bitrate.

Santa
4th November 2011, 19:37
thank you dark shikari for the info.
what about the command line parameters i used?
do you think there is a better way to do a CBR encoding?
To avoid the video artifacts I'll try to raise up the bitrate even if I thought that 13000kbps were enough for a 1080p movie.

Dark Shikari
4th November 2011, 19:57
You should not mess with ratetol so heavily unless you understand the code, it may cause unintended side effects.