digitalFAQ.com Forum

digitalFAQ.com Forum (http://www.digitalfaq.com/forum/)
-   Encode, Convert for streaming (http://www.digitalfaq.com/forum/video-web/)
-   -   AVI to MP4 frame size, rectangle vs. square pixels? (http://www.digitalfaq.com/forum/video-web/9867-avi-mp4-frame.html)

Ryelzz 07-17-2019 08:14 PM

AVI to MP4 frame size, rectangle vs. square pixels?
 
Hi All,

I have captured some VHS tapes at a resolution of 720x576 using the Hauppauge, which enables me to capture and compress to mp4 in real time, which is fine, as I do not wish to perform any restoration, just very simple capture, compress, and share with the family.

I have also captured some 8mm tapes using DV, which are captured at 720x576 but these are saved as an AVI, which is also fine. However, these files are large and I am wanting to compress them to mp4 for upload etc.

The problem/misunderstanding I have is the AVI when compressed to mp4 are now 768x576, even though I am "maintaining" the same output size. I have done some research online and believe this is due to the AVI using rectangular pixels while the mp4 uses square pixels, but I don't understand the implications of this.

What I am wanting to know is if a 720x576 AVI is the equivalent to a 768x576 mp4, or should I be capturing my AVI at a different resolution?

I am PAL by the way.

Apologies if I have any of the terminology incorrect or have used poor choice of words in describing my situation.

lordsmurf 07-24-2019 07:11 PM

Quote:

Originally Posted by Ryelzz (Post 62597)
and believe this is due to the AVI using rectangular pixels while the mp4 uses square pixels

That's it.

The video is displayed (DAR) as 4x3.
The video is stored (SAR) as 5x4.
Files can have two AR (aspect ratios).

Analog is ideally captured max SD PAL of 720x576, and DVD/BD requires it. But it displays 5x4 if rectangle viewed square, usually due to no AR flags, of which lossless AVI does not have. MPEG/H.264 has AR flags, so you can make it any size, display any different size. But online streaming sites like Youtube are strictly 1x1 AR. Lots of my local videos are MKV flagged to different AR in the container, and watchable just fine on local LAN using BD player or WDTV or computer. But for Youtube, I'd have to reencode compliant to their 1x1 requirements.

768x576 is just 4x3 square pixels.
720x576 is rectangle.

I know, lots of jargon and terms, but that's video. Understand all that? :)

latreche34 02-04-2021 03:36 AM

Quote:

Originally Posted by Ryelzz (Post 62597)
I have done some research online and believe this is due to the AVI using rectangular pixels while the mp4 uses square pixels, but I don't understand the implications of this.

It's the other way around, AVI assumes every pixel is square therefore you get a weird aspect ratio (NTSC stretched horizontally and PAL/SECAM stretched vertically), Encoded video is smarter than AVI, it can display a rectangular pixel or a square pixel and the shape of the pixel PAR (pixel aspect ratio) can be assigned via an SAR flag, The SAR flag value (or PAR shape) depends on the initial resolution and the format of the video. If the SAR equals 1 it's a square pixel, if it's a fraction it's a rectangular pixel, Whatever SAR you choose the final goal is to have a perfect 4:3 aspect ratio of the frame.

Here are some SAR values for the 4:3 frame:

NTSC:
720x480 (DV/DVD, Full frame) -> SAR=8/9
704x480 (Analog Capture, SD Crop) -> SAR=10/11
640x480 (Square pixel, SD Resize) -> SAR=1

PAL/SECAM:
720x576 (DV/DVD, Full frame) -> SAR=16/15
704x576 (Analog Capture, SD Crop) -> SAR=12/11
768x576 (Square pixel, SD Resize) -> SAR=1

The general formula is: SAR = 4:3 x (V resolution : H resolution)

Example:
Code:

ffmpeg -i In.avi -vf "scale=w=-1:h=-1:interl=1,format=yuv420p,setsar=SAR=10/11" -flags +ildct+ilme -c:v libx264 -crf 18 -x264opts bff=1:colorprim=smpte170m:transfer=smpte170m:colormatrix=smpte170m:force-cfr -c:a aac -b:a 192k Out.mp4

cygnals 02-10-2021 09:19 PM

Thanks for this. I've been battling with this off and on for a while, and have now printed off your handy reference chart to keep at the computer. Cheers.


All times are GMT -5. The time now is 01:12 PM

Site design, images and content © 2002-2021 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2021 Jelsoft Enterprises Ltd.