h264 compression times on MBP 2.0GHz with max quality

Dehuti

Electric whale
I've performed some test recently, trying to maximize quality when converting HDV stream to H264 and in the same time maintain the smallest file size possible. Well I got a stunning result: 5 seconds of HDV 1080i footage = 5 HOURS of h264 render performed by compressor with adaptive deinterlacing and generally - best quality settings applied. :)

Considering the fact, that usually you would convert a movie that's more than 5 seconds long, let's say - it's a 1h movie - then the time it takes to make a render on your bleeding-edge hardware be like 150 DAYS.

I'm trying to decouple the process to learn what slows render so much, is it deinterlacing, or h264 multi-pass, or maybe motion detection, but if you have any experiences in that matter - I would gladly listen.
 
You do understand that high compression means long render time. High quality also means long render time. High compression at high quality means long^2 render time.
 
Sure I do, but the problem is - quality at the output was merely the same as the one I got from 12 min encoding with different (lower) settings. I constantly seek for proper parameters for HDV compression into 720p (1280x720) 10mbps sequence. I know how ugly HDV for recompression can be (it's already mpeg2 and what's more it's 4:0:0), but the question is - did anybody tried take h264 to the limit and really got the balance between quality and render time? I still didn't, therefore I ask.
 
Your source material places a limit on the quality of your output. Your output medium also places a limit on the quality of your output. If your output medium is DVD, then you are limited to 480p.

It seems to me that you need to define what you mean by quality. Professionals use test patterns to ensure that their equipment meets a predetermined standard. Perhaps, you should follow suit.
 
I agree. .what is quality to you?

Nothing is free.. high quality for video /audio means time.. lower quality, not soo much time. BUT, I am curious. If you do post your results quantatively that would be neat.
 
I've never used Compressor myself, but based on my experience with other encoders, I'd bet that motion estimation is your biggest avoidable bottleneck. Motion detection is an area most encoders make big compromises, because there's virtually no limit to how much it can be improved — if you're willing to suffer the performance hit. But for amateurs, the diminishing returns make it barely worth considering. So I'd crank it down. It'd still look pretty good.

Compressor's H.264 encoder might also be exceptionally slow (and high-quality). I'm not sure: does it use QuickTime to encode H.264 video? I hope not, because QuickTime's H.264 codec is pretty lousy, in terms of both speed and quality. x264 (accessible via a QuickTime codec or through non-QT-based apps like ffmpegX) runs circles around it. Since Compressor is a pro-level program, I assume it uses its own H.264 encoder, which, like just about everything else in such a pro-level program, would be geared to deliver the maximum quality, speed be damned. If I'm wrong and it uses QuickTime's standard encoder, have it use x264 instead.

If you can get away with simpler tools, like ffmpegX or some QT-based apps, it might be better to use them instead, as they're geared more for speed than no-compromise quality. It's always a balancing act, so it's worth looking around to find an encoder that suits your needs. But that's for you to judge — I don't know enough about you or your work to make a meaningful recommendation.
 
Thanks for answers in the first place. I'm aware of the limitations of HDV&H264, that's granted. My output media is 720p sequence in a file, DVD has to small resolution to really see the quality drawbacks I'm thinking here about. By quality I mean to get image free of compression artifacts in dark areas. My opinion on HDV->h264 conversion is that already existing mpeg2 artifacts (although not very visible in HDV stream) gets amplified in h264 quantization, and I want to avoid that as much as possible, keeping the output file size small.

I'll share with you my test results and since you were so kind to pay interest - I will upload on Saturday the 5sec original video with compression results (done by compressor and ffmpeg).
 
Dehuti said: "... and I want to avoid that [amplification of artefacts] as much as possible, keeping the output file size small."

I hope you're aware that you're right in the middle of the conundrum of video compression technology. You simply _won't_ be able to get maximum compression with highest quality. Although H.264 is generally better than older MPEG-4 codecs, you'll still have to compromise. And if you - at the same time - want to keep compression times low, you're in the nice three-way that goes like this:

Speed, quality, low file-size: Pick two.
 
As promised - I deliver you my tests and results:

Here's the link to 5sec HDV sequence considered as 'master':
http://www.prowokator.com/dehutiwebavi/compression_tests/test 5sec HDV.mov

As you'll soon discover it's a piece of footage which not very easy for any mpeg-4 encoder, as there's almost no static fields of image; so it's ideal for tests. Now when you play that sequence it looks good. You can discover mpeg2 artifacts but they appear due to bandwidth limit od HDV. The idea is to convert this footage to the 5mbps H264 file without loosing much of the quality. It's all in line with thr use scenario from http://www.apple.com/quicktime/technologies/h264/
...which says:

Use Scenario Resolution & Frame Rate Example Data Rates

High Definition 1280x720, 24p 5-6 Mbps
Full High Definition 1920x1080, 24p 7-8 Mbps

So i took my 1080i HDV clip, I down converted it to 720p by performing adaptive deinterlace at the same time and as a result I got 720p uncompressed sequence, which in the next step - I tried to compress using H264 and x264 as you suggested.

Results:
QuickTime H264 compressor:
Video: http://www.prowokator.com/dehutiwebavi/compression_tests/h264 720p 9kbps.mov.video.mp4
PNG screenshot: http://www.prowokator.com/dehutiwebavi/compression_tests/h264 720p 9kbps.mov.video.png

ffmpeg x264 compressor:

Video: http://www.prowokator.com/dehutiweb...720pbrightness7contrast3 VBR15k.mov.video.mp4
PNG screenshot: http://www.prowokator.com/dehutiweb...720pbrightness7contrast3 VBR15k.mov.video.png

After those tests I realized, that:
- the quality of h264 compressed footage at the end is far worse than my HDv footage
- I'm nowhere near to the 5-6Mbps provided by specification, 9Mbps is almost acceptable, 13Mbps gives proper result .
- 1st conversion (with deinterlace) HDV->Uncompressed can be replaced with HDV->Pixlet(Best Quality) without noticeable difference at the end.
- x264 from ffmpeg has problems with brightness/contrast balance - it downgrades those parameters during the compression, therefore input material has to be adjusted by QuickTime filters using the key: brightness +7 contrast +3
- Be sure to check the PNG still images - they show how HDV-mpeg2 artifacts get's magnified during the compression to h264 in the dark areas of the picture.
- x264 is much muuuuch faster than QT h264. And yes - deinterlacing is most processor-intensive operation.

So perhaps what I try to do is impossible at the end, and you're not allowed to get low-data rates H264 by providing such poor quality input video HDV offers...
 
Since there is no answer let me answer myslef as I found a solution for the problem (maybe someone else will be struggling with it). Use MPEG streamclip 1.7 or newer. It's universal binary (means: fast encoding), has h264 capability with good ammount of option. If you convert directly from HDV to H264 you'll be missing adaptive deinterlacing only. Now to the point. Settings:

720p from HDV should be created with those settings:
- Compressor H.264 Encoder
- max quality, 2 pass encoding
- datarate limit 5868 kbps
- 1280x720 frame size
- "better" downscalling, deinterlace
- Use B-Frames

The results meet my mentioned "quality" criteria, and what's more - on 2GHz MacBook Pro encoding time for 1 minute of material is about 1:20 (it takes 20 min to encode 1 min HDV to H264). For me that's fine. Non of my previous tests (performed by ffmpeg or Apple Compressor) were able to shring HDV test movie to smaller file size with such quality I get from MPEG streamclip.
 
Back
Top