Skip to main content

How to remove media file streams using FFmpeg

· One min read

Setting up

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

https://docs.tdarr.io/blog/how-to-install-ffmpeg

Running the CLI

You can use the map command to remove streams from media files with FFmpeg. The stream index begins at 0, so, for example, to remove the first stream in the file you would use -map -0:0, to remove the second stream you'd use -map -0:1:

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

You can also remove streams by type. For example, to remove the second video stream you'd use -map -0:v:1, to remove the second audio stream you'd use -map -0:a:1 and to remove the second subtitle stream you'd use -map -0:s:1. You can use these commands together to do them all at once:

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

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

To remove subtitle streams:

Tdarr_Plugin_x7ab_Remove_Subs

To remove audio streams based on language:

Tdarr_Plugin_MC93_Migz3CleanAudio

info

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

https://tdarr.io/download/