KoblentsBlog Photography
Contact About
Ches
Editing subtitles using ffmpeg
I had an issue where a video file had embedded (soft) subtitles with an error, and I wanted to edit the subtitles. Since it's just a stream in the file, it's really easy - at least for an mkv container.
All you need to do is extract the subtitles, edit them in your editor of choice, then add the stream back in. Previously, I removed the subtitle stream from the file entirely then added the edited one back; the updated version simply uses the video and audio from the original file, and the subtitles from the edited srt file, to make the new video output.
123
ffmpeg -i <video.mkv> -an -vn -map 0:2 -c:s:0 srt <sub.srt>
vi <sub.srt>
ffmpeg -i <video.mkv> -i sub.srt -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s copy <video_output.mkv>
Ches Koblents
February 21, 2017
 
« Newer Older »
© Copyright Koblents.com, 2012-2024