Encoding 4:3 to 16:9 (PAL)

Started by Chuffy, February 02, 2014, 11:03:29 AM

Previous topic - Next topic

Chuffy

I am in the process of ripping my DVD collection to MP4 for viewing on my HD TV.
I have  a question though when it comes to videos in 4:3 format. When using the Mplayer Resize filter, if I set ' Aspect Ratio Source' to 4:3 (Destination 1:1) the resulting file usually ends up as a square box in the middle of the screen, as you'd expect.
However, if I set the  'Aspect Ratio Source' to 16:9 (even though it isn't) the resulting file displays full screen on the TV. I just want to check that it is ok to do this or am I doing something horribly wrong?

Just as a footnote, I leave 'Output 1' set to 1:1 as I don't really understand what that setting does if I changed it to something else.

bernd_b

Why don't  you set the aspect ratio to the one you source file has, e.g. if it is 4:3 then 4:3 and so on?

If you want to convert 4:3 to 16:9, you would have to add black borders to the left and right. But every video-playing device would do this automatically, so encoding black borders into the video file doesn't seem of value to me. Alternatively you could cut out content at the top and the bottom, but as said, you would loose part of the picture. Again, most devices have a zoom function which would do the same while playback (I never do this because a want the movie to be played as intended).

AQUAR

@ Chuffy
When you set the aspect to 16:9 does the full screen still have the correct aspect and all of the frame?
Eg do people look like they have flat heads?

Sometimes DVD's are anamorphic and store 16:9 content as squashed 4:3 content.
Most playback devices know how to deal with that and process accordingly, but when recoding/ripping you may need to cater for this.

Best is to recode so as to maintain the same display aspect ratio.
Can do that by adjusting the pixel aspect ratio - relying on the media player to scale (resampling). OR
Resample yourself with the resize filter (might give better results).

If source pixel aspect ratio is 1:1, it will nicely match the HDTV pixel aspect ratio of 1:1, and things are uncomplicated.

Chuffy

Thanks for the replies.
When I encode at 16:9 the picture does maybe make people look a little shorter and slightly wider, but you get used to it.  ;D
All the picture is there and fills the screen. I am using a WDTV Live media player BTW.

I just wondered if what I was doing is it is was a definite no no because if I watch the equivalent on Netflix ( we are talking older UK tv shows mainly) they have it encoded so you get the square picture in the middle of the screen and I thought if it resizing could be done, they would do it.


AQUAR

#4
For those types of 4:3 movies, its more at matter of preference between stretch (not zoom) for full screen or proper display aspect.

Sometimes you get dvd's where frames have a display aspect of 4:3, but the movie has black bars on top and bottom.
These are non anarmorphic widescreen coded movies and have very poor screen utilisation on a widescreen TV.
That doesn't look pretty.

The easiest approach would be to follow the advise given by bernd_b.
Namely, recode with the same display aspect ratio.
Then use the zoom feature of the media player for movies that have these black bars.

If your media player zooms badly (WD probably is fine) you might get beter results by cropping the black bars and resize to 720P specs.
That's the fun with avidemux.


Chuffy

#5
Right I've nearly cracked it.
I have tried two methods to get the result I want. Both mean setting the DAR manually in MPlayer Resize filter rather than locking it as I have been doing.

1. Setting the DAR @ 720 x 576 with an output PAR of 16:9 seems to give me a 4.3 display in Media Player on the PC but displays full screen on my HD TV. So behaving like the DVD player.  :)

2. Setting the DAR @ 1024 x 576 with an output PAR of 1:1 gives me widescreen on the PC and full screen on the HDTV.

Both good but which one is THE way to do it and will give the best quality result, 1. seems to make more sense?

I have also discovered that if I encode a 4.3 ratio video and keep the Output PAR at 4.3, when I watch on the HDTV if I change the display output setting of the WDTV Live to Normal from Widescreen I get full screen display. So I assume that is the way to go with 4.3 DVDs?

AQUAR

#6
@ Chuffy
I think you are confusing Display Aspect Ratio (DAR) with Stored Aspect Ratio (SAR).
SAR is horizontal pixel count : vertical pixel count.
The Pixel Aspect Ratio (PAR) specifies the geometry of these pixels.
And DAR = SAR times PAR.

Viewing area on your video screen is determined by your media player from:
Any 2 of these video aspect ratio parameters (and it calculates the other).
Informing the media player what type of screen is connected.
Plus manual scaling functions on the media player that you invoke during playback (stretch to, zoom in, pan and scan etc) .

If one of the two video aspect ratios is incorrectly specified then the picture will also have an incorrect aspect ratio.
If the manual scaling function on your media player isn't locked to maintain DAR, then the picture aspect will be distorted (or corrected for some distortion!).
Meaning circles will look like egss, and if they started off looking like egss they may become circles.

If the source video has SAR=DAR then stick with that PAR for any resizing.
If not then play with PAR for a proper DAR.

Neither of you're two methods follow a logical path that flows on from knowing your video,
other than comparing the end results for like/dislike.
Doing that is fine but which one end result makes more sense to us is a???

