Page 1 of 1

"libvlc_media_tracks_get" issue

Posted: 20 Oct 2017 15:15
by Moriquendi
Hello,

I'am using VLC 2.2.5.1 API in my QT program. I have a .ts stream and I am opening it using libvlc API where I would like to show media information just like Tools->Codec Information->Codec tab in VLC interface. My code is as follows;

Code: Select all

libvlc_media_track_t **tracks; libvlc_media_stats_t stats; libvlc_media_t *media = libvlc_media_player_get_media(player->core()); if (libvlc_media_get_stats(media, &stats)) { libvlc_media_tracks_get(media,&tracks); libvlc_video_track_t *video = (*tracks)->video; libvlc_audio_track_t *audio = (*tracks)->audio; qDebug()<<"INPUT BITRATE:"<<stats.f_input_bitrate*1024*8; qDebug()<<"DISPLAY RESOLUTION:"<<video->i_width<<"x"<<video->i_height; qDebug()<<"DISPLAY RESOLUTION(2nd solution):"<<libvlc_video_get_width(player->core())<<"x"<<libvlc_video_get_height(player->core()); qDebug() << "AUDIO CHANNELS:"<<audio->i_channels; qDebug() << "AUDIO SAMPLERATE:"<<audio->i_rate; qDebug() <<"FPS:"<<libvlc_media_player_get_fps(player->core()); }
The output of this block is as follows;

Code: Select all

INPUT BITRATE:1241.16 DISPLAY RESOLUTION: 44100 x 2 DISPLAY RESOLUTION(2nd solution): 1920 x 1080 AUDIO CHANNELS: 2 AUDIO SAMPLERATE: 44100 FPS: 0
For some reason, in my video track struct, i_width and i_height fields equal to audio track sample rate and channel fields respectively. Also, libvlc_media_player_get_fps always returns 0.

Am I missing something or is there a way to do this properly?

Cheers.

P.S: When I open this .ts stream via VLC 2.2.5.1, and go to Tools->Codec Information->Codec tab, everything seems to be correct.

Re: "libvlc_media_tracks_get" issue

Posted: 11 Nov 2017 14:20
by Jean-Baptiste Kempf
Use 3.0 and use preparsing().

Re: "libvlc_media_tracks_get" issue

Posted: 25 May 2019 02:17
by neosettler
Hi,

preparsing() how?

Re: "libvlc_media_tracks_get" issue

Posted: 27 May 2019 04:15
by mfkl
https://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__media.html#ga55f5a33e22aa32e17a9bb75decd1497b