Anamorphic question

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
tropic10
Posts: 24
Joined: Sat Nov 29, 2008 12:35 am

Anamorphic question

Post by tropic10 »

This may be a stupid question and I'll apologize in advance if it is. I have read the anamorphic section of the wiki and I searched through previous posts.

For 4:3 and hard letterboxed DVD's, is there any harm in encoding with the anamorphic setting on? Or is it better to turn it off and set the horizontal output resolution to 720 so it matches the source (with keep aspect ratio on)? I'll be viewing the content through XBMC with software upscaling on a 1080p television. Thanks.

sdm
Bright Spark User
Posts: 194
Joined: Mon Feb 19, 2007 4:53 pm

Re: Anamorphic question

Post by sdm »

If you turn anamorphic off, your width will be scaled to 640 (-crop). Handbrake won't let you put it back to 720. Why? I suppose because to keep correct aspect the height would need to be artificially up-scaled to match, and thats not cool in the Handbrake philosophy.
So, personally, I'd leave anamorphic on to not lose any information. XBMC doesn't have a problem with this.

--sdm.

TedJ
Veteran User
Posts: 5388
Joined: Wed Feb 20, 2008 11:25 pm

Re: Anamorphic question

Post by TedJ »

With the current release and an NTSC source, Handbrake actually does the opposite. Anamorphic on will scale 4:3 material to 640x, so for 4:3 letterboxed material I'd switch anamorphic off.

cvk_b
Veteran User
Posts: 527
Joined: Sun Mar 18, 2007 2:11 am

Re: Anamorphic question

Post by cvk_b »

Darn. I was kinda hoping to find a condensed question that expanded to a full size question. :mrgreen:

sdm
Bright Spark User
Posts: 194
Joined: Mon Feb 19, 2007 4:53 pm

Re: Anamorphic question

Post by sdm »

TedJ wrote:With the current release and an NTSC source, Handbrake actually does the opposite. Anamorphic on will scale 4:3 material to 640x, so for 4:3 letterboxed material I'd switch anamorphic off.
well with anamorphic on, 4:3 ntsc content with storage size 720x480 will be displayed at 640x480 (and for OP, xbmc will scale to 1440x1080).
with anamorphic off, 4:3 ntsc content will be actually scaled from 720x480 to 640x480 (and for OP, xbmc will scale to 1440x1080)

so you are left with 720 -> 1440, or 720 -> 640 -> 1440.
I stand by my original comment. Leave anamorphic on so you are not losing information .

what do you think TedJ

--sdm.

TedJ
Veteran User
Posts: 5388
Joined: Wed Feb 20, 2008 11:25 pm

Re: Anamorphic question

Post by TedJ »

Ah, I hadn't taken upscaling into consideration... I stand corrected. :oops:

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

Re: Anamorphic question

Post by rhester »

And hopefully jbrjake will someday accept my word that most players react to a PASP < 1 by scaling up vertically rather than scaling down horizontally. Maybe. :)

Rodney

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

Re: Anamorphic question

Post by jbrjake »

It's been on my todo list for ages, and I tried to check it in literally just this afternoon, but Ritsuka wouldn't let me:
IRC wrote:[18:09] *** jbrjake is thinking about checking some stuff in.... --stop-at frame, the libhb part of the no-drc patch, height-stretched 4x3 anamorphic for mp4, and the change for cadence flags in decmpeg2.c so they don't get thrown off by multiple instances from live preview.

[19:52] [ritsuka] yay for more possible screwed up subitlte tracks for 4:3 anamorphic files :P

[19:53] [jbrjake] ?

[19:56] [ritsuka] QuickTime with the clean aperture mode would still resize to 640x480&

[19:58] [jbrjake] so you're saying you don't want me to make that change? it's cool with me, i never watch videos in actual size windows anyway.

[20:00] [ritsuka] well it may add a possible weird effect if you add subtitles to 4:3 movies, IMHO it's better to leave things as they are now

[20:25] [jbrjake] okay, that's what i'll tell rhester the next time he complains ;p
Here's a patch:

Code: Select all

