Problem with "average bitrate"

Started by david.dgc, March 15, 2012, 01:21:21 AM

Previous topic - Next topic

david.dgc

When i give a value in 2 pass "average bitrate", the final AVI file NEVER has the bitrate that i gave in the configuration. Why this happens? i calculate the bpp (bitperpixel) to give me the exact bitrate that i need, but when i encode the final file never respects the bitrate...

thanks

Jan Gruuthuse

QuoteTwo Pass - Average Bitrate: This mode will encode your video at an average bitrate and it will use two encoding passes. Consequently this mode requires twice the time of a ââ,¬Å"Single Passââ,¬Â encode (roughly). In contrast to CRF mode (and QP mode) the resulting average bitrate is known in advance. Therefore it's easy to predict the final file size. A higher bitrate will result in a better visual quality, but of course it will also result in a bigger file. A lower bitrate will results in a smaller file, but it will also result in a worse visual quality. During the first pass the encoder will perform a detailed analysis of the video and create a so-called ââ,¬Å"statsââ,¬Â file. Then during the second pass the actual encoding takes place and the final file is created. The advantage of using two passes is that during the second pass the encoder can rely on the data collected during the first pass. This allows the encoder to distribute the available bits among the entire video. For example ââ,¬Å"high motionââ,¬Â scenes will get a significant higher bitrate than ââ,¬Å"staticââ,¬Â scenes. This is done in order to keep the visual quality constant over the whole movie. Ugly ââ,¬Å"blockingââ,¬Â on fast/spontaneous movement (as seen in ââ,¬Å"Single Passââ,¬Â encodes) is avoided. Therefore a ââ,¬Å"Two Passââ,¬Â encode provides the maximum visual quality for the given target bitrate (file size). It's highly recommended to always use this mode, if you are targeting for a certain average bitrate!
source: H.264 encoding guide
my thinking: Targeting: you're not always hitting the bullseye
QuoteAverage bitrate can also refer to a form of variable bitrate (VBR) encoding in which the encoder will try to reach a target average bitrate or file size while allowing the bitrate to vary between different parts of the audio or video
source: Average bitrate

other issues could come in to play: used OS, used source, type of content, ....

david.dgc

For exemple, in handbrake when i give a bitrate for the 2 pass, the program "respects" the bitrate that i gave.

With avidemux, i give for example 5000kbs (brrip 720p) and the final avi comes with 3500.  :-[

This is annoying because i calculate the bitperpixel before and after hours of convertion, the avi never has the bitrate that i want..

how this happens? if the option doesn't work well, there is no point to exist.

Jan Gruuthuse

#3
You should provide more details, so the steps you took can be reproduced!
Source video? And its relevant info
Avidemux version 2.5.4, 2.5.5, 2.5.6, ... , OS and flavor : Linux, Mac OS X, Windows
Steps taken in avidemux and settings.

And the same for handbrake?
Preliminary testing in handbrake with short sample with 2-pass VBR target (not ABR) with 1500 kbps results in 1454 to 1552 kbps from a 6445 kbps VC-1 encoded video

Very confused: handbrake only supports mp4 or mkv containers? No .avi output?
https://trac.handbrake.fr/wiki/Containers

from avidemux wiki: Guide to encoding types
QuoteTwo pass
... So, using two-pass mode will give you:

A given filesize
A good distribution of bits

styrol

QuoteVery confused: handbrake only supports mp4 or mkv containers? No .avi output?
AVI is a relict and does not support modern container features (e.g.. chapters, muxed-in subtitles). MP4 is the best (modern) container what compatibility is concerned, MKV is most flexible. The developers just focus on these two container (and the two encoders x.264 and ffmpeg MPEG-4 Part 2) since version 0.9.4: What Handbrake does, it does it very well.

nibbles

Neat experiment.  You have a source video.  You want to see how Handbrake and Avidemux handle 2pass avg bitrate encoding.  Your options for comparison are best expressed on the command line for HandBrake, because it is important to be specific.  Here is what Handbrake let's you encode as:

### Video Options------------------------------------------------------------

    -e, --encoder <string>  Set video library encoder
                            Options: x264/ffmpeg4/ffmpeg2/theora
                            (default: ffmpeg4)


So you'll have to decide what you're going to use.  You will enjoy this page of the HandBrakeCLI wiki.

Once you've decided on your video and audio encoding format, please grab a small video from youtube and use it as your source maybe.  Share the link.  Use movgrab to download the exact format and resolution if you want.  I gave an example on these forums once.

david.dgc

#6
Here you have all the configurations that i gave do the avi:

http://www.avidemux.org/smf/index.php?topic=10418.0


My OS is windows 7 professional SP1 and the avidemux version 2.5.6

When i refer handbrake it was has an example. i use it to convert bluray's to 1080p x264 and with handbrake, with the 2 pass settings and average bitrate, the bitrate that i give (10 000kbs) is always present in the final mkv.

Now, i'm trying avidemux to convert some of that 1080p's that i have, but i'm getting troubles with the "average bitrate"...

nibbles

Find a small source video on Youtube in 1080p.  Convert it in Handbrake.  Upload it somewhere and give us the link so we can inspect it and give you better analysis.  If you don't feel like it, ok.  I won't ask again.

david.dgc

Quote from: nibbles on March 18, 2012, 11:45:46 PM
Find a small source video on Youtube in 1080p.  Convert it in Handbrake.  Upload it somewhere and give us the link so we can inspect it and give you better analysis.  If you don't feel like it, ok.  I won't ask again.

I don't see the point of converting with handbrake because i'll have a x264 file and the objective is a xvid file, can you explain me why do you suggest to convert first with handbrake? i'm sorry if i seem stubborn but i don't understand what you are suggesting  ;)


