http interface - Change selected audio track
Posted: 05 Jul 2022 12:25
Dears,
sorry that i am totally new here and directly post my first question, i hope this is not offending to anyone.
Using VLC latest release 3.0.17.4.
I am spawning vlc from nodejs and configure it to send "what it plays" to stdout (which is forwarded to a jsmpeg webplayer).
This all seems to work pretty well but i would like to be able to change the playing audio track, just as i would do it on the main vlc interface in the audio->tracks menu.
So, using an example source file that has 4 stereo tracks, it works to select the tracks from the VLC UI but 2 things do not work:
1) add audio-track=1 to the commandline transcode settings (e.g. directly after height=250).
2) calling the http api like this (i didnt find any documentation about this but reading the source code, it could potentially work: https://github.com/videolan/vlc/blob/e3 ... quests.lua ):
Here is how i spawn vlc from my code:
Above command explained: "--no-sout-all" Disables the automatic downmix of all channels to the main output, the duplicate and udp output is needed because udp seems to force "realtime encoding", if i don't do that, it will encode and stream the wanted mpeg1 ts in maximum possible speed.
What happens in both versions (commandline option or http api) is that either just the first track plays or silence plays.
Any clues what i am doing wrong?
sorry that i am totally new here and directly post my first question, i hope this is not offending to anyone.
Using VLC latest release 3.0.17.4.
I am spawning vlc from nodejs and configure it to send "what it plays" to stdout (which is forwarded to a jsmpeg webplayer).
This all seems to work pretty well but i would like to be able to change the playing audio track, just as i would do it on the main vlc interface in the audio->tracks menu.
So, using an example source file that has 4 stereo tracks, it works to select the tracks from the VLC UI but 2 things do not work:
1) add audio-track=1 to the commandline transcode settings (e.g. directly after height=250).
2) calling the http api like this (i didnt find any documentation about this but reading the source code, it could potentially work: https://github.com/videolan/vlc/blob/e3 ... quests.lua ):
Code: Select all
http://localhost:1235/requests/status.xml?command=audio_track&val=1
Code: Select all
var vlc = spawn("C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe", [
"-I","http",
config.file,
"--sout-avformat-mux","mpeg2ts",
"--sout-avformat-options", "muxdelay=50",
"--no-sout-all", //prevent downmix all channels
"--play-and-pause", //pause at last frame
//"--start-paused",
//audio-track=1 in encode below dont work
':sout=#transcode{,vcodec=mp1v,acodec=mpga,vb=1256k,ab=256k,width=512,height=250}:duplicate{dst=standard{access=udp},dst=standard{access=file,mux=avformat{mux=mpegts,options={muxdelay=0.001}},dst="-"}}',
//"--sout-avcodec-keyint=10",
"--http-host" ,"127.0.0.1",
"--http-port", "1235",
'--http-pass','SUPERSECRET',
]
);
What happens in both versions (commandline option or http api) is that either just the first track plays or silence plays.
Any clues what i am doing wrong?