News:

--

Main Menu

Aspect Ratio changes with Copy option

Started by hansolocambo, July 18, 2021, 12:42:59 AM

Previous topic - Next topic

hansolocambo

I've been using Avidemux to make simple losless cuts (on keyframes) of videos for a while.
But I sometimes get ratio issues using the Copy option (lossless cut at keyframes).
For example: I load a video that has this ratio
720x480 (1.78:1)
And after a cut output as a "copy" I end up with that :
720x480 (1.5:1)
The result is a narrower image that plays with black bars (left/right) on both PotPlayer and VLC.

If I choose an x264/h264 codec rather than the "Copy" option, In the Output1 Tab I see an option "Pixel Aspect Ratio". But I can't write a dot or a coma there, so no way to write 1.78. And the pixel ratio option : "As input" is greyed out.
1.78:1 is a basic 16:9. But whatever the input is, I can't figure out why a very useful video option called "Copy" cannot actually replicate the input codec. I can't do such cuts with Pavtube because it's such a terrible never updated UI. But the fact is their "Copy" option (aka "Original") never, in years, gave me an output different from the input. The resulting videos have always been 100% of the time : the same codec, ratio, bitrate, etc. as the original.

Could someone please advise ?

Thanks

eumagga0x2a

#1
720x480 hints at the original source being an anamorphic NTSC-type MPEG-2 video. Whether you re-encode it or not, you need to specify the proper 16:9 display aspect ratio in the configuration of the muxer (MP4 or MKV). Few video players honor pixel aspect ratio info from codec rather from the container, but it still doesn't harm to select the predefined NTSC widescreen pixel aspect ratio of 32:27 in the "Output 1" tab of the x264 configuration dialog.

Please make sure that the source must be either progressive or, when interlaced, either deinterlaced or interlacing needs to be enabled in the "Frame" tab of the x264 configuration dialog.

alexstorm

#2
Hans,
720 / 480 = 1.5
This is the pixel size used for DVD content.  But that video is not using square pixels, so playing back at 720 x 480 direct to a computer will always be wrong.  Some people don't notice it, but it's still wrong.

DVD player software converts the video correctly to play on computer screens. In a rare situation, you might have a 720 x 480 .mp4 video file with a forced 16:9 playback aspect ratio.  This forced size change only for players like VLC.  Trying to play it back inside a browser, will not adjust the video size to the forced default setting inside the video file.

In AVIDemux there are a few forced aspect ratio options that work when making a h.264 video.  This option has a similar issue, you cannot put in a decimal.  The result is really only useful for a player like VLC which will read the forced Aspect ratio and play it back as a default.  When you are making video copies or a master for a project, normally the editor's choice is to create video with real pixel dimensions of what you want to see in your presentation.  So, using this force Aspect ratio trick is not that useful.  It doesn't work for playback in browsers, Websites, or direct play that I have tested.  It works pretty much just with VLC or similar players.

If you really want to use a forced Aspect Ratio for VLC playback, the option is available in Video / Configure  / Output 1 Tab, Pixel aspect Ratio, Custom.  You only have whole numbers and no decimal.  The number used here is actually the number that you multiple by the current Aspect Ratio to get the target Aspect Ratio.  Sort of tricky hmmm? And not well explained, I know. 

For example, moving a 720 x 480 (1.5) to a 1.777 ratio, you need to put in Custom numbers 845 and 713.  That is the first whole number ratio that work to a result accurate under .0001. 

Try it:  720/480 * 845/713
The more commonly used ratio is 32 and 27 which is near accurate and close enough.
720/480 * 32/27
You can even crank up the calculator to find perfection which oddly seems sort of an obivous simple answer...
720/480 * 17777/15000

I have a calculator, online, that does this math. It's labeled:
Pixel Aspect Ratio Calculator  ΜΆ  (This is for steps 7 and 8 only)
at the bottom of producerelease.com/blu-ray/parcalc.htm

You input any starting Video width and height without black bars, your target Aspect ratio and you get back the two whole numbers that will make that size conversion work.  It finds results that are Perfect within 0.001, Near within 0.004, Good within 0.007 and Okay within 0.01 matches.

You can skip this whole forced resize the video which doesn't work in many situations anyway and just really resize the video correctly.  You lose a generation, so the only solution done professionally in post production would be to take the uncompressed master and resize it.  The best uncompressed master possible from DVD or blu-ray would be no compression and full resolution copy or original MPEG or mkv with whatever compression it already has in it.

There are other calculators on my page that can help with removing the black bars and then resizing the remaining video back to it's correct Aspect Ratio (needed when you pull from a DVD source) and then make a quality video copy with the correct Aspect Ratio and no black bars.  If you do that with h.264 video and AAC audio, you will have a video that can playback correctly in a webpage or on a media server without needing extra reencoding or a special hardware video encoder.  h.264 is an older codec, but it's still the one that works with audio, everywhere online and in browsers.

There is a lot more info on the page link above.  This entire page is focused on AVIdemux Aspect Ratio issues. It has 3 calculators and a Aspect Ratio simulation that can pull any image or video online into the player and black bar it to any ratio. 

Hope that helps.

eric

I had the same problem with an MP4 with X264 video, 720 x 464 pixels, created from an anamorphic widescreen DVD.  The display aspect ratio (DAR) is 1.85 (meaning thin black bars top and bottom on a 16:9 display).  When I extracted a clip from it using Avidemus 2.7.8 in Copy mode, the clip when played in VLC has black bars on the sides.  MediaInfo shows that the clip's "Original DAR" is 1.85, but the current "DAR" is 16:10.  Elsewhere I learned that "Original DAR" is stored in the H.264 video, while current "DAR" is stored in the MP4 container.  I found that I could extract a clip without changing the DAR if under Output I clicked Configure [the MP4 Muxer], then checked "Force aspect ratio", then selected "Derived from display width", then entered 853 as the display width.  Selecting 16:9 did not work: it set the DAR to 16:9, which is close (1.78) but not the same as 1.85.  Not that 853 is approximately 480 * 16 / 9.  According to MediaInfo, the resulting clip has a DAR of 1.85.  It would be easier and more intuitive if you could enter the DAR directly.  Even better to have an option to force the DAR to equal the "Original DAR".

alexstorm

Eric,

Your comment is hard to follow, but I am sure my comments are as well.  It sounds like you are not cropping out the black bars before you make any changes.  There are two reason you see black bars, either the player window is larger than the video or there are actual black bars in the video.  If you are seeing black border all around then you are dealing with both types at once.  The correct way to fix the aspect ratio and make it work for all players is to first crop out the black bars with the crop filter, then adjust the video back to it's correct aspect ratio and use the swsResize filter with h.264 codec.  Uncheck the Lock Aspect ratio and adjust the height to get back to the 1.85 original aspect ratio.  I like using the Lanczos-3 Resize Method.  It seems a little more detailed and not as soft as the default Bicubic.

This requires a complete re-rendoring of the video, but you have to do that anyway with a crop.  If you only ever want to playback the video with a software player and not on a webpage, then you could use the force aspect ratio that takes the forced aspect ratio.  These videos will not play back correctly online and I doubt they will keep the forced ratio after an upload to youtube or similar.  I never use the forced aspect ratio becuase of this problem.

Hope that helps.