VLC Aspect Ratio Snapping Explanation

All you've ever wanted to know about the ActiveX, Mozilla plugins, the web interface and various PHP extensions
yety
New Cone
New Cone
Posts: 4
Joined: 08 Nov 2016 21:39

VLC Aspect Ratio Snapping Explanation

Postby yety » 08 Nov 2017 22:42

I am programming a measuring tool which makes use of the AxVLC library. I have successfully created the tool, but when someone loaded a 720x480 video, some measurements were off. After some digging in these forums and my code, I learned that VLC snaps the video to a 16:9 aspect ratio when it displays, but the height and width listed in AxVLCPlugin.video is still 720x480, which would be a "3:2" aspect ratio. I can program my measurements to account for this, but i need to know whether VLC always snaps to 16:9 if it encounters an unknown aspect ratio or if it snaps according to some algorithm or lookup table, because i would like to fix this for all video dimensions rather than just 720x480.

No information is available to suggest the current aspect ratio of the displayed video in the ActiveX control as the AxVLCPlugin.video.aspectRatio field is always blank, unless the value existed in the video's metadata and setting it in code does nothing to the actual displayed video.

the set of all available aspect ratios in VLC is as follows:
(null)
Default
16:9
4:3
1:1
16:10
2.21:1
2.35:1
2.39:1
5:4
according to this https://www.vlchelp.com/fix-stretched-v ... pect-ratio
as well as according to opening VLC media player myself and just looking at the list.

so far i have not found a way to force source aspect ratio as you can from a vlc command line execution(as listed in the official VLC docs) but if i could force it to display the video at its original aspect ratio, that would work just as well.

3:2 gets snapped to 16:9, which skips right over 16:10 between them, so i know it is not simply snapping to the next highest or lowest aspect ratio, but for the sake of good code, I would like to know what it actually snaps to.
If it just snaps to 16:9 by default, i can work with that,
if it snaps in some strange order or according to some odd range table, i can work with that,
if you know how to force the original aspect ratio in the activeX control through C#, i can work with that.

Any help is appreciated.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: VLC Aspect Ratio Snapping Explanation

Postby Jean-Baptiste Kempf » 09 Nov 2017 11:35

First, you should not use AxVLC, because this is way too limited.

Else, once the playback starts, you should have the aspect ratio to apply for those anamorphic videos.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

yety
New Cone
New Cone
Posts: 4
Joined: 08 Nov 2016 21:39

Re: VLC Aspect Ratio Snapping Explanation

Postby yety » 09 Nov 2017 21:10

What would you recommend I use instead?
Requirements include:
-WinForms Application
-Render controls on top of the Video(most any activeX plugin that allows child controls will work for me)
-Apache or some other free to use license, proper credits are of course given
-Full Playback control


When playback starts the aspectRatio field of AxVLCPlugin.video is blank, as it is only representative of the file's metadata. All width and height values available throughout the object are related to the native width and height of the video or the control's width and height, nothing indicates current rendered width or height that I can find. There is no way to apply an aspect ratio that I have found.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: VLC Aspect Ratio Snapping Explanation

Postby Jean-Baptiste Kempf » 28 Nov 2017 09:41

libvlc.net
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “Web and scripting”

Who is online

Users browsing this forum: No registered users and 6 guests