FFmpeg provides tools for handling audio, video, and subtitle streams. When a video container contains embedded subtitles, those subtitle tracks can be excluded while creating a new video file. This is useful when a subtitle-free copy is required without modifying the original media streams through re-encoding. This tutorial shows how to remove subtitles from video file using FFmpeg.
A subtitle track can be removed by selecting all streams except subtitle streams and copying the remaining streams directly into a new container. This method preserves the existing video and audio data without re-encoding.
For testing, a sample video containing an embedded subtitle track can be downloaded with:
curl -sSo test.mp4 https://raw.githubusercontent.com/chromium/chromium/main/media/test/data/bear-1280x720-avt_subt_frag.mp4
The following command creates a new video without subtitle streams:
ffmpeg -v error -i test.mp4 -map 0 -map -0:s -c copy result.mp4
Command breakdown:
ffmpeg- the command used to process multimedia files.-v error- restricts FFmpeg output to error messages while suppressing informational and other non-error messages.-i test.mp4- specifies the video file used as the input.-map 0- includes all streams from the input file.-map -0:s- removes subtitle streams from the selected stream set.-c copy- copies the selected streams without re-encoding.result.mp4- specifies the output file that contains the video and audio streams without embedded subtitles.
Leave a Comment
Cancel reply