Reputation: 121
I am trying to convert a TS file ( with US closed captions ) into MKV ( or MP4 ). Currently I am doing using a three step approach.
Step-1 : Extract the subtitle in srt format.
ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map s output.srt
Step-2 : Transcode the TS into MKV
ffmpeg i test.ts -vcodec libx264 -acodec copy out.mkv
Step-3 : Add subtitle back to out.mkv
ffmpeg -i out.mkv -i output.srt -acodec copy -vcodec copy -scodec copy final.mkv.
I believe all these three steps can be combined in a single ffmeg command. Is there any way to do this?.
Upvotes: 1
Views: 4670
Reputation: 92998
You can try
ffmpeg -i test.ts -f lavfi -i "movie=test.ts[out0+subcc]" -map 0 -map 1:s -c:a copy -c:s srt final.mkv
Hopefully, the timestamps for the subtitles will be in sync :)
Upvotes: 2