Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Divisible by 16 - the magic number!

Hi all you experts,
We're working with some beautiful HD footage, and want our compressions, of course, to look as good as possible. Like everybody else!

To keep the aspect ratio correct (16:9) we open the movie in QT, hit "Command i" to see all the technical parameters and if we grab the QT movie by the lower right corner, we can resize it smaller and by looking at the "Command i" window - we see the exact length and height of the movie. Original movie is 1280x720.

Good! We like 800x450, or several sizes actually. My question is . . . we're read it's important to keep the length divisible by 16. (For some reason that's a magic number, 16!) How important is it to stick to this "divisible by 16" rule?

Could you actually see any difference in two compressions of slightly different dimensions, one exactly following this rule - the other "close" but not exactly divisible by 16?

Is it important to stick to this rule . . . OR ELSE User uploaded file (lousy quality! :)??

Thank you for your thoughts,
Larry

Macbook Pro 17, Mac OS X (10.5.5)

Posted on Nov 24, 2008 4:20 PM

Reply
Question marked as Top-ranking reply

Posted on Nov 24, 2008 8:36 PM

yes 16 is a good number for computers.
To really simplify, digital video is encoded using 16x16 macroblocks (mostly)
For lots of tech talk fun, google "16x16 Macroblock".
But look out, some begin like this, and then get complicated:

+The simplest and most thorough way to perform motion estimation is to evaluate every possible 16x16 region in the search area, and select the best match. Typically, a "sum of absolute differences" (SAD) or "sum of squared differences" (SSD) computation is used to determine how closely a candidate 16x16 region matches a macro block. The SAD or SSD is often computed for the luminance plane only, but can also include the chrominance planes. But this approach can be overly demanding on processors: exhaustively searching an area of 48x24 pixels requires over 8 billion arithmetic operations per second at QVGA (640x480) video resolution and a frame rate of 30 frames per second.+
7 replies
Sort By: 
Question marked as Top-ranking reply

Nov 24, 2008 8:36 PM in response to Larry Cohen1

yes 16 is a good number for computers.
To really simplify, digital video is encoded using 16x16 macroblocks (mostly)
For lots of tech talk fun, google "16x16 Macroblock".
But look out, some begin like this, and then get complicated:

+The simplest and most thorough way to perform motion estimation is to evaluate every possible 16x16 region in the search area, and select the best match. Typically, a "sum of absolute differences" (SAD) or "sum of squared differences" (SSD) computation is used to determine how closely a candidate 16x16 region matches a macro block. The SAD or SSD is often computed for the luminance plane only, but can also include the chrominance planes. But this approach can be overly demanding on processors: exhaustively searching an area of 48x24 pixels requires over 8 billion arithmetic operations per second at QVGA (640x480) video resolution and a frame rate of 30 frames per second.+
Reply

Nov 25, 2008 10:19 PM in response to Links

Hi Links,
Thank you for your response. FYI, I posted the same question on DVCreators. Josh gave an insightful answer.

"Theoretically, it's slightly better to have dimensions divisible by 16, but only because H.264 divides up a picture into 16x16 blocks and if you have a partial block it still has to expend time and bandwidth on it.

A size that is an exact multiple of 16 H & V will compress a tiny bit more efficiently, or look slightly better at the same bitrate.

Nothing to worry about really, I doubt if the human eye would notiuce the difference."
Reply

Nov 26, 2008 1:44 AM in response to Larry Cohen1

Be aware. If you choose a resolution which is not divisible by 16, 8 or 4, you might end up with a 1px green border at either bottom or right side of your frame. I have seen this problem with

"If the horizontal or vertical size is not divisible by 16, then the encoder pads the image with a suitable number of black "overhang" samples at the right edge or bottom edge. These samples are discarded upon decoding. For example when coding HDTV at 1920x1080, an encoder appends 8 rows of black pixels to ht eimage array, to make the row count 1088." -Charles Poynton ( http://tinyurl.com/5vby6x)

Maybe that green line I am talking about may show up if the player/codec have problems discarding those "overhang" samples on decoding?

If you really want the most efficient and best quality encoding, you should choose a frame size which is divisible by 16, or at least 8. Have a look here for more frame size suggestions: http://labs.influxis.com/?p=6 and http://labs.influxis.com/?p=30
Reply

Nov 26, 2008 5:12 AM in response to Thomas Berglund

Thomas, a wonderful reply. Thank you very much.

Just asking . . . (you seem to be VERY knowledgeable!) We're using the Panasonic HVX200 and shooting 1080x720 on P2 card. Quality is stunning - particularly when we overcrank to 60 fps!
(Here's a sample I'm sure you'll agree . . .
http://www.trivue.org/AllMovies/TimeRemap.html
When we compress using Compressor at a size of 800 x 450 (I know, we'll change that!) at 1200kbs / Keyframes set to "automatic" we get a pretty good product. It needs to be either a smaller frame or a little higher rate. No problem. But here's what's REALLY STUMPING US . . .

We use the same compression parameters using "Visual Hub" (I know, they're closing shop) - and the final movie is noticeable 'cleaner' in many high action areas!

But how can this be? How can Visual Hub do a BETTER job than Compressor???

We think Apple is the best - we almost worship the company - am I losin' it? How can VisualHub be 'better" ?? You ever run into that?

Thanks,
Larry
Reply

Nov 26, 2008 7:27 AM in response to Thomas Berglund

Interesting comment coming from "Josh" over at DVCreators.net - Thomas, would you agree??
Larry

From DVCREATORS site . . .
"Theoretically, it's slightly better to have dimensions divisible by 16, but only because H.264 divides up a picture into 16x16 blocks and if you have a partial block it still has to expend time and bandwidth on it.

A size that is an exact multiple of 16 H & V will compress a tiny bit more efficiently, or look slightly better at the same bitrate.

Nothing to worry about really, I doubt if the human eye would notice the difference."
Reply

Nov 26, 2008 6:12 PM in response to Larry Cohen1

Have you read this article before?
http://www.apple.com/quicktime/tutorials/h264.html

There are some guidelines there for frame sizes and bitrates, that you might want to have a look at. Keep in mind that the frame rate of your video also affects bitrate requirements. Robert Reinhardt (the guy I linked to in my last paragraph in my previous post) has made a great bitrate calculator for both Flash and AVC/H.264: http://www.adobe.com/devnet/flash/apps/flvbitratecalculator/ (remember to change the video codec setting to H.264, if that is your output format)

Have you tried activating frame controls in Compressor? That should give you better quality downscaling. If you would like to save some time, you could try this tip (same principle for downscaling): http://discussions.apple.com/message.jspa?messageID=7309534#7309534

Video compression, especially for web, is all about testing to find the optimal settings for best possible quality/filesize ratio. Remember that it will save you a lot of time doing some short 10-20 second tests (just set in/out points in the Compressor Preview window), before encoding everything.

Try changing your resoultion to either 1024x576 or 768x432 (or any other resolution divisible by 16, 8 or 4), activate frame controls, adjust the video bitrate according to frame size and frame rate, and see if the result looks better.

It might be that the version of of x264 that VisualHub uses, is a bit better than the H.264 codec Apple provides in QuickTime/Compressor (at the moment). I really do not know.

Have you tried DV Kitchen from DVcreators? That application have something they call SampleLab, which makes it very easy to test different video bitrates. You can also use x264: http://www.dvcreators.net/how-do-i-install-the-x264-codec-for-dv-kitchen/

I guess I would some what agree with Josh, that the human eye might not notice the difference. I would still recommend choosing a "safe" frame size though, just to make sure you do not get any strange artifacts (like green lines at the bottom or right side of your frame), and to make sure your video plays as smoothly as possible.
Reply

Dec 3, 2008 1:02 PM in response to Larry Cohen1

Also don't forget to deinterlace anything destined for the web.

When using VisualHub you must have already exported from FCP I assume? So thereby you have already gone through a compression unless you went out uncompressed?

As stated by others is really is a massive testing and tweaking world especially if you have action versus static content. The compression can also be modified by setting markers in the FCP timeline during certain action spots and so on.

I'm a big fan of VisualHub as well (now going opensource BTW) but usually if you are dealing with original source content if you can modify settings for compression there then you will have best results...it just take time, practive and a but of techno-magic.

Good Luck!
Reply

Divisible by 16 - the magic number!

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.