Extract Audio from Video Stream with ffmpeg

From JoBaPedia
Revision as of 14:38, 15 November 2015 by Joachim (talk | contribs) (Created page with "= 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 ([...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

= 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