Incorrect size specified for 720x480 source

When Video AI’s source is 720x480 anamorphic (for example, DV), inspection of the ffmpeg command generated by Video AI reveals the following, which results in the wrong pixel dimensions for any upscaled video:

scale=w=854:h=480,setsar=1

However, the ffmpeg command should include this instead:

scale=w=720:h=480,setsar=1.1852

I hope that Video AI’s developers will fix this.

When bringing in this video source and choosing upscale are you seeing the option to use the Original Pixel type or Square Pixel type?

Can you send the logs showing this over to the support team to put in front of the devs?

help@topazlabs.com

To gather logs, please select Help > Logging > Get Logs for Support and attach the zip file to your reply.

I select the option for square pixel type, since all of the upscaled variants (HD, 4K, etc.) require square pixels. Consequently, the ffmpeg command ends up with “scale=w=854:h=480,setsar=1”, which is wrong, since the SAR of the source is 1.1852.

By the way, if you select the option for “Original Pixel Type”, then the output (HD, 4K or whatever) either gets cropped or letterboxed, depending on which of the latter two sub-options you choose. Moreover, the pixel dimensions are wrong too (for example, 1922x1080 for full HD instead of 1920x1080).

If instead the ffmpeg command is edited to include “scale=w=720:h=480,setsar=1.1852”, and then the ffmpeg command is run manually from a Terminal Window invoked from with the GUI, then the output (HD, 4K or whatever) is correct in all respects.

I’ll send the email, including the log zip file, that you suggest to help@topazlabs.com, although I don’t think that the logs will offer any additional information. I’d say that Video AI has been programmed by design to assign incorrect dimensions and an incorrect SAR to anamorphic 720x480.

Hi Kyle,

I see that this still hasn’t been fixed.

In brief, for an 720x480 anamorphic source, such as DV, “scale=w=853:h=480,setsar=1” needs to be changed to “scale=w=720:h=480,setsar=1.1852”

Can you please have the developers fix this?

Thanks.

Robert

I’ve already had both, 720x480 that must be displayed as 4:3 or 16:9, so upscale to a fixed ratio TVAI does, or when TVAI sets a DAR Value into the video container is a thing that does never fits for every sources.

I have already written and others too, TVAI should give us a “free scale” checkbox you can select, and then what you enter in pixel height and width gets done without letterbox, so depending on entered sizes video can be freely stretched or squeezed in width.

If there isn’t such a function, I’m sure there will always be posts about sizing/aspect ratio problem when their source gets scaled incorrectly in TVAI

There are also sources that have the wrong aspect ratio or there are cases where you cut off a few pixels on the left/right and you would like to have the image stretched a little in the width again, all this would be possible with a “free scale” function without letterbox.

Requesting new optional selectable “free scale” function, same as for example Virtualdub can do
FreeScale

1 Like

If you use the custom upscale setting and use prioritize height or width you can keep the original pixel aspect ratio of the source (or convert to square pixels) and upscale it without letterboxing.

Prioritizing height to 1080p results in a 1620x1080 file with the 1.1852 pixel aspect ratio if you keep “Original Pixel Type”, or a 1920x1080 file with square pixels.

Thanks for your reply, but your suggestion doesn’t work, as you can see in the attached screen shots, where 720x480 anamorphic gets upscaled to 1919x1080. The problem is that the source is not described correctly in the FFmpeg command, i.e. “scale=w=853:h=480,setsar=1” is incorrect. (It would have to be “scale=w=853.3333:h=480,setsar=1” in order to work, but fractional pixel dimensions aren’t allowed.) 720x480 anamorphic is in fact correctly described as “scale=w=720:h=480,setsar=1.1852”, which results in the correct pixel dimensions for all upscales, including 1280x720, 1920x1080, 3820x2160.

Upscale_Settings

SD_Anamophic_to_HD

1 Like

A “free scale” option would indeed be nice, but any source video must also be described correctly to begin with, regardless of how you’re going to transform it. The correct description of 720x480 anamorphic is “scale=w=720:h=480,setsar=1.1852”.

Your inspector screenshot shows the file is 1920x1080. The 1919x1080 resolution is the display resolution in the media player, not the file.

If you use MediaInfo or a similar metadata reader it will show the file is 1920x1080.

If you keep the original pixel aspect ratio instead, you’ll have a file that is 1620x1080 that displays at 16:9 aspect ratio.

As you point out, “1920x1080” comes from the metadata. They’re the nominal dimensions provided by Video AI’s settings, which is why they’re shown in the Inspector. The display resolution is 1919x1080 because that’s the actual size of an image frame, given the source description of 853x480, which is incorrect. Video AI applies a ~constant~ scale factor of 2.25 for the upscale; therefore, 480 is mapped to 1080 and 853 is mapped to 1919 (rounded to the nearest integer). The point is too wind up with correct square-pixel upscales.

The actual file contents are stored at 1920x1080.

1919x1080 comes from the rounding error in the display aspect ratio.

You can remux (rewrap) the file (no reencoding), and force the display aspect ratio to exactly 16:9. The file will be both stored at 1920x1080 and displayed at exactly 1920x1080. I recommend Shutter Encoder.

“1919x1080 comes from the rounding error”

Exactly: 853/480 equals 1.7771, which is smaller than 16/9. And you can fix this by correctly describing the source. Then the frame size and the display size wind up 1920x1080. No need for any post-processing to correct the display size.

By the way, If you export to an image sequence, you see that the frames really are 1919x1080.

They would be, because they have to include the rounding error in the display aspect ratio.

Can you post a full ffmpeg command that corrects the rounding error and still converts to square pixels?

1919x1080 in PhotoShop. PS doesn’t make use of a DAR somehow exported by Video AI to a TIFF’s metadata. It’s not possible to scale 853x480 to 1920x1080 anyway; it’s just simple math. Again, as I mentioned several times in my posts, the correct description of 720x480 anamorphic is “scale=w=720:h=480,setsar=1.1852”, which solves all problems, as I’ve tested that with all Video AI’s upscales, and each winds up with the correct frame size and the same display size. Why even consider any other solution?(!)

TVAI applies the DAR to the 1920x1080 frame to generate the 1919x1080 tiff. There is no DAR in a tiff file.

In a media player, it takes a 1920x1080 frame from the video file and applies the DAR to display the frame at 1919x1080. As I’ve said, the content of the file is at 1920x1080, only the DAR is wrong.

Anyway, I generated my own ffmpeg command using the description;

and it does correct the aspect ratio rounding error on the output file.

I’m agreeing that your solution does seem to solve the display aspect ratio error on the output file.

I think you’re misunderstanding what I was saying, but your solution does work (based on my limited testing).

My apologies, as ffprobe indeed reveals the following:

“width”: 1920,
“height”: 1080,
“coded_width”: 1920,
“coded_height”: 1080,
“closed_captions”: 0,
“has_b_frames”: 0,
“sample_aspect_ratio”: “2559:2560”, [should be 1:1]
“display_aspect_ratio”: “853:480”," [should be 16:9]

N.B. 2559/2560 times 1920 equals 1919 (rounded).

What you also can do is import the 853x480 one into Virtualdub, do a letterbox arround it fits 864 x 486 which is exactly 16:9, in TVAI upscale the 864 x 486 one and then crop the few pixels away from the upscaled. I hate DAR!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.