View Full Version : how to programmatically detect video encoded in anamorphic
fifth5
23rd July 2009, 06:19
I'm writing a small tool to get mkv info but don't know how to determine if it's anamorphic.
Does anybody help me out? thanks.
Groucho2004
23rd July 2009, 06:54
Mediainfo (http://mediainfo.sourceforge.net/en)
fifth5
23rd July 2009, 07:13
Mediainfo (http://mediainfo.sourceforge.net/en)
I know mediainfo is a great tool, but it doesn't explicitly tell me if video is anamorphic.
In fact, I don't know how to determine that, by what measurement?
Groucho2004
23rd July 2009, 07:23
Mediainfo determines Pixel Aspect Ratio, Display Aspect Ratio, Width, Height. From these properties you can derive whether a video is anamorphic or not.
fifth5
23rd July 2009, 09:05
Mediainfo determines Pixel Aspect Ratio, Display Aspect Ratio, Width, Height. From these properties you can derive whether a video is anamorphic or not.
Thanks.
Then, if DAR/PAR is not 1:1, it's anamorphic?
SeeMoreDigital
23rd July 2009, 09:09
Use Donald Graft's DGAVCIndex and/or Kurtnoise's YAMB (which includes MP4Box).
Cheers
Groucho2004
23rd July 2009, 10:24
Thanks.
Then, if DAR/PAR is not 1:1, it's anamorphic?
When the PAR is not 1:1 the video is most likely anamorphic.
Search the forums, there's plenty of information about this here.
fifth5
23rd July 2009, 14:35
When the PAR is not 1:1 the video is most likely anamorphic.
Search the forums, there's plenty of information about this here.
PAR is not 1:1?
I've searched all over the web but I got told that basically PAR is not 1:1 in digital video. It should has nothing to do with anamorphism.
Besides, you said "most likely", so what's the exception?
thx.
audyovydeo
23rd July 2009, 15:33
PAR is not 1:1?
I've searched all over the web
Hint : look at SeeMoreDigital's footer.
I learned more about his page than anywhere else.
cheers
audyovydeo
Raptus
23rd July 2009, 16:24
When the PAR is not 1:1 the video is most likely anamorphic.
Not correct. Neither 4:3 PAL nor NTSC have square pixels:
http://en.wikipedia.org/wiki/Pixel_aspect_ratio#Pixel_aspect_ratios_of_common_video_formats
fifth5
23rd July 2009, 16:58
Hint : look at SeeMoreDigital's footer.
I learned more about his page than anywhere else.
cheers
audyovydeo
thanks.
There are almost dead links over that site.
PAR = DAR * (horizontal pixels / vertical pixels)
these latter 2 value are output resolution, so if PAR != 1, it's anamorphic, right?
LoRd_MuldeR
23rd July 2009, 17:40
PAR != 1:1 is the definition of "anamorphic" video ;)
Groucho2004
23rd July 2009, 17:54
Not correct. Neither 4:3 PAL nor NTSC have square pixels:
http://en.wikipedia.org/wiki/Pixel_aspect_ratio#Pixel_aspect_ratios_of_common_video_formats
:confused:
You might want to re-read what I wrote.
SeeMoreDigital
23rd July 2009, 18:10
so if PAR != 1, it's anamorphic, right?Sorry... I don't understand. Anyway, I will try to confirm.
A PAR/SAR value of 1:1 = An encode generated with square pixels, ie: not anamorphic.
A PAR/SAR value "other than" 1:1 = An encode generated with non-square pixels, ie: anamorphic.
LoRd_MuldeR
23rd July 2009, 18:11
Yes, in fact 4:3 content stored at the PAL/NTSC resolution of 720x576/720x480 is anamorphic too. The PAR for that is 16:15/8:9, it's not 1:1.
Anyway, if people talk about "anamorphic" PAL or NTSC video, they usually refer to anamorphic 16:9 content (aka "Widescreen").
smok3
23rd July 2009, 20:37
so if PAR != 1, it's anamorphic, right?
yes, thats how the term is used on doom9 forums (which are world reference of course, BBC is only #2) :search:
however in real world (as allready pointed out)the term is usually used to describe 'anamorphic widescreen'
http://en.wikipedia.org/wiki/Anamorphic_widescreen
benwaggoner
23rd July 2009, 23:22
I like to use FAR==Frame Aspect Ratio instead of PAR, which could be either Picture or Pixel Aspect Ratio.
So, FAR=1.333, PAR=1.00 for 640x480 square pixel.
LoRd_MuldeR
23rd July 2009, 23:28
Usually "PAR" refers to Pixel Aspect Ratio, which is the same as Sample Aspect Ratio (SAR). I never heard of Frame Aspect Ratio, but Display Aspect Ratio (DAR) is very common.
DAR = (Width / Height) * PAR
SeeMoreDigital
23rd July 2009, 23:42
I like to use FAR==Frame Aspect Ratio instead of PAR, which could be either Picture or Pixel Aspect Ratio.Given that Windows 7 uses terminologies such as: "Frame Width" and "Frame Height": -
http://i32.tinypic.com/f4iwbc.png
I guess FAR (Frame Aspect Ratio) is not too much of a leap. That said, how will it inform you of the shape of the pixels?
In the above case the FAR would be 720 / 432 = 5/3 (5:3)!
LoRd_MuldeR
23rd July 2009, 23:53
Given that Windows 7 uses terminologies such as: "Frame Width" and "Frame Height": -
http://i32.tinypic.com/f4iwbc.png
I guess FAR (Frame Aspect Ratio) is not too much of a leap. That said, how will it inform you of the shape of the pixels?
In the above case the FAR would be 720 / 432 = 5/3 (5:3)!
If FAR (Frame Aspect Ratio) is supposed to have the same meaning as DAR (Display Aspect Ratio), which I assume, you cannot calculate FAR = Width / Height.
The proper PAR (Pixel Aspect Ratio) needs to be applied. So FAR = DAR = (Width / Height) * PAR. Or other direction: PAR = FAR / (Width / Height).
benwaggoner
24th July 2009, 00:02
I guess FAR (Frame Aspect Ratio) is not too much of a leap. That said, how will it inform you of the shape of the pixels?
It doesn't. It's really synonmous with DAR.
I imagine our little compression shop came up with it independently when anamorphic video first started showing up around '96 :).
SeeMoreDigital
24th July 2009, 00:04
If FAR (Frame Aspect Ratio) is supposed to have the same meaning as DAR (Display Aspect Ratio), which I assume, you cannot calculate FAR = Width / Height.Yep... I think Bens suggestion for a straight swap over of PAR to FAR would only lead to further confusion :(
fifth5
24th July 2009, 04:56
Sorry... I don't understand. Anyway, I will try to confirm.
A PAR/SAR value of 1:1 = An encode generated with square pixels, ie: not anamorphic.
A PAR/SAR value "other than" 1:1 = An encode generated with non-square pixels, ie: anamorphic.
it's straight enough to understand.
PS.
I've look at your site.
You recommend not resizing when anamorphic encoding. Does it apply to new devices, lcd panel, widescreen PC monitor, etc?
LoRd_MuldeR
24th July 2009, 15:52
You recommend not resizing when anamorphic encoding. Does it apply to new devices, lcd panel, widescreen PC monitor, etc?
Yes. If you resize "anamorphic" video and you want to keep all detail, you would only upsize - never downsize.
Hence for anamorphic 16:9 stored at 720x576 (PAL), you would consequently upsize to 1024x576.
Of course upsizing doesn't generate more detail. It only keeps all the detail that was in your source (in optimal case).
Anyway, upsizing generates more pixels that need to be compressed. Hence you need more bits for the same quality.
So the most efficient way to deal with anamoprhic content is to keep it at its "native" resolution and store the correct PAR.
However if bitrate doesn't matter, using a "high quality" scaler to upsize before encoding may be a valid option...
fifth5
26th July 2009, 13:19
Yes. If you resize "anamorphic" video and you want to keep all detail, you would only upsize - never downsize.
Hence for anamorphic 16:9 stored at 720x576 (PAL), you would consequently upsize to 1024x576.
Of course upsizing doesn't generate more detail. It only keeps all the detail that was in your source (in optimal case).
Anyway, upsizing generates more pixels that need to be compressed. Hence you need more bits for the same quality.
So the most efficient way to deal with anamoprhic content is to keep it at its "native" resolution and store the correct PAR.
However if bitrate doesn't matter, using a "high quality" scaler to upsize before encoding may be a valid option...
That's it!
I've got the idea. thanks.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.