Extract Audio from Video Stream with ffmpeg: Difference between revisions

From JoBaPedia
Jump to navigation Jump to search
(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 ([...")
 
No edit summary
Line 1: Line 1:
= Analyze Input Streams
= Analyze Input Streams =


  ffmpeg -i video.ts 2>&1 | grep Audio
  ffmpeg -i video.ts 2>&1 | grep Audio
Line 5: Line 5:
Any stream ffmpeg understands is possible
Any stream ffmpeg understands is possible


= Select Stream from Output
= 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:1[0x57a](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
Line 13: Line 13:
Note the #inputfile:stream number pair
Note the #inputfile:stream number pair


= Extract Audio (lossless)
= Extract Audio (lossless) =


  ffmpeg -i video.ts -map 0:1 -vn -acodec copy audio.mp2
  ffmpeg -i video.ts -map 0:1 -vn -acodec copy audio.mp2
Line 19: Line 19:
Option -map selects the stream, -vn ignores all video
Option -map selects the stream, -vn ignores all video


= Extract Audio (direct conversion to MP3)
= Extract Audio (direct conversion to MP3) =


  ffmpeg -i video.ts -map 0:1 -vn audio.mp3
  ffmpeg -i video.ts -map 0:1 -vn audio.mp3


Of course you can add options to select different mp3 quality
Of course you can add options to select different mp3 quality

Revision as of 14:39, 15 November 2015

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