Page 1 of 1
how to select constant bitrate
Posted: Fri Mar 22, 2013 8:36 am
by TechnoPhil
Hi there,
i am not able to select "constant bitrate" on HandBrake!
I do not mean "Constant quality" that creates a variable bitrate!
Can HandBrake encode with constant bitrate?
Thank you!
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 10:32 am
by TedJ
Average bitrate, you mean?
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 10:43 am
by TechnoPhil
No,
i mean constant bit rate.
For example: -b 10000k means everage bitrate for the encoded video, but some scenes will have lower bitrate, othe higher.
Is it possible to choise a fixed bitrate for all ?
Fixed constant bitrate gives a higher quality, average bitrate gives very good quality with less space!
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 12:33 pm
by TedJ
I can't say I've ever seen a true CBR video encoder as they would be terribly inefficient.
The reason why you'll see bitrate variations from one scene to another in an ABR encode is that the image complexity and therefore the required bitrate to reach a given quality metric varies markedly from scene to scene. Under those circumstances it makes little sense to allocate exactly the same bitrate to both scenes; it's far better to work from a bit reservoir allocating bitrate as needed while aiming for a target bitrate across the entire encode.
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 12:50 pm
by TechnoPhil
Ok, so a CBR encoding is not useful as a VBR encoding, that's why HandBrake does not use it. Am i correct?
This is the script i am using for the test (handbrake-tff-h264-vbr):
for i in *.mov; do newname=`basename $i .mov`.mp4; HandBrakeCLI -e x264 -b 10000 -r 29.97 --pfr -E faac -B 256 -R 48 -f mp4 -4 -X 1280 -x :tff --loose-anamorphic -m -i $i -o $newname; done
I noticed that also with using ffmpeg is not possible to take a CBR encoding, but only a VBR encoding (ffmpeg-tff-mpeg2-vbr):
for i in *.mov; do newname=`basename $i .mov`.mp4; ffmpeg -i $i -s 1280x720 -b 10000k -aspect 16:9 -r 25 -vcodec mpeg2video -flags +ildct+ilme -top 1 -ac 2 -ar 48000 -ab 256k -threads 4 $newname; done
Thanks you for you answer!
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 1:12 pm
by Deleted User 11865
x264's CBR mode is enabled by setting vbv-maxrate=<bitrate> in the advanced panel (or via the CLI's --encopts option),
where <bitrate> is the same as the selected average bitrate.
You'll also need to set vbv-bufsize, otherwise the maxrate will be ignored
(when in doubt, you may set it to the same value as the maxrate).
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 1:21 pm
by TechnoPhil
Rodeo wrote:x264's CBR mode is enabled by setting vbv-maxrate=<bitrate> in the advanced panel (or via the CLI's --encopts option),
where <bitrate> is the same as the selected average bitrate.
You'll also need to set vbv-bufsize, otherwise the maxrate will be ignored
(when in doubt, you may set it to the same value as the maxrate).
Thanks you for the answer,
i tried:
for i in *.mov; do newname=`basename $i .mov`.mp4; HandBrakeCLI -e x264 vbv-maxrate=10000 vbv-bufsize=10000 -r 29.97 --pfr -E faac -B 256 -R 48 -f mp4 -4 -X 1280 -x :tff --loose-anamorphic -m -i $i -o $newname; done
Am i correct with the syntax? But "mediainfo" tell me:
Overall bit rate mode : Variable
Overall bit rate : 1 303 Kbps
Why?
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 1:25 pm
by vid.user
Maybe because you haven't specified the bit rate in that command line!
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 1:29 pm
by Deleted User 11865
Because you can't follow instructions?
TechnoPhil wrote:Rodeo wrote:x264's CBR mode is enabled by setting vbv-maxrate=<bitrate> in the advanced panel (or via the CLI's --encopts option),
where <bitrate> is the same as the selected average bitrate.
You'll also need to set vbv-bufsize, otherwise the maxrate will be ignored
(when in doubt, you may set it to the same value as the maxrate).
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 1:37 pm
by TechnoPhil
@ Rodeo
You are right, but be patient, I am only a beginner
Now it is working:
for i in *.mov; do newname=`basename $i .mov`.mp4; HandBrakeCLI -e x264 -b 10000 -r 29.97 --pfr -E faac -B 256 -R 48 -f mp4 -4 -X 1280 -x vbv-maxrate=10000 -x vbv-bufsize=10000 -x tff --loose-anamorphic -m -i $i -o $newname; done
But "mediainfo" continues to report this information:
Overall bit rate mode : Variable
Overall bit rate : 10.2 Mbps
Am i correct or mediainfo is sayng the truth?
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 1:40 pm
by Deleted User 11865
You can only specify -x once - multiple options are separated by colons:
-x option1=value1:option2=value2
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 1:57 pm
by TechnoPhil
@ Rodeo
Ok, this is my final script:
for i in *.mov; do newname=`basename $i .mov`.mp4; HandBrakeCLI -e x264
-b 10000 -r 29.97 --pfr -E faac -B 256 -R 48 -f mp4 -4 -X 1280
-x vbv-maxrate=10000:vbv-bufsize=10000:tff --loose-anamorphic -m -i $i -o $newname; done
Mediainfo says:
Bit rate mode : Variable
Bit rate : 9 467 Kbps
Nominal bit rate : 10 000 Kbps
Other problem: i tried to use another codec, mpeg2:
for i in *.mov; do newname=`basename $i .mov`.mp4; HandBrakeCLI
-e ffmpeg2 -b 10000 -r 29.97 --pfr -E faac -B 256 -R 48 -f mp4 -4 -X 1280
-x vbv-maxrate=10000:vbv-bufsize=10000:tff --loose-anamorphic -m -i $i -o $newname; done
With this codec i can't obtain an interlaced video "Top Field First" but only progressive. Why?
Forgive me for this questions, but it is a long long time that i am trying to find the solutions by google!
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 2:30 pm
by Deleted User 11865
Different encoder, different options. I have little knowledge of libavcodec options (which are what's used to ffmpeg2/ffmpeg4 encoders).
Re: how to select constant bitrate
Posted: Fri Mar 22, 2013 2:39 pm
by TechnoPhil
Rodeo wrote:Different encoder, different options. I have little knowledge of libavcodec options (which are what's used to ffmpeg2/ffmpeg4 encoders).
Ok.. who can help me with
ffmpeg2 in your opinion?
Are you shure that using h264 i can create a CBR with the options
-b 10000 -x vbv-maxrate=10000:vbv-bufsize=10000 ? Maybe "mediainfo" is wrong...
The file size for CBR and VBR is the same!
Thank you for support!
Re: how to select constant bitrate
Posted: Sat Mar 23, 2013 3:54 pm
by TechnoPhil
@ Rodeo
Am i correct?
Re: how to select constant bitrate
Posted: Sat Mar 23, 2013 4:06 pm
by Deleted User 11865
MediaInfo is not reliable when it comes to detecting variable vs. constant framerate, so it wouldn't surprise me if it had issues with bitrate too.
TBH I don't care.
Re: how to select constant bitrate
Posted: Sat Mar 23, 2013 4:10 pm
by TechnoPhil
Ok, that's all!
In any case i prefer VBR!
Waiting for other opinions ...
Thank you!