play audio to only one speaker left/right from commandline using libvlc
Asked Answered
C

2

6

Is it possible to make vlc play audio to only one of the speakers left/right from commandline ?

Cashmere answered 14/2, 2012 at 6:17 Comment(8)
I think you can change the audio settings from the OS you use. So, you program this through an OS-specific feature using its system library. I don't think VLC has a feature to control an audio speaker... it only has audio effect filters. Under Windows, VLC uses DirectShow interface to capture all A/V devices. So, you shall use DirectX library to control the audio interface directly.Margaretmargareta
I need to be able to run 2 processes playing vlc at the same time, one process will play the audio to the left speaker and the other to the right speaker. can this be done with DirectShow ? cant I change the balance played by vlc ( with one of the filters maybe ) ?Cashmere
What you need is to control L&R audio channels which libVLC seems to expose them but is not present in VLC GUI. In VLC, it allows an audio track of a media to be in stereo or mono on both side of the audio channels for that media player instance. This can be done through Audio -> Audio Channels menu option while playing the media. I am not sure if you can specifically control either L or R audio channel via VLC GUI interface.Margaretmargareta
Actualy I am using libvlc ( not the VLC GUI ) with a .net wraper called Vlc.Dotnet. and when I try to set the channel using libvlc_audio_set_channel, nothing changes ( when I try to get the channel with libvlc_audio_get_channel I get 0 )Cashmere
Check the forum topic for hints forum.videolan.org/viewtopic.php?f=32&t=87115Margaretmargareta
I read this topic and I still cant figure out what is wrong with my code, I am using 1.1.10 and the dotnet wraper is using the correct function signature ( libvlc_audio_get_channel gets a pointer to the playerInstance that was created using libvlc_media_player_new )Cashmere
I think it is possible.. videolan.org/developers/vlc/doc/doxygen/html/…Jabberwocky
@Margaretmargareta Ubuntu Linux too. You mentioned Windows, so I will mention Ubuntu Linux has a Sound Setting to adjust left/right speakers called Balance. (I still wish VLC did that natively to be sure it's working, but the System should override VLC correct?)Sheikh
D
2

If VLC Audio channels is not performing well the most you can do is open a ticket in VLC bug system.

If you can't wait until the issue is fixed just redirect the audio output to STDOUT and use a tool like SOX to do the work for you.

Selecting a Particular Channel with sox:

sox stereo.wav -c 1 mono.wav avg -l

of course sox can work on streams and it's not restricted to files.

BTW, sox comes with play and record utilities that can do the actual playback. see the examples here

Deborahdeborath answered 22/2, 2012 at 13:56 Comment(1)
streaming to stdout on windows: forum.videolan.org/viewtopic.php?f=4&t=57940Deborahdeborath
M
0

Have you looked into mplayer? It can easily do this via "-af channels=...".

Marxist answered 22/2, 2012 at 23:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.