Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
30th April 2021, 11:24 | #1 | Link |
Registered User
Join Date: Mar 2018
Location: Germany
Posts: 201
|
VD2: Aspect ratio: Cropping and Muxer
Recently I stumbled upon two questions with aspect ratio
where I got more and more confused. (I use the naming of https://en.wikipedia.org/wiki/Pixel_aspect_ratio) There seem to be two places to place the DAR: the stream and the muxer. Most players seem to ignore the stream DAR and use the muxer's. But where do I set the muxer's DAR in VD2? (As I do in AviDemux). When doing frame cropping I might like to preserve the SAR. The crop filter in AviDemux provides that very fine interactively, but how do I do that in VD2? Do I really need to do that by using the calculator beside? Last edited by nji; 30th April 2021 at 14:17. |
30th April 2021, 12:45 | #2 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
AVI [EDIT: container] has no standard Aspect Ratio flagging, [I believe some apps have tried to implement such, but most apps would completely ignore those flags].
EDIT: RIFF [which AVI is based upon] allows for custom chunks which could implement some form of Aspect Ratio flagging, but everybody execpt the implementor would likely skip over those chunks as allowed by RIFF. When cropping frames, sample/pixel aspect ratio does not change at all, whether you want it to or not. (Resizing can change sample/pixel aspect ratio)
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 30th April 2021 at 12:54. |
30th April 2021, 13:30 | #3 | Link |
Registered User
Join Date: Mar 2018
Location: Germany
Posts: 201
|
You are right, AVI container has no aspect ratio flagging.
But MKV, MOV/QT, MP4 and WebM has it. So...? Aspect ratio when cropping: If my orig frame has a SAR of 1 (=quadratic) and I chop off the upper half, the SAR (= frame dimension ratio) will be halved. If I keep the DAR constant then, the frame will be stretched vertically by 2 when displaying. As I said: Confused. |
30th April 2021, 15:01 | #4 | Link |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
|
Hmmm...
In my experience, most software and hardware media players read the 'video streams' aspect ratio signalling, not the containers. I suggest you visit the encoders configuration settings and enter the ratio you require in the boxes provided: - EDIT: I've just finished creating some 720x480 MPEG-4 AVC .mkv, .mp4 and .avi contained encodes using 'VirtualDub 2 v44282', and they all play at the correct aspect ratio on my OPPO UDP-203 hardware player, LG television, MPC-BE player, VLC player, Windows Media Player and my Android mobile phone
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
Last edited by SeeMoreDigital; 3rd May 2021 at 10:07. |
30th April 2021, 15:55 | #5 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
Yes, DAR can change when crop, but SAR does not. See Here, https://forum.doom9.org/showthread.p...93#post1576193 The GetSAR() etc things were re-implemented in RT_Stats as eg RT_GetSAR(). Here is a snippet of stuff I use in some scripts Code:
AviSource("...") # some source DAR=1.78 # According to DVD, maybe DGIndex, FULL FRAME including possible borders SAR=RT_GetSAR(DAR) RoboCrop() # Crop borders DAR=RT_GetDAR(SAR) # DAR after crop, SAR remains the same RT_DebugF("CropDAR=%f",DAR) # DAR of active image, excluding borders return last Code:
RT_GetSAR(clip,dar float) Gets Sample (pixel) Aspect Ratio from DAR Display Aspect Ratio. *** *** *** RT_GetDAR(clip,sar float) Gets DAR Display Aspect Ratio from SAR, Sample (pixel) Aspect Ratio. *** *** *** RT_SignalDAR(float) # See Megui wiki (name change from SetDAR) Signal DAR to MEGUI. Sets Global vars MeGUI_darX and MeGUI_darY which are read during MEGUI loading of AVS file. *** *** *** RT_SignalDAR2(int darx,int dary) As for RT_SignalDAR() except it allows setting of numerator and denominator individually. Signal DAR to MEGUI. Sets Global vars MeGUI_darX and MeGUI_darY which are read during MEGUI loading of AVS file. *** *** *** RT_GetCropDAR(clip,float DAR,float "X"=0,float "Y"=0,Float"W"=0,float "H"=0) Call prior to Crop/Resize with (possibly fractional) cropping to calc resultant DAR, X,Y,W,H are cropping coords DAR = FAR * SAR ::: FAR = DAR / SAR ::: SAR = DAR / FAR Cropping affects FAR & usually DAR, resizing does not affect DAR (unless also cropped). Resizing affects FAR and maybe SAR. We dont allow eg -ve X EDIT: And from the link (script versions) Code:
Function GetDAR(clip c, float SAR) { return Float(c.width) * SAR / Float(c.height)} # Gets the DAR from the SAR Function GetSAR(clip c, float DAR) { return DAR * Float(c.height) / Float(c.width) } # Gets the SAR from the DAR Function SignalDAR(float DAR) { global MeGUI_darx = Round(1000 * DAR) global MeGUI_dary = 1000 } # Signals DAR for MEGUI
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 30th April 2021 at 16:11. |
|
2nd May 2021, 11:22 | #6 | Link |
Registered User
Join Date: Mar 2015
Posts: 775
|
About AR in VD2: this is still to be developed, I have several feature requests in this area.
__________________
VirtualDub2 |
3rd May 2021, 08:03 | #7 | Link |
Registered User
Join Date: Mar 2018
Location: Germany
Posts: 201
|
OK, thanks, I got it then.
But as there hasn't been any step in VD2 dev in the last months... and there are probably not only issues about AR... Will there ever be a new version of it? Or is it the end of the road? Last edited by nji; 3rd May 2021 at 09:19. |
Thread Tools | Search this Thread |
Display Modes | |
|
|