Still suggest you follow the advise given by bernd_b.

Chuffy

yes, bernd was right, my problem was not understanding it at the time.
Where I was going wrong was trying to get the WDTV media player to do something it can't, basically resize 4.3 to full screen display on a widescreen TV, well it can but you have to change the output manually. I was also using Media Player resize in an incorrect way, for what I was trying to achieve anyway.

My next and biggest mistake was encoding everything to 1:1 pixel aspect ratio.

Something I read elsewhere finally made the penny drop. 

"All PAL videos are sized at 720x576 and it is then the pixel ratio that decides whether they have a 4.3 or 16.9 display aspect ratio".

So now, after cropping the edges to trim off any useless black edges, I resize what's left to 720x756 then output at either 16:15 for PAL 4.3 or 64:45 for PAL 16.9.

All working sweetly now, many thanks for all your help, till next time.....

AQUAR

#8
@ Chuffy
The penny has definitely dropped (almost to the ground!) and now you are in control.

One comment though is that digital monitors have square pixels.
So it is perfecly fine to recode with a resize (change SAR and even upsample SAR), with a PAR of 1:1, whilst maintaining the source DAR
(unless of course you want to deliberately change the 'aspect').
Putting it in another way - you don't have to stay bound to PAL-SAR unless you are creating another PAL video DVD.

Doing upsampling (upscaling!) so as to fit the native resolution of your HDTV (1920 x 1080 pixels) can eliminate a few upscaling/downscaling processes in the video transmission chain.  If the HDTV has a direct pixel mapping mode then you can kill another one of these scaling processes (underscan!).

The scaling engine of avidemux is not on the fly (real time processing) like it is for the media player and TV. Hence it has time available to deploy a more sophisticated scaling model than which you might get in the player/TV. Better scaling = better video. 

Food for thought! (not to mention the which and how to's of compression). 

All these tweaks can add up to greatly improve the viewing experience and is one reason why Avidemux is so popular.

Chuffy

#9
Just when I thought I had it............

So you are saying I am better off using Mplayer Resize to lock the aspect ratio from 4.3 (or 16.9) to 1.1 and then have the resulting video dimensions be whatever it comes up with? That's basically what I was doing before.

Having now compared the two results I have to say I prefer setting the output to the DVD's original PAR rather than 1:1. This way I get a proper full screen display with a 4.3 file (also the picture doesn't look odd) when the output of the WDTV live is set to 'Normal'. With a 1:1 file it just gets slightly wider, still with big black bars either side and looks stretched.


AQUAR

#10
@ Chuffy
You are so close the grasping the process.
When you do the manual scaling, the required video dimensions have to be calculated by you so as to maintain the DAR of the source.
Taking control in that manner lets you scale to suit the screen resolution of any display.

The lock the aspect ratio method and settings for source and destination will also make a basic adjustment to the SAR.
If you know what these setting are doing then of course you can take advantage.
In a nutshell, they are for adjusting the SAR based on the PAR of the source and the required PAR of the destination.
But note that the PAR of the source is just 'meta data', meaning the video pixel data doesn't have any pixel geometry.

So if you know the propeties of your source then:
Yes. Of course it may possibly be set up so that your DVD source gets a basic rescale to suit the PAR 1:1 of your HDTV.

ELSE
No. You can't just simply set source to x:x and destination to y:y to get a predictable DAR result.
In the beginning you were doing this, and now you can almost exit this category.
 
Back to your trials:

You cannot get a proper full widescreen display from a source that has a 4:3 DAR.
If you fill the screen with such a picture, your player is distorting that picture by stretching, or zooming in. 
And if it doesn't look stretched and all of it is there, then your source is not with a 4:3 DAR.
So a video with 4:3 DAR is going to have black bars either side in a widescreen TV.

Next the PAR of a DVD with a 4:3 DAR picture is nearly 1:1 (as you discovered).
With these DVD's, when using the 'locked ratio box', you set the source up to match its intended display type (4:3) analog TV.
and the destination for the PAR of the new display type (1:1) NOT (16:9). (gives part answer to your original question)
Setting it the other way around will give you a slight squeeze (as you discovered).
This will change the horizontal pixel count in the 'dimensions box' so that the display width stays the same (locked DAR!) for the now square pixels (1:1 PAR).

Next you need to know how the rest of the video procesing chain is setup so that you can tailor the SAR to suit that setup.
If you leave the SAR as is, the vertical pixel count stays at 576.
If your media player is set to output 720P (as an example) it has to resize 576 to 720.
And your monitor has 1080 so needs to resize 720 from the media player to its native 1080.
That's 2 on the fly scaling processes to mess up your video!
Now you could short cut the media player scaling by setting 576 to 720 in swsResize.
If you set your media player to output 1080P AND your HD TV to display with pixel mapping,  you can short cut both scaling processes.
Note, that as long as that 'lock ratio box' remains ticked, the horizontal pixel count (dimension) gets automatically adjusted to maintain that DAR.

Next you decide which gives a better viewing result. Scaling by, media player, or TV, or media player and TV, or swsRezise (with lanzcoz3, bicubic or bilinear algorithms).   