Index: libhb/muxmp4.c
===================================================================
--- libhb/muxmp4.c	(revision 2097)
+++ libhb/muxmp4.c	(working copy)
@@ -194,7 +194,14 @@
 
         MP4AddPixelAspectRatio(m->file, mux_data->track, (uint32_t)width, (uint32_t)height);
 
-        MP4SetTrackFloatProperty(m->file, mux_data->track, "tkhd.width", job->width * (width / height));
+        if( ( width / height ) < 1 )
+        {
+            MP4SetTrackFloatProperty( m->file, mux_data->track, "tkhd.height", job->height / width * height );
+        }
+        else
+        {
+            MP4SetTrackFloatProperty (m->file, mux_data->track, "tkhd.width", job->width * ( width / height ) );
+        }
     }
 
 	/* add the audio tracks */
Index: libhb/work.c
===================================================================
--- libhb/work.c	(revision 2097)
+++ libhb/work.c	(working copy)
@@ -209,8 +209,17 @@
                     title->width, title->height, job->width, job->height,
                     job->crop[0], job->crop[1], job->crop[2], job->crop[3] );
         hb_log( "     + pixel aspect ratio: %i / %i", job->anamorphic.par_width, job->anamorphic.par_height );
-        hb_log( "     + display dimensions: %.0f * %i",
-            (float)( job->width * job->anamorphic.par_width / job->anamorphic.par_height ), job->height );
+        
+        if( ( job->anamorphic.par_width / job->anamorphic.par_height < 1 ) )
+        {
+            hb_log( "     + display dimensions: %i * %.2f",
+                job->width, (float)job->height / (float)job->anamorphic.par_width * (float)job->anamorphic.par_height );
+        }
+        else
+        {
+            hb_log( "     + display dimensions: %.2f * %i",
+                (float)( job->width * job->anamorphic.par_width / job->anamorphic.par_height ), job->height );
+        }
     }
     else
     {

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

Re: Anamorphic question

Post by rhester »

Hrm...I hadn't considered that. I guess it's all a question of whether QuickTime scales before or after adding subtitles (I'd surely think before, otherwise the subtitles would distort...but again, only on a vertical resize).

OK...I just checked. ritsuka is mistaken. 720x480 NTSC D1 4:3 source, loose anamorphic, in QuickTime 7.5.5:

Format: H.264, 720 x 540, Millions
Normal Size: 720 x 540 pixels
Current Size: 720 x 540 pixels

Now will it screw up subs? Good question. But as long as you indicate the ratio as 0.75 in PASP and set the visual height (trak.tkhd.height) to 540, you're set on Apple gear.

Rodney

User avatar
Ritsuka
HandBrake Team
Posts: 1111
Joined: Fri Jan 12, 2007 11:29 am

Re: Anamorphic question

Post by Ritsuka »

Enable the clean aperture mode in the property window and see what happens ;)

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

Re: Anamorphic question

Post by rhester »

The exact thing that happens when you strip the PASP atom.

Why?

http://www.interactivetvweb.org/tutoria ... _ui_design

Clean Aperture, in Apple parlance, is hardcoded to a 640x480 bounding box for NTSC content.

QuickTime is behaving as documented, and PASP is being honored properly (or, in this case, outright ignored ;).

I still fail to see the conflict when QuickTime does scale *up* as expected with a 3:4 PASP in Classic mode.

Rodney

User avatar
Ritsuka
HandBrake Team
Posts: 1111
Joined: Fri Jan 12, 2007 11:29 am

Re: Anamorphic question

Post by Ritsuka »

The problem is that a subtitle track has a fixed size, so if you add one and them quicktime scales the movies differently, you'll have a subtitle track truncated or too small.
And no, clean aperture in quicktime is not hardcoded to anything, it just doesn't change the height, only the width.

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

Re: Anamorphic question

Post by rhester »

If the comment about clean aperture is true, then PAL 4:3 strict anamorphic content should require different scaling rules. I will test and see.

Rodney

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

Re: Anamorphic question

Post by rhester »

PAL D1 4:3

Source: 720x576 (actual pixels)

QT Classic: 768x576 (PASP applied)
QT Clean: 768x576 (PASP applied)

Was this as expected? If so, why is clean altering the visual size of PASP < 1 but not PASP >= 1?

Rodney

Post Reply