Convert Audio Stream

To convert the audio while leaving the video alone:

# To AC3
ffmpeg -i SomeVideo.mkv -c:v copy -c:a ac3 SomeVideo.mkv

# To AAC Stereo
ffmpeg -i SomeVideo.mkv -c:v copy -c:a libfdk_aac -ac 2 -vbr 4 SomeVideo.mkv

Note that we're specifying libfdk here for AAC (the successor to MP3). Using the Fraunhofer codex  leads to better results according to the ffmpeg group. We're also specifying 2 audio channels and Variable Bit Rate.

    https://trac.ffmpeg.org/wiki/Encode/AAC

You can of course use the GPL ffmpeg AAC if you wish.

# To AAC Stereo with 
ffmpeg -i SomeVideo.mkv -c:v copy -c:a aac -ac 2 -strict experimental someNewVideo.mkv 

You can also use avconv  (a fork of ffmpeg).

sudo avconv -i <input.mkv> -vcodec copy -acodec ac3 <ouput.mkv>

This assumes you want 'the best' video and audio stream and the utility will attempt to pick for you.  You can specify which streams you want if you need more granularity

    https://trac.ffmpeg.org/wiki/How%20to%20use%20-map%20option

Comments