Extract Audio from Video Stream with ffmpeg
Jump to navigation
Jump to search
Analyze Input Streams
ffmpeg -i video.ts 2>&1 | grep Audio
Any stream ffmpeg understands is possible
Select Stream from Output
Stream #0:1[0x57a](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s Stream #0:2[0x57b](mis): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s Stream #0:4[0x57e](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 448 kb/s
Note the #inputfile:stream number pair
Extract Audio (lossless)
ffmpeg -i video.ts -map 0:1 -vn -acodec copy audio.mp2
Option -map selects the stream, -vn ignores all video, -acodec copy means no audio format change
Extract Audio (direct conversion to MP3)
ffmpeg -i video.ts -map 0:1 -vn audio.mp3
Of course you can add options to select different mp3 quality