[FFmpeg-user] Stereo AAC

Frank Haefemeier media at frank.haefemeier.eu
Tue Apr 17 23:24:12 EEST 2018


Am Montag, den 16.04.2018, 16:02 -0400 schrieb antony baxter:
> Hi all,
> 
> I have some video files with a DTS audio stream. I'm trying to add a
> couple of additional audio streams into the file, transcoded from the
> DTS stream. My command line is:
> 
>    ffmpeg
>       -i "${input}"
>       -map 0:0
>       -map 0:1
>       -map 0:1
>       -map 0:1
>       -c:v copy
>       -movflags +faststart
>       -c:a:0 aac
>       -b:a:0 192k
>       -ac 2
>       -metadata:s:a:0 title="AAC Stereo Audio"
>       -c:a:1 ac3
>       -ac 6
>       -metadata:s:a:1 title="AC3 5.1 Audio"
>       -c:a:2 copy
>       -disposition:a -default
>       -disposition:a:0 default
>       -f mp4
>       "${output}.mp4"
If you not specifiy the right mapping index by 'ac' parameter it will
default to zero. In your case '-ac 6' will overwrite '-ac 2'. Use '-
ac:1 2' and '-ac:2 6' and you will get what you expected. Please take
care of the different index numbers between 'ac' and '-b:a' for
example. It is related to the map paramter not to the related audio
output stream index. The '-ac:2 6' parameter can safely be deleted,
because the channel definition will be taken from the source stream.
For a better reading (and in some cases the order has an impact to
ffmpeg) you should order your parameter a little bit. Write all related
parameters together directly behind the corresponding '-map'. '-f'
parameter can be deleted as well, ouput file extension give the hint
for ffmpeg autodetection.

ffmpeg -i "${input}"
  -map 0:0 
     -c:v copy 
     -movflags +faststart
  -map 0:1 
     -c:a:0 aac 
     -b:a:0 192k 
     -ac:1 2 
     -metadata:s:a:0 title="AAC Stereo Audio" 
     -disposition:a:0 default 
  -map 0:1 
     -c:a:1 ac3 
     -ac:2 6 
     -metadata:s:a:1 title="AC3 5.1 Audio" 
  -map 0:1 
     -c:a:2 copy
  -f mp4
  "${output}.mp4"

I deleted '-disposition:a -default', because it will not work in this
way, IMHO

Bye
    Frank

P.S.: It is untested!


More information about the ffmpeg-user mailing list