How to encode multiple audio streams with different parameters at the same time using ffmpeg

I am trying to encode a dvd using ffmpeg.

$ffmpeg -i VTS_01_1.VOB
Input #0, mpeg, from 'VTS_01_1.VOB':
Duration: 00:38:06.52, start: 0.287267, bitrate: 3756 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 9800 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s
Stream #0:2[0x81]: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s
Stream #0:3[0x82]: Audio: ac3, 48000 Hz, 5.1(side), s16, 384 kb/s
Stream #0:4[0x83]: Audio: ac3, 48000 Hz, mono, s16, 96 kb/s
Stream #0:5[0x28]: Subtitle: dvd_subtitle
Stream #0:6[0x29]: Subtitle: dvd_subtitle
Stream #0:7[0x23]: Subtitle: dvd_subtitle
Stream #0:8[0x24]: Subtitle: dvd_subtitle
Stream #0:9[0x26]: Subtitle: dvd_subtitle
Stream #0:10[0x27]: Subtitle: dvd_subtitle

      

From the streams above, I'm interested in storing two audio streams, numbers 1 and 4. Since you can see that number 4 is already 96kbps, so I tried a command that could handle the two streams differently:

cat VTS_01_1.VOB | nice ffmpeg -i - -s 640x368 -vcodec libtheora -r 25 -b:v 1200k -an -metadata title="My Title" -pass 1 -passlogfile "/media/data/outputlog" -f ogg -y /dev/null

cat VTS_01_1.VOB | nice ffmpeg -i - -map 0:0 -s 640x368 -vcodec libtheora -r 25 -b:v 1200k -async 1 -metadata title="My Title" -map 0:1 -acodec libvorbis -ac 6 -ar 48000 -b:a 192k -metadata title="english" -map 0:4 -acodec libvorbis -ac 2 -ar 48000 -b:a 96k -metadata title="commented" -pass 2 -passlogfile "/media/data/outputlog" "/media/data/output.ogv"

      

I would like to receive:

Input #0, ogg, from 'output.ogv':
Duration: 00:38:07.20, start: 0.000000, bitrate: 1360 kb/s
Stream #0:0: Video: theora, yuv420p, 640x368 [SAR 46:45 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream #0:1: Audio: vorbis, 48000 Hz, stereo, s16, 192 kb/s
Stream #0:2: Audio: vorbis, 48000 Hz, stereo, s16, 96 kb/s

      

Instead of this command, I get:

Input #0, ogg, from 'output.ogv':
Duration: 00:38:07.20, start: 0.000000, bitrate: 1360 kb/s
Stream #0:0: Video: theora, yuv420p, 640x368 [SAR 46:45 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream #0:1: Audio: vorbis, 48000 Hz, stereo, s16, 96 kb/s
Stream #0:2: Audio: vorbis, 48000 Hz, stereo, s16, 96 kb/s

      

So how can I specify different parameters for multiple audio streams?

BTW: I am on lubuntu oneiric with latest ffmpeg from git

ffmpeg version git-2012-03-05-1007a80 Copyright (c) 2000-2012 the FFmpeg developers
built on Mar  5 2012 09:40:09 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab --enable-libxvid --enable-libvpx
libavutil      51. 41.100 / 51. 41.100
libavcodec     54.  8.100 / 54.  8.100
libavformat    54.  2.100 / 54.  2.100
libavdevice    53.  4.100 / 53.  4.100
libavfilter     2. 63.100 /  2. 63.100
libswscale      2.  1.100 /  2.  1.100
libswresample   0.  7.100 /  0.  7.100
libpostproc    52.  0.100 / 52.  0.100

      

Therefore the newaudio option is not recognized

+3


source to share


1 answer


The result the link LordNeckbeard mentions is to use -b:a:0

and -b:a:1

to set the bitrate for certain audio streams instead -b:a

, which affects all audio streams.



+4


source







All Articles