I try to play a movie in two languages.
Audio 1 to Speaker
Audio 2 to Headset
mpv --lavfi-complex="[aid1] [aid2] amix [ao]" "input.mp4"
Play the video and mix audio1 & audio2 and output is standard device
mpv "input.mp4" --vid=1 --aid=1 --audio-device="wasapi/{d3178b30-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
Play video with audio1
mpv "input.mp4" --aid=2 --no-video --audio-device="wasapi/{06a44940-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
Play audio2 only
how to combine this?
I have successfully done this by creating a 5.1 stream with one language mixed down to [FL] and [FR] and another to [BL] and [BR].
That I sent either directly to a multi-channel hardware (via ALSA) or through JACK to be more flexible with the channel routing.
This might be possible using mpv’s --lavfi-complex but I always prepared the 5.1 stream using ffmpeg.
https://trac.ffmpeg.org/wiki/AudioChannelManipulation
Related
I'm currently trying to develop a Node.js application on MacOS that routes audio from a camera rtsp to a virtual audio driver (SoundPusher) to be played through Zoom mic as one stream as well as grab audio from Zoom output through the virtual audio driver to a output rtsp stream as a different stream:
1. Camera Rtsp/Audio Element (SoundPusher Speaker) -> Zoom Input(SoundPusher Mic)
2. Zoom Output (SoundPusher Speaker) -> Pipe audio to Output Rtsp from SoundPusher Mic
1.The implementation that I have right now is that the audio from the camera rtsp is piped to a HTTP server with ffmpeg. On the client side, I create an audio element streaming the audio from the HTTP server through HLS. I then run setSinkId on the audio element to direct the audio to the Soundpusher input and have my microphone in Zoom set to Soundpusher output.
const audio = document.createElement('audio') as any;
audio.src = 'http://localhost:9999';
audio.setAttribute('type', 'audio/mpeg')
await audio.setSinkId(audioDriverSpeakerId);
audio.play();
2.I also have Soundpusher input set as the output for my audio in Zoom so I can obtain audio from Zoom and then pipe it to the output rtsp stream from Soundpusher output.
ffmpeg -f avfoundation -i "none:SoundPusher Audio" -c:a aac -f rtsp rtsp://127.0.0.1:5554/audio"
The problem is that the audio from my camera is being mixed in with the audio from Zoom in the output RTSP stream but I'm expecting to hear only the audio from Zoom. Does anyone know of a way to separate the audio from both streams but use the same audio driver? I'd like to route the audio streams so that the stream from the audio element to Zoom is separate from the stream from Zoom to the output rtsp.
I'm very new to audio streaming so any advice would be appreciated.
I want to do live audio translation via microphone, to get streamed live vid/audio from Facebook, plug the mic into laptop and do live translation by mixing existing audio stream with one coming from the mic (translation). This is OK, somehow I got this part by using audio filter "amix" and mix two audio streams together into one. Now I want to add more perfection to it, is it possible to (probably is) upon mic voice detection to automatically decrease/fade down 20% volume of input/original audio stream to hear translation (mic audio) more loudly and then when mic action/voice stops for lets say 3-5 seconds the volume of original audio stream fades up/goes up to normal volume... is this too much, i can play with sox or similar?
Due to the richness and complexity of my app's audio content, I am using AVAudioEngine to manage all audio across the app. I am converting every audio source to be represented as a node in my AVAudioEngine graph.
For example, instead using AVAudioPlayer objects to play mp3 files in my app, I create AVAudioPlayerNode objects using buffers of those audio files.
However, I do have a video player in my app that plays video files with audio using the AVPlayer framework (I know of nothing else in iOS that can play video files). Unfortunately, there seems to be no way I can obtain the audio output stream as a node in my AVAudioEngine graph.
Any pointers?
If you have a video file, you can extract audio data and pull it out from the video.
Then you can set the volume of AVPlayer to 0. (If you didn't remove audio data from the video)
and Play AVAudioPlayerNode.
If you receive the video data through network, You should make parser of the packet and divide them.
But AV-sync is very tough thing.
I have multiple .wav sound files.
My objective is:
Play 3 wav files simultaneously using aplay and change the volume, during the play, for each sound.
Im using Ubuntu Linux.
aplay does not provide interactive control of the volume. When aplay -i is invoked it allows you to pause and resume playback but not interactively change the volume.
One way to achieve what you want to do is to use an audio player with the dmix audio device. For example if you use mplayer :
mplayer alsa:device=dmix audioFile
Now you can invoke mplayer as many times as you want concurrently playing audio from different files. To turn the audio volume up, press 0 and down press 9.
If your audio files have different formatting, such as word length, sample rates or channels, then you will want to use the plugdmix device like so :
mplayer alsa:device=plugdmix audioFile
I am trying to capture the video and audio using AVCaptureSession and I done with videocapturing and converted into pixel buffer and I played the output captured video at server side using ffmpeg n rtmp server. But the thing is how can I make the audio to be converted info data and play it at sever side where the data received. And want to know what the audio format is the audio that is captured.
Thank's All,
MONISH