Next comes PAR meta data when you recode (another way to stuff up the result!).
Not to mention setting up swsResize for anamorphic DVD (leave that for others to explain!)
   
So the starting point is to know your source properties and your video processing chain before you tailor the scaling.
Then trial the combinations and select the best option(s).

As I said its a confusing topic, made harder by devices that change video properties on the way through.
Only other thing I can suggest is to chase more reading material and to keep experimenting to see how things interrelate.

Perhaps some of the process by example has been more telling than explaning away with too much technical mambo jumbo.

What we really need is an expert 'hero' member that can give a plain english explanation.
Would be appreciated by lots of members for sure. 

Chuffy

Wow Aquar, that is some post, thanks.  I am starting to get my head round this but think its still early days yet, lot more reading to be done yet I think. I now realise I was totally barking up the wrong tree trying to get 4.3 to display as 16.9. However, this has thrown up just as many questions about straight encoding!!

Just to throw a massive spanner in the works, while I was doing some research I tried doing some test encoding with Handbrake using the 'strict anamorphic' setting. This seemed to give the best results so far but I don't like the program as much as Avidemux, mainly the lack of audio delay compensation and the preview mode.

So, if someone could please explain what the equivalent strict anamorphic settings are using Resize in Avidemux to give the same result that might be enough, for now.

AQUAR

@ Chuffy
Thanks, it nice to get some appreciation for that epistle.
Do note though, I did leap frog lots of detail to keep it contained.
Hopefully it did give you a bit of focus in your approach to resizing video's.
 
The handbrake site has a good explanation of how anamorphic DVD works.
The secret is all in the meta data and video properties.

If the target is a digital display, you could be sneaky and approach the issue in a back to front way (I do!):
1) You know the destination display has a PAR of 1:1.
2) So if you set the "destination" to 1:1 then also SAR=DAR for the resampled video.
3) Hence the ratio of width : height in the "dimensions box" = SAR = DAR.
4) Since the usual aim is source DAR = destination DAR then
5) Select a source option in the "locked box" and see if you get the correct DAR.
6) If not try another source option in the "locked box".
7) Pick the one that best fits.
8 ) If all are way off, you have a special video and need to go manual.

For widescreen anamorphic DVD you end up with setting source to 16:9.
Widescreen anamorphic DVD come with different DARs (16:9, 2.35:1, 1.85:1).
DVD's with the other DARs willl give black bars top and bottom when scaled by the DVD player.
With locked ratio ticked and source set to 16:9 you will get the same result.   

Chuffy

#13
Yes I read the stuff on the Handbrake Wiki, it is quite a good explanation. If I tell you how I use the resize filter you can tell me if I'm on track.

With Avidemux and a 16.9 film I use the crop tool, then the MPlayer Resize filter with the following settings: lock box ticked, source 16.9, destination 1.1. Below that I tick the box saying multiples of 16.
Now at this point should I increase the width setting to 720 or even higher. Is it this setting that gives you the resulting SAR or DAR?

One of my tests yesterday comparing the results between Avidemux and Handbrake in the above scenario, I was getting odd results.

For example, the film Prometheus, the box says it is 16.9 Letterbox with 2.40:1 Ratio (I take it that's DAR?).
Right, when encoded with Avidemux using the above method, it came out as I'd expect and looked the same as the DVD playback, displayed on the TV with black bars top and bottom, as did the Handbrake version, both looked the same. However, just to really confuse me, when I played the two in Media Player Classic the Handbrake version was bigger!
The Avidemux version when I look in MediaInfo says it is 720x288 with a DAR of 2.500. The Handbrake clip says it is 718x424 with a DAR of 2.40:1, which matches what it says on the DVD box. BTW I made sure the crops were identical in both programs to get a proper comparison, the handbrake auto crop agreed with my manual one, 76 off top and bottom.

So, what are the two programs doing differently and which is right, I would assume Handbrake is right as it is giving me an output that matches the DVD, I'm probably wrong though and how do I get Avidemux to match that result?

AQUAR

#14
@ Chuffy

Without going into detail:
Letterbox DVD is 4:3 video, whose frame has a picture in it with 16:9 aspect and some black pixels above and below as filler.
Its not anamorphic, its not a full frame 4:3 video and the DAR of the frame is not equal to the aspect of the picture in it.

With those types of DVD you are on the right track (almost - think source setting = intended display type = not 16:9).
Response to meta data might explain the difference in playback as will the source setting.

Avidemux recoded as you specified (PAR 1:1) - handbrake recoded as you specified (but not PAR 1:1!).
Both will be scaled by the media player to give the same result (if set up correctly and meta data is adhered to).

I'll let you discover the detail in the handbrake vs avidemux result.
eg the multiples of 16 setting (will give slightly different DAR result - really an .avi related item).

Obviously, with 16:9 letterbox DVD material - if swsResize is done correctly you get a 16:9 DAR full frame picture that fills the whole HDTV screen.
Its the equivalent of zooming in onto that 16:9 portion of the picture.
Note: if the aspect of that picture is wider screen (eg 1.85:1) then again you will still get some black bars top and bottom.