Log in

View Full Version : How to extract an audio stream with ffmpeg ?


Music Fan
14th January 2016, 19:36
Hi,
I'm a little bit confused with the help of ffmpeg ;
http://ffmpeg.org/ffmpeg.html#Advanced-options

How to extract an audio stream without re-encoding when there are several audio streams ?

For example, I have a ts file including 3 audio channels, I wanna keep 0:2, do I have to type this ?
C:\ffmpeg\ffmpeg.exe -i "I:\video.ts" -acodec copy -map 0:2 "P:\audio 2.ac3"
Or -acodec copy is not needed ?

GMJCZP
15th January 2016, 03:50
-acodec copy is needed, otherwise audio is re-encoded:

For example:

ffmpeg.exe -i input.ts -vn -acodec copy output.ac3

video is null

Music Fan
15th January 2016, 11:56
And what is the utility of adding -vn if I keep only audio ?
I tested my script (without -vn), it seems to work, I get only an ac3 file.

StainlessS
15th January 2016, 17:27
And what is the utility of adding -vn if I keep only audio ?
I tested my script (without -vn), it seems to work, I get only an ac3 file.

Perhaps faster if it knows in advance that video is not required, ie it might process video and only discard at last minute when outputting to AC3, why not try it out and see if it takes longer.

Music Fan
15th January 2016, 17:49
Ok, I will try next time I need it.
Does Ffmpeg allow multiple export in 1 command line ? I mean if I need all audio tracks, each in one file ?