Problems with libvlc_video_set_callbacks() When using vlc_3.0

This forum is about all development around libVLC.
haha459862
New Cone
New Cone
Posts: 2
Joined: 27 Feb 2018 12:38

Problems with libvlc_video_set_callbacks() When using vlc_3.0

Postby haha459862 » 28 Feb 2018 08:33

First, I describe my application scenario:

1, my video input source is from the network, using the RTSP protocol;
2, I need to get the data of each frame and use it for custom rendering.
3. Before drawing, I need to get the video resolution and frame rate to create a suitable buffer.
4, I use functions libvlc_media_parse_with_options (), libvlc_media_tracks_get (), libvlc_video_set_callbacks () and libvlc_video_set_format_callbacks ().

In the process of programming, I met the following questions:

1, I need to get the video resolution and frame rate, so I use libvlc_media_parse_with_options () function and listen to libvlc_MediaParsedChanged event, then use libvlc_media_get_parsed_status () function to obtain the status of the parse, but the return value is always libvlc_media_parsed_status_skipped. Why?

2, I found that the libvlc_video_set_format_callbacks() function always callback three times. The first time, Chroma is "DX11", resolution is 1280 x 720, the second time Chroma is "DXA9", resolution is 1280 x 720, the third time Chroma is "I420", resolution is 1280 * 738. But the functions in vlc_2.8 only callback one time. Why? How should I use this callback function?

3, I found that there is resolution information in set format callback function, but there is no frame frequency information. Therefore, I use libvlc_media_tracks_get () function to retrieve video information in callback function, but all the parameters are 0. How do I get the resolution and frame rate correctly?

Thanks in advance for help or any code snippet.

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

Re: Problems with libvlc_video_set_callbacks() When using vlc_3.0

Postby Rémi Denis-Courmont » 28 Feb 2018 17:47

1. VLC cannot preparse RTSP.
2. VLC tries to negotiate GPU surfaces, and fails.
3. The resolution is available from the format callback, and there is no concept of frequency at that level.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

haha459862
New Cone
New Cone
Posts: 2
Joined: 27 Feb 2018 12:38

Re: Problems with libvlc_video_set_callbacks() When using vlc_3.0

Postby haha459862 » 01 Mar 2018 04:12

How do I get the resolution and frame rate correctly for my application?

umod.47
New Cone
New Cone
Posts: 4
Joined: 03 Mar 2018 16:02

Re: Problems with libvlc_video_set_callbacks() When using vlc_3.0

Postby umod.47 » 03 Mar 2018 22:35

If you get callback for every frame, you can just calculate framerate using time difference between callbacks.

The correct place to allocate frame buffer is in format callback.
Reallocate it each time new callback happens (you can use realloc for that).
At least, this is how I made it in my application.

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

Re: Problems with libvlc_video_set_callbacks() When using vlc_3.0

Postby Rémi Denis-Courmont » 03 Mar 2018 23:02

The resolution is provided to the format callback. Frame rate is not exposed as not all video have a regular frame rate, and VLC is not frame accurate.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 11 guests