Skip to main content

How to re-order streams using FFmpeg

· One min read

Setting up

First make sure you have FFmpeg installed. Follow this guide if you haven't already:

Running the CLI

To re-order streams using FFmpeg, use the map command. For this example, we'll use the following sample file:

The sample file has 3 streams, video and 2 audio. We're going to swap the first 2 streams around:

ffmpeg -i "C:\Transcode\input.mkv" -map 0:1 -map 0:0 -map 0:3 -c copy "C:\Transcode\output.mkv"

So the command says 'put the second stream first and the first stream second`.

The ordering of the map commands represents the ordering of the streams in the output file. The same process can also be run using:

ffmpeg -i "C:\Transcode\input.mkv" -map 0:a:0 -map 0:v:0 -map 0:a:1 -c copy "C:\Transcode\output.mkv"

In the above command, we're specifying the streams by their type, instead of using their overall index. So the command says 'put the first audio stream first and the first video stream second`.

You can automate this process on your files using the following Tdarr Plugins:



Get started using Tdarr transcode automation for free with this link: