Audio extract misses some streams
Posted: 29 Jul 2012 16:43
by mrlimbic
When using stream export to extract audio to WAV/integer uncompressed, the WAV seems to only include 1st audio stream by default and doesn't seem to provide a way to specify which audio streams if more than 1.
Video produced by cameras often provide audio via 2 mono streams rather than 1 stereo.
I would like to extract all streams, either to separate files, or combine both into 1 stereo WAV, or multichannel AIF.
Is this possible with VLC or is this a bug?
Re: Audio extract misses some streams
Posted: 29 Jul 2012 23:35
by bat999
Video produced by cameras often provide audio via 2 mono streams rather than 1 stereo.
I would like to extract all streams, either to separate files, or combine both into 1 stereo WAV, or multichannel AIF.
Hi
I don't think that VLC can do this,
but maybe I'm wrong.
Are you trying to extract the audio from camera feeds on-the-fly?
Or
Are you trying to extract the audio from recorded files?
Re: Audio extract misses some streams
Posted: 29 Jul 2012 23:53
by mrlimbic
They are recorded files in MOV containers. They contain 4 streams: 1 video, then 2 audio, then 1 timecode.
I just want to extract the audio streams, either as separate files, or combined. I don't care about the video or timecode streams.
I found out that I can extract each separately using ffmpeg, so may have to use that unless I can find a more convenient way in future.
These commands worked on my test files to get each stream out into wavs..
ffmpeg -i dual-mono.mov -map 0:1 -vn stream1.wav
ffmpeg -i dual-mono.mov -map 0:2 -vn stream2.wav
Its a bit of hassle though as you have to work out the stream numbers before making the right command. You can find out which streams are contained and what their index is with this
ffmpeg -i dual-mono.mov
Stream #0.0(eng): Video: mpeg2video (Main), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 35000 kb/s, 25 fps, 25 tbr, 2500 tbn, 50 tbc
Metadata:
creation_time : 2012-03-25 10:36:14
Stream #0.1(eng): Audio: pcm_s16be, 48000 Hz, 1 channels, s16, 768 kb/s
Metadata:
creation_time : 2012-03-25 10:36:14
Stream #0.2(eng): Audio: pcm_s16be, 48000 Hz, 1 channels, s16, 768 kb/s
Metadata:
creation_time : 2012-03-25 10:36:14
Stream #0.3(eng): Data: tmcd / 0x64636D74, 0 kb/s
Metadata:
creation_time : 2012-03-25 10:36:14
Re: Audio extract misses some streams
Posted: 30 Jul 2012 00:29
by bat999
or combined.
For this can use FFmpeg too, with SoX:-
Code: Select all
ffmpeg -i dual-mono.mov -vn -map 0:1 -c:a copy temp1.wav && \
ffmpeg -i dual-mono.mov -vn -map 0:2 -c:a copy temp2.wav && \
sox -M temp1.wav temp2.wav stereo.wav && \
rm temp1.wav temp2.wav
Or with mkvmerge:-
Code: Select all
ffmpeg -i dual-mono.mov -vn -map 0:1 -c:a copy temp1.wav && \
ffmpeg -i dual-mono.mov -vn -map 0:2 -c:a copy temp2.wav && \
mkvmerge -o multi.mka temp1.wav temp2.wav && \
rm temp1.wav temp2.wav
EDIT
Maybe one pass will do it:-
Code: Select all
ffmpeg -i dual-mono.mov -vn -map 0:1 -map 0:2 -c:a:0 copy -c:a:1 copy multi.mka
Re: Audio extract misses some streams
Posted: 30 Jul 2012 13:28
by mrlimbic
Thanks. I tried that but I get.
Unrecognized option 'c
0'
Any ideas? Typo?
Re: Audio extract misses some streams
Posted: 30 Jul 2012 14:40
by bat999
... Unrecognized option 'c
0'...
Different version FFmpeg
(ffmpeg version git-2012-07-26-d5d5e3d)
Code: Select all
ffmpeg -i dual-mono.mov -map 0:1 -map 0:2 -acodec copy multi.mka
EDIT
The method with SoX doesn't work because FFmpeg won't allow type pcm_s16be in wav format.
It's easy to work around though if you prefer a 'stereo' wav/flac file instead of the 'multi' mka file.