there it is my converted file and the screenshots of the settings with avidemux (with the bitrate issue):

http://www.crocko.com/8A11DFE9658C4E3A81DEBD7BCF3D4B32/teste.zip

And the original sample (1080p xvid):

http://www.crocko.com/38AC859DCF3545B29F5EBAF6D11352BB/The_Three_Musketeers_2011_Sample.mkv


Jan Gruuthuse

Quote from: styrol on March 18, 2012, 05:55:33 PM
QuoteVery confused: handbrake only supports mp4 or mkv containers? No .avi output?
AVI is a relict and does not support modern container features (e.g.. chapters, muxed-in subtitles). MP4 is the best (modern) container what compatibility is concerned, MKV is most flexible. The developers just focus on these two container (and the two encoders x.264 and ffmpeg MPEG-4 Part 2) since version 0.9.4: What Handbrake does, it does it very well.
The confusion is not with what handbrake does, only with the initial TS posting and the references made in there. Anyway TS is clarifying further down what the target is: x264 file to xvid file with a precalculated ABR.

david.dgc

Quote from: nibbles on March 18, 2012, 11:45:46 PM
Find a small source video on Youtube in 1080p.  Convert it in Handbrake.  Upload it somewhere and give us the link so we can inspect it and give you better analysis.  If you don't feel like it, ok.  I won't ask again.

the sample converted with handbrake.

http://www.crocko.com/A808B63DD22B4C32A6E8039BBBE5FCEF/sample.mkv

i gave a 2 pass average bitrate of 3005kbs and the final mkv file has...3005kbs. with avidemux it never has the average bitrate in the settings, sometimes even half.

nibbles

Ok now give us the original video link at youtube.  Tell us what resolution and file format you downloaded from them, too please.

david.dgc

#12
Quote from: nibbles on March 19, 2012, 08:21:15 PM
Ok now give us the original video link at youtube.  Tell us what resolution and file format you downloaded from them, too please.

I croped a sample from a movie 1080p that i have, because i found some pixels on the 1080p from yotube:
1920x1080  - progressive -  23.976fps  - mkv x264

http://www.crocko.com/38AC859DCF3545B29F5EBAF6D11352BB/The_Three_Musketeers_2011_Sample.mkv


as an example  i finished to convert a movie with 1080p x264 with the 2 softwares (handbrake and avidemux). for the 2 convertions i gave a 3005kbs average bitrate:

with handbrake: final bitrate: 3005kbs (720p mkv x264)

with avidemux: final bitrate: 2674 kbs (720p avi xvid)


Why this happens? is this an issue from avidemux?



Jan Gruuthuse