Page 1 of 1

libvlc_media_add_option isn't working

Posted: 10 Feb 2022 14:36
by ValentinNikin
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.

Re: libvlc_media_add_option isn't working

Posted: 10 Feb 2022 20:34
by RĂ©mi Denis-Courmont
You're not supplying valid URIs.

Re: libvlc_media_add_option isn't working

Posted: 11 Feb 2022 06:59
by ValentinNikin
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.