View Full Version : [AME CS4 + CS5] h.264 encoding: max bitrate setting does not limit max bitrate used


Markus Klatt
October 14th, 2010, 03:09 AM
I try to encode a timeline (which contains a clean and ready rendered intermediate file, Microsoft AVI with Lagarith lossless codec, 1280x720/25p). I tried this in my CS4 and just could test on CS5 with PP 5.0.2 und AME 5.0.1 on Win7 64bit.

The resulting file has to be encoded with h.264 in a mp4 container. The video will be given to different people, so compatibility must be high for PCs and MACs, eg. played with VLC.
I chose 1280x720/25p, so that less powered machines can still handle it (other than 720/50p or 1080/25p). The videos are filmed calmly on tripod, but contain fast changes of little content in the night sky to full screen action with lots of moving details.

I stay with "High" profile and level "4.1", exporting as "h.264" (tried "h.264 Blu-ray", but the results are not better and I've TS-muxing only, no mp4 container). I tried several encoding settings in AME (CS4 and CS5), changing to Main profile with 3.2 or 4.0 level or High provile with level 5.1. The image quality differs as expected, but the problem exists in any settings, more or less.

So, and here's my problem: If a use VBR-2pass with eg. 6 to 8MBit max, or 4 to 6MBit max, or 10 to 15MBit max, the resulted bitrates differ from the correct average bitrates (yes, this is working, cheers) to A LOT of peaks upto 22, 25, 30 MBit, even upto 39MBit max with the 15MBit setting.
How can this be? Does the max bitrate setting does not limit the max used bitrate? I am really afraid that such high double or even triple bitrate jumps will cause stuttering or even stopping on several playing machines. Of cause, working bitrate limits with high details would cause image quality loss, but that's the game, you cannot have everything.
But I expect that limting the bitrate to eg. 10 MBit max should limit any peak at least to not more than 12-15 MBit.
TMPGenc Express 4 handels this is much better, but has other disadvantages. So I would like to use AME.

Is there any hint to solve that behaviour? Does others experienced a similar problem?
Thanks in advance for any comment...

Markus Klatt
October 15th, 2010, 07:31 AM
Nobody experienced a similar problem? Better try the freeware "Bitrate Viewer" or check the codec statistics while playing the files in VLC and probably you will be surprised.

So, although I could not avoid it, I've found a very strong hint that something wents wrong in AME - or in PPro.
Although I set the max bitrate in PPro when exporting media as "h.264" choosing VBR-2pass, this information is not handed over to AME or at least it is not manifested in the encoded files.
If you check the encodings from AME with the tool "MediaInfo", there is only an information for avarage bitrate, no information for the maximum. BUT, encoded the same with TMPGenc XPress 4 there is a maximum bitrate information written into the file. And as said, TMPGEnc handels the maximum bitrate much better. Not perfect, but way better then AME. In AME because of the missing maximum setting I have lots of jumps upto 40 MBit (!), where in TMPGEnc there are much less peaks and they reach 20-22 MBit only, when set the maximum bitrate to 15 MBit.

So Adobe, do I do anything wrong? Do you have a valid explanation for this behaviour, please?

Robert Young
October 15th, 2010, 05:12 PM
For h.264, I try to avoid making completely manual settings and work form the CS5 presets instead.
So, for example, yesterday I was encoding a timeline for mp4 HD for web- I start with the h.264 preset for "Vimeo HD" (720x1280), make adjustments only for bit rate, CBR vs VBR,1 or 2 pass, audio data rate and make the transcode. The resulting file plays well on a variety of players, as well as streaming on the web. Although I haven't tried to measure for any data rate spikes, I don't have any observable reason to think things are not as they should be with these encodes.

Markus Klatt
October 16th, 2010, 06:21 AM
Thank you Robert. But for an industrial NLE tool it simply has to work, what it offers.

I started all my tries from "HDTV 720p High Quality" and from "Vimeo HD" preset and just changed very little, VBR2-pass and maximum bitrate. For the Vimeo preset of course I have to change the TV standard/frame rate, since I live in a PAL country.
And in any preset I started with this behaviour is the same. For fun I just encoded my file in the Vimeo HD preset, changing nothing, so keeping NTSC, Main Profile with 3.1 Level, target bitrate 4 MBit, maximum bitrate 5 MBit.
And guess what? It's just the same. Peaks are going as high as 25 MBit (with a maximum set to 5 MBit!).

Markus Klatt
October 16th, 2010, 09:35 AM
Just to conclude this - the "h.264 Blu-ray" encoding performs much better than the "h.264" encoding.

At least using native 1920x1080/50i interlaced material with PPro -> AME it:

1.- writes the maximum bitrate correctly into the encoded file
2.- although I encoded with 25 to 30 MBit settings, it has an average bitrate of 12 MBit only with a maximum of 22 MBit, but it gives a very pleasent image quality.

So, my recommendation is this:

1.- encoding for Blu-ray either in 1920x1080 or 1280x720: use AME
2.- encoding for distribution as mp4 file or for upload on web with best image quality: use AME, it keeps the maximum image quality by ignoring the max bitrate setting and letting it go as high as 40 MBit for 720/25p!
3.- encoding for distribution as a maximum compatible mp4 file: use something else, like TMPGEnc and experiment with all the encoding detail settings to get best results

That's for it from my view.

Markus Klatt
November 3rd, 2010, 11:08 AM
Congratulations, AME, you've got a new world record:

Using the preset HDTV 25p for H.264 encoding, on clean footage 1280x720/25p from an EX1R I've got a peak at 56MBit (!) while encoding in AME with 12 MBit Average and 15MBit Maxiumum setting. That's perfect for the image quality, its stays incredible all the time - on cost of compatibility. The average is always perfect at H.264 encoding but AME simply does not care about the maximum set.

The presets for "H.264 Blu-ray" are different. They perfectly do not pass the set maximum border, but AME stubby ignores the average setting. So imagine a preset 25MBit avarage to 35MBit maximum, the resulting video will never touch 35 MBit (frankly said it will very seldom touch 25MBit) but the average bitrate is as low as 8 to 12 MBit, with visible quality loss.

In both cases you get slightly (!) better results with VBR 2-pass then with 1-pass, but they are far away from the wished results. Best is CBR - you can bet on that AME will exactly use half of the set bitrate. So if you want 15 MBit, set AME to CBR 30 MBit. If you want 17,5MBit, set it to CBR 35 MBit. That really works great :D

Randall Leong
November 4th, 2010, 07:44 AM
Markus,

The problem with using Bitrate Viewer on any .m4v (H.264 Blu-ray) files is that regardless of the program used to create the .m4v to begin with, Bitrate Viewer will report the .m4v clips as being twice as long as the actual real-time length of that clip and thus will always report half of the actual bitrate encoded. (For example, Bitrate Viewer will report a 10-minute .m4v clip as being 20 minutes long; likewise, an hour-long .m4v clip is reported as being two hours long.) That is a bug in the current version of the Bitrate Viewer program. Remember, it was designed for MPEG-1 or MPEG-2 videos to begin with; it wasn't designed for H.264 until such support is slapped into the viewer program.

With that said, if I based my result on the actual length of the video clip, the H.264 Blu-ray preset with the average set to 25 Mbps and the maximum set to 35 Mbps, it does not limit individual peaks. As a result, the average bitrate is very close to the 25 Mbps average despite being mis-reported as 12.x Mbps (based on my observation), and the individual peak (which was 40.5 Mbps on my particular clop) remains at 40.5 Mbps.

Markus Klatt
November 4th, 2010, 11:45 AM
@Randall,

thank you a lot, that is great information! I really do want to understand, so I have to ask few more questions.

I can confirm that BitrateViewer 2.2 from 2010 shows double playing time of my m4v-files (btw, this is not the case with muxed mp4 files, the length of mp4 files is correct, see screenshot above, the measured bitrates correspond with the live datarate which can be seen under "Codec Statistics" while playing in VLC player). So I have a perfect average bitrate, but peaks of eg 56MBit, while 15MBit was set as maxium. That was my complain in the beginning of this thread, I really fear compatibility problems on foreign PCs (I use mp4 files for PC playback only, not for BDs). These peaks happen in PP 5.0.2 and AME 5.0.1 too.

But, more important, how do I read the following screenshots of two different encodings (different files), VBR and CBR, please?

CBR: you say, I have to take average double because BV reports double playing time (m4v do no play in VLC, so I am not able to verify the bitrate other than in BV. Do you know a different way to check?). This would mean CBR average lays perfectly at 35 MBit, which was set in AME. What do you think are with the few peaks with +26MBit? The peaks cannot be less than the average. Should I count them double too or is this a real error of BV?

VBR 2-pass: The average, when doubling it, are at +28MBit which is close to the set 30 MBit. The peaks are less, at around 24 MBit - what is the real value of the peaks? Do I have to fear playback/stuttering problems on older Blu-ray players?

BTW - I would have expected much better image quality für real 35MBit. The details are somehow fine, but at color gradients (eg. blue/night sky) I really would have expected less bending. That's why I was deeply willing to think its 17,5MBit only.
Thanks a lot for any further hint!