libvlc_media_add_option isn't working

This forum is about all development around libVLC.
ValentinNikin
New Cone
New Cone
Posts: 2
Joined: 10 Feb 2022 14:11

libvlc_media_add_option isn't working

Postby ValentinNikin » 10 Feb 2022 14:36

I have 1 video track (1 file), and 2 audio tracks (in 2 separate files).
I want to add audio tracks as slave to video. To do that I tried to use libvlc_media_slaves_add, but that function doesn't work.

VLC 3.0.17

My code

Code: Select all

... libvlc_media_t* media = libvlc_media_new_path(vlcInstance, pathToVideo); ... const char* slaveAudioPath1 = "F:\\\\Temp\\card_28_09_21\\CONTENTS\\AUDIO\\1105AH01.mxf"; const char* slaveAudioPath2 = "F:\\\\Temp\\card_28_09_21\\CONTENTS\\AUDIO\\1105AH01.mxf"; int ret = libvlc_media_slaves_add(media, libvlc_media_slave_type_audio, 4, slaveAudioPath1); // ret is 0 ret = libvlc_media_slaves_add(media, libvlc_media_slave_type_audio, 4, slaveAudioPath2); // ret is 0 auto status = libvlc_media_parse_with_options(media, libvlc_media_parse_local, -1); libvlc_media_player_set_media(player, media); libvlc_media_release(media); ... libvlc_media_player_play(player); ...
On the screen I see only video without audio. What is wrong in my code?

If I add slave with
libvlc_media_add_option(media, (const char*)(std::string(":input-slave=") + slaveAudioPath1).c_str());
all ok and audio playing with video. But this option allow to add only 1 slave.

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

Re: libvlc_media_add_option isn't working

Postby Rémi Denis-Courmont » 10 Feb 2022 20:34

You're not supplying valid URIs.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

ValentinNikin
New Cone
New Cone
Posts: 2
Joined: 10 Feb 2022 14:11

Re: libvlc_media_add_option isn't working

Postby ValentinNikin » 11 Feb 2022 06:59

Could you please explain me how is should look valid URIs? What is wrong in my URIs?

If I send these URIs to libvlc_media_add_option(media, (const char*)(std::string(":input-slave=") + slaveAudioPath1).c_str());, all ok, and slave track is playing
I also tried such variant of URI "F:\\Temp\\card_28_09_21\\CONTENTS\\AUDIO\\1105AH01.mxf"; but also not working

If I requesting list of slaves by the command libvlc_media_slaves_get(...). I got slave track. But it's not playing.
I also requesting libvlc_audio_get_track_count(...) after added slaves. That method returned 0.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 36 guests