How can I get the actual Display Aspect Ratio ?

This forum is about all development around libVLC.
dongxf
Blank Cone
Blank Cone
Posts: 10
Joined: 14 Oct 2011 07:31

How can I get the actual Display Aspect Ratio ?

Postby dongxf » 16 Jan 2016 10:08

Hi,
I'm using libvlc 2.1.3 to show logo on the screen, I need to know the actual Display Aspect Ratio(DAR) in the media file, so I call the libvlc_video_get_aspect_ratio function, but it returns null.
I use mediainfo utility, found the DAR in the media file is 4:3, how can I get this 4:3 with libvlc ? I don't want to use an additional mediainfo.dll.

The reason I need DAR is I want to show logo in the middle of the screen with different media file which has different resolution, I need to calculate the resolution of the render screen size and put the logo to the correct position.

Or, Who can tell me how I can get the actual render size by libvlc, for example, the video size is 720x480, when I get a snapshot with default aspect ratio, I get a png file which is 853 x 480, How can I get this 853 x 480 ?

Thanks !

dongxf

Rémi Denis-Courmont
Developer
Developer
Posts: 15268
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: How can I get the actual Display Aspect Ratio ?

Postby Rémi Denis-Courmont » 16 Jan 2016 11:26

libvlc_video_track_t conveys the SAR and the resolution, from which you can infer the DAR.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

dongxf
Blank Cone
Blank Cone
Posts: 10
Joined: 14 Oct 2011 07:31

Re: How can I get the actual Display Aspect Ratio ?

Postby dongxf » 17 Jan 2016 05:58

Do you mean DAR can be calculated by SAR and width, height ?

Rémi Denis-Courmont
Developer
Developer
Posts: 15268
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: How can I get the actual Display Aspect Ratio ?

Postby Rémi Denis-Courmont » 17 Jan 2016 09:27

Isn't that obvious?
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

dongxf
Blank Cone
Blank Cone
Posts: 10
Joined: 14 Oct 2011 07:31

Re: How can I get the actual Display Aspect Ratio ?

Postby dongxf » 17 Jan 2016 17:14

I checked a file, it is just like what you said, I will check other files later, Thank you very much !

dongxf
Blank Cone
Blank Cone
Posts: 10
Joined: 14 Oct 2011 07:31

Re: How can I get the actual Display Aspect Ratio ?

Postby dongxf » 17 Jan 2016 17:23

Isn't that obvious?
Yes, Thanks :)


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 35 guests