0.8.5b1 QuickTime anamorphic at 640 width?

HandBrake for Mac support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
drebes
Posts: 29
Joined: Sun Apr 22, 2007 2:58 pm

0.8.5b1 QuickTime anamorphic at 640 width?

Post by drebes »

Hello,

Not sure if this is a bug or not.

I've tried to rip a chapter of a DVD for testing with HandBrake 0.8.5b1 using the new QuickTime anamorphic support, but instead of choosing the standard 720 width resolution I tried to chose 640 (so that I could play this file in iPod even if it doesn't respect the anamorphic set).

But although it shows 720x358 -> 640x358 -> 848x358 in the HandBrake window, the file always opens at 640x358 in QuickTime. If I change the output witdh to 720, it works (it opens with 848 width).

Is it like it's supposed to be? Or should this setting be available?

Thanks in advance, and congrats on the great work.
deckeda
Enlightened
Posts: 138
Joined: Thu Feb 22, 2007 8:38 am

Post by deckeda »

If you want the same file to play on both iPod and in Quicktime, do not choose anamorphic.

The fact that you can't play an anamorphic file for both isn't a bug in Handbrake, but rather a limitation of the iPod.

Furthermore, when Anamorphic is checked, the height and width fields aren't editable. And that's also not a bug.
drebes
Posts: 29
Joined: Sun Apr 22, 2007 2:58 pm

Post by drebes »

And what if I want to create a 640 width anamorphic file for QuickTime? Is it possible?
nightstrm
Veteran User
Posts: 1887
Joined: Fri Mar 23, 2007 5:43 am

Post by nightstrm »

No, that goes against what the anamorphic setting in HB does.
loyalty_anchored
Bright Spark User
Posts: 183
Joined: Wed Mar 14, 2007 1:49 pm

Post by loyalty_anchored »

drebes wrote:And what if I want to create a 640 width anamorphic file for QuickTime? Is it possible?
no, it is not possible, i would recommend you take a look at this awesome explanation of anamorphic encoding, i am sure once you read it, you will know exactly why your request is not possible.

http://handbrake.m0k.org/trac/wiki/AnamorphicGuide
drebes
Posts: 29
Joined: Sun Apr 22, 2007 2:58 pm

Post by drebes »

I'm pretty sure what anamorphic encoding is, from much before than Handbrake even existed, and it just means preserving number of lines (vertical resolution) while stretching horizontal resolution (from 720 to "848" in the case of a NTSC DVD source, but why not from 640 to 848 if your source is originally 640x480 (VGA)?)

I'm still convinced that a source can have it's horizontal resolution reduced from 720 to 640 while the number of lines is kept the same, NTSC has non-square pixels (720/480 != 4/3) and computers use square pixels, anyway.

But I also understand that the Handbrake developers don't see it that way, and so this is a feature that is not considered. This doesn't make me like Handbrake any bit less, I still think it's an awesome software.

Thanks,
drebes
Posts: 29
Joined: Sun Apr 22, 2007 2:58 pm

Some more information

Post by drebes »

I understand "I'm not supposed to watch an anamorphic video on the iPod.", but suppose the following situation:

I watch movies from the iPod on a widescreen television, using a s-video cable. If the movie is "full screen" (4:3 aspect ratio), it will show up distorted (stretched) on the TV if the TV is configured for a widescreen source, or with black bars on both sides, otherwise, as expected.

Now, suppose I watch a widescreen movie from the iPod on the widescreen TV, using the same setup. It will either show the movie letterboxed, and with bars on both sides (if I set the TV for a 4:3 source), or it will stretch horizontally the already widescreen movie without touching the vertical resolution, ie, still with top and bottom bars, since it doesn't know that the input is already letterboxed. I can set the TV to remove the bottom and top of the picture (most of the black bars) with a special setup, but then it stretches the pictures vertically.

If I could leave my movies on the iPod in an anamorphic format (disregarding the resolution which is set in the container, which I suppose the iPod does, that is, considering the video with something like 640x358), it would then show perfectly on the TV, when set to a widescreen source. It would then just stretch the 640 pixels to the full width of the TV, as it does with the 720 pixels of a DVD, and show every original line from the DVD source.

Actually, this would be the same as just disabling the keep AR setting and reducing the width to 640, but storing in the container file the "848" width for when displaying the movie in iTunes/QuickTime. If this was possible, what would happen with the iPod? Would it refuse to play the file entirely or just ignore the container set width?
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Post by rhester »

That actually isn't what anamorphic means at all. Please don't try to redefine an industry-standard term to meet your desires. HandBrake is doing the right thing.

Reference: http://en.wikipedia.org/wiki/Anamorphic

Rodney
drebes
Posts: 29
Joined: Sun Apr 22, 2007 2:58 pm

Post by drebes »

Ok, I understand Anamorphic Widescreen as:

http://en.wikipedia.org/wiki/Anamorphic_widescreen
Anamorphic widescreen is a video encoding technique used to optimize the vertical picture resolution of widescreen images by squeezing these horizontally into a 4:3 native aspect ratio.
If you consider it this way, you should note that 720x480 is not a 4:3 AR while 640x480 is, when dealing with square pixels. Every reference about anamorphic is about vertical resolution. It means storing an image without the letterboxing, taking advantage of the whole vertical resolution while distorting the AR, and then having the appropriate flags to signal the decoder to correct the AR. That's how I always saw, and what the Wikipedia article also claims.

Then, again, if you consider the Handbrake Anamorphic guide, you will have:
When you play the DVD on a wide 16:9 television, it keeps the height and stretches the width (853*480). This is what it means when a DVD box proclaims "Enhanced for widescreen." When you play the DVD on a standard 4:3 television, it reduces the width to 640 (the maximum width for a standard TV) and squishes the height to 360 to match the aspect ratio.
If it is reduced to 640 in a standard TV, why can't I encode it at 640 width? Actually, it is not reduced at all, a TV displays the whole 720 pixels, because it does not use square pixels.

But it's OK, I won't bother anymore about it. Sorry. :)
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Post by rhester »

The Wikipedia article you reference is being necessarily obtuse because the 35mm film format it was pioneered on was 4:3. The same thing is being done on DVD (using 'distorted' video to fill the full frame), despite "native" DVD resolution not being 4:3 (because televisions don't use square pixels).

A standard-def TV (the only target of DVD until amamorphic widescreen) can only do 480i. This does mean you are resizing horizontally from 720 (or more likely 704) -> 640, but given the source, it seems preferable to your seeming suggestion of 'anamorphic tallscreen' where 720x480 becomes 720x540. Moreover, I'm not aware of a single device, consumer or otherwise, that gives consideration to vertical anamorphism.

All this having been said - if you want to invent it, go right ahead. Please submit your patch to handbrake-dev@m0k.org and it will be given strong consideration and careful review. Please note it should be supported by both CLI and GUI, though the GUI change isn't necessary as long as you clearly document the necessary core changes.

Rodney
drebes
Posts: 29
Joined: Sun Apr 22, 2007 2:58 pm

Post by drebes »

I think Handbrake is failing to consider that there are square and non-square pixels. If it did so, perhaps it would use 868 as the width in the container format for anamorphic movies, depending if it is considering square or non-square pixels.

I'm traveling tomorrow and will be back just in 10 days, but then I will try to submit a patch. If not to be accepted in Handbrake, at least to have the feature for me. ;)

Regards,
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Post by rhester »

If you want to take non-square pixels into account, it's pretty simple - just modify the PAR in the container. The problem is, most devices ignore the PAR.

I got to thinking about this more - perhaps I misunderstood. Originally I thought you were looking for anamorphic support to expand a 4:3 DVD, which was the context in which I originally wrote - but having re-read your original post, I think what you're really after is using anamorphic (in reality, SAR) to squeeze the 720x480 image down to 640x480 (for 4:3 display). The question is - why? The only possible reason I could think of for doing this is if you believe the real-time hardware scaler in the playback device to be superior to the software scaler in HandBrake (which is a 3-tap Lanczos, IIRC). I would consider that highly suspect.

Remember, the whole point of anamorphic is to minimize data loss. Since the 4:3 data will be "shrunk" one way or another, either by the encoder or by the player, the data is "lost" in the case of 4:3 content regardless...it's just a question of which device is discarding the content.

Am I misunderstanding?

Rodney
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Post by rhester »

drebes wrote:I'm traveling tomorrow and will be back just in 10 days, but then I will try to submit a patch. If not to be accepted in Handbrake, at least to have the feature for me. ;)
You'd be amazed how many of our developers started out looking to add just one small feature for themselves...and continue to work magic today. =) We look forward to your assistance!

Rodney
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

drebes wrote:I think Handbrake is failing to consider that there are square and non-square pixels. If it did so, perhaps it would use 868 as the width in the container format for anamorphic movies, depending if it is considering square or non-square pixels.
Per that link:
The DOWNSIDE to both Method A & B. Images created using the two above methods will be geometrically incorrect when viewed in FCP on your computer display, particularly if it’s an LCD display being driven with its digital input (DVI or ADC).
and
That’s why deciding which numbers to use, Apple’s or SMPTE’s, is at some level arbitrary. Especially when you consider that moving just a couple of inches off-axis from your NTSC monitor will introduce more distortion into the image than the difference between the SMPTE and Apple pixel aspect ratios.

So use whichever numbers and methods are easiest and quickest for you, and go spend the extra time you saved not wringing your hands over this with friends and family.
Those, to me, both seem like very good arguments to *not* use SMPTE if, as with HandBrake, the main goal is to display on computers or computer-like devices driving digital output to, mostly, LCD screens (be it the iPod, a computer, or an LCD HDTV).

Of course, options are good. Having a preference to choose which to use would be nice. But IMO the way HandBrake does it now makes perfect sense.
drebes
Posts: 29
Joined: Sun Apr 22, 2007 2:58 pm

Post by drebes »

If I could leave my movies on the iPod in an anamorphic format (disregarding the resolution which is set in the container, which I suppose the iPod does, that is, considering the video with something like 640x358), it would then show perfectly on the TV, when set to a widescreen source. It would then just stretch the 640 pixels to the full width of the TV, as it does with the 720 pixels of a DVD, and show every original line from the DVD source.

Actually, this would be the same as just disabling the keep AR setting and reducing the width to 640, but storing in the container file the "848" width for when displaying the movie in iTunes/QuickTime. If this was possible, what would happen with the iPod? Would it refuse to play the file entirely or just ignore the container set width?
I just tried that using a QuickTime (.mov) container and it works! I encoded a single chapter of my movie without preserving the AR, resizing only the width from 720 to 640, at 640x396 (480 excluding the letterboxing). I then opened it up in QuickTime Pro, went to the Properties window and changed the scaled size for the video track from 640x396 to 848x396, and saved the resulting movie in a QuickTime container.

Imported it in iTunes. It show with the right AR on the computer. Synched it to the iPod. Of course, it shows stretched vertically in the iPod screen (it ignores the container scaling), but shows perfectly on a widescreen TV (set to a 16:9 input), which stretches the picture horizontally, restoring the correct AR.

Gotta go now, will try to make a patch for Handbrake when I'm back.

ps: I agree on the SMPTE issue.

Regards,
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Post by rhester »

I just went back and re-read this entire thread only to realize I missed the obvious.

You want this purely to make it play back on the iPod in distorted form? Why on earth would you want such a thing?

Regardless - if it's something you want/need, by all means hack the source, but I wouldn't expect to see this make it into a GA release on purely esoteric grounds.

Rodney
drebes
Posts: 29
Joined: Sun Apr 22, 2007 2:58 pm

Post by drebes »

I'm back from my trip.

No, playing it distorted in the iPod is not my goal.

All I want is a movie that is limited to an effective 640x480 resolution (VGA being a common limit for video resolution) and which the container contains the stretched horizontal resolution to adjust from the anamorphic to a correct aspect ratio (848x480, 16:9).


The fact that the iPod displays it incorrectly on its small LCD screen doesn't interest me, it is a result from the iPod ignoring the container resolution. I don't care about that, since I'm not displaying it in the iPod screen anyway. But I may be interested in using the iPod TV output ocasionally.

Will work on it for myself, if anyone else is interested, feel free to contact me.

Regards,
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

VGA to 16x9? I'm dubious.

I think the problem is that when you display on a TV, and try to stretch to widescreen on the TV, the TV expects anamorphic content stored at the same aspect ratio as on a DVD.

That is to say, it applies a 32/27 par distortion so content stored at 1.5:1 is displayed at 1.78:1.

I do not think that stretching will work correctly with 1.33:1 content, only 1.5:1. And you can't easily put 720*480 h.264 on an iPod.
drebes
Posts: 29
Joined: Sun Apr 22, 2007 2:58 pm

It does work

Post by drebes »

I've modified Handbrake to do as I wanted. It does work. To my surprise, the iPod even considers the display aspect ratio information from MPEG-4 files, so the videos are not distorted in the iPod screen, and the improved vertical resolution makes the videos look great on QuickTimes/iTunes.

More about it at the development forum:

http://handbrake.m0k.org/forum/viewtopic.php?t=2134
handbreakuser25
Posts: 9
Joined: Thu May 31, 2007 3:04 am

Result? Were you able to patch this?

Post by handbreakuser25 »

I am really looking forward to this because I posted something similar but you actually brought a solution. I was wondering if this was implied and also I want to say that if you did great. Also I just want to say that in the new visualhubs hi-fi it keep like the 640x480 limit but with like the second aspect ratio being 853x480 and when you activated the widescreen in the ipod you could watch the video widescreen keeping the correct Aspect Ratio. I was wondering if your patch work the same way.
handbreakuser25
Posts: 9
Joined: Thu May 31, 2007 3:04 am

Result? Were you able to patch this?

Post by handbreakuser25 »

I am really looking forward to this because I posted something similar but you actually brought a solution. I was wondering if this was implied and also I want to say that if you did great. Also I just want to say that in the new visualhubs hi-fi it keep like the 640x480 limit but with like the second aspect ratio being 853x480 and when you activated the widescreen in the ipod you could watch the video widescreen keeping the correct Aspect Ratio. I was wondering if your patch work the same way.
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Post by rhester »

Yes.

Rodney
Post Reply