How to output the multiple video tracks?

This forum is about all development around libVLC.
zczc250
New Cone
New Cone
Posts: 4
Joined: 20 May 2011 15:42

How to output the multiple video tracks?

Postby zczc250 » 20 May 2011 16:02

I have some wmv files with multiple video tracks, and i need to make a player to play them in one window.
I have made a player by libvlc, after I use a simple code as:

Code: Select all

inst = libvlc_new (0, NULL); m = libvlc_media_new_path (inst, "C:\\Users\\Administrator\\Desktop\\20100302-20100516-162804.wmv"); mp = libvlc_media_player_new_from_media (m); libvlc_media_player_set_hwnd(mp,ui->mdiArea->winId()); libvlc_media_player_play(mp);
It popup another window(vlc (direct3d output)).

so, how can i render the sencond track's video output to another widget(ui->mdiArea_2->winId()).

I know a way, let one libvlc_media_player_t do this:

Code: Select all

libvlc_video_set_track(mp,-1); libvlc_video_set_track(mp,1);
and another do this:

Code: Select all

libvlc_video_set_track(mp2,-1); libvlc_video_set_track(mp2,2);
But that wil cost double bandwidth if I use a url with rtsp or http.

Any help is very much appreciated.

Thanks

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

Re: How to output the multiple video tracks?

Postby Rémi Denis-Courmont » 20 May 2011 17:25

There is currently no way to embed more than one video track with set_hwnd(). set_format_callbacks() does support multiple tracks, but it is obviously a lot more involved.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

zczc250
New Cone
New Cone
Posts: 4
Joined: 20 May 2011 15:42

Re: How to output the multiple video tracks?

Postby zczc250 » 20 May 2011 17:41

There is currently no way to embed more than one video track with set_hwnd(). set_format_callbacks() does support multiple tracks, but it is obviously a lot more involved.
Thanks for your help, I don't know how to use the callback. I will read some documents about that.

Do you have some sample code or links about callbacks?

Thank you again.

zczc250
New Cone
New Cone
Posts: 4
Joined: 20 May 2011 15:42

Re: How to output the multiple video tracks?

Postby zczc250 » 21 May 2011 16:07

I found a new way

Code: Select all

inst = libvlc_new (0, NULL); m = libvlc_media_new_path (inst, "C:\\Users\\Administrator\\Desktop\\20100302-20100516-162804.wmv"); mp = libvlc_media_player_new_from_media (m); libvlc_video_set_track(mp,1); libvlc_media_player_set_hwnd(mp,ui->mdiArea->winId()); libvlc_media_player_play(mp); Sleep(1000); libvlc_video_set_track(mp,-1); libvlc_video_set_track(mp,1); Sleep(1000); libvlc_media_player_set_hwnd(mp,ui->mdiArea_2->winId()); libvlc_video_set_track(mp,2);
It works. But the first "Sleep" also make the window popup for a sencond, maybe I should use the callback instead of "Sleep".

I hope this is useful for you. ^_^

erwan10
Developer
Developer
Posts: 415
Joined: 02 Nov 2008 23:16

Re: How to output the multiple video tracks?

Postby erwan10 » 21 May 2011 16:32

Alternatively, if you just want multiple videos in a single window, the skins2 interface is your friend.

You can create your own skin with multiple <VIDEO> tags within a single window. These videos tags will be used in the order they appear in the theme.xml file. This can be used either with multiple video tracks or when using audio visualisation for a video file.

Only caveat, the hotkeys subsystem may behave weirdly (hotkeys pressed for one video widget may end up being taken into account by the wrong video track)

zczc250
New Cone
New Cone
Posts: 4
Joined: 20 May 2011 15:42

Re: How to output the multiple video tracks?

Postby zczc250 » 21 May 2011 16:51

Alternatively, if you just want multiple videos in a single window, the skins2 interface is your friend.

You can create your own skin with multiple <VIDEO> tags within a single window. These videos tags will be used in the order they appear in the theme.xml file. This can be used either with multiple video tracks or when using audio visualisation for a video file.

Only caveat, the hotkeys subsystem may behave weirdly (hotkeys pressed for one video widget may end up being taken into account by the wrong video track)
I haven't notice the skin function of vlc before. That's really a good way. Thank you~~~


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 3 guests