I'm struggling to find a one line command to merge new subtitle and delete existing ones from video file.


test1.mkv (already contain softcoded subs, dont need them)

test1.srt (only subtitle that i want on video)

Working under ubuntu server 18.04 LTS 64bit

Any help?


mkvmerge -o output.mkv -S 1.mkv --language 0:hrv --sub-charset 0:utf-8 1.srt

This will do the work

  • which version of ubuntu ? – EchoMike444 Nov 17 '19 at 23:19
  • Ubuntu server 18.04 LTS 64bit – user287842 Nov 17 '19 at 23:45
  • can install mkvtoolnix ( see my answer ) and run mkvinfo on your file – EchoMike444 Nov 18 '19 at 0:17

I will recommand to use mkvtoolnix

A package exits for ubuntu https://packages.ubuntu.com/bionic/mkvtoolnix

with the right combination of mkvextract and mkvmerge you can do what you want .

And you will use mkvinfo to display information about your file .

to install ...

apt-get install mkvtoolnix

to see a list of commands

dpkg -L mkvtoolnix | grep bin

and read man mkvmerge and man mkvextract

|improve this answer|||||
  • Working very well – user287842 Nov 18 '19 at 12:19

You have to map the new subtitles and map only the other streams from the original file.


ffmpeg -i test1.mkv -i test1.srt -c copy -map 0 -map -0:s -map 1 new.mkv

-map 0 maps all streams from the original file, including subtitles. -map -0:s deletes the subtitle mapping. -map 1 maps all streams from the 2nd input (test1.srt). All mapped streams are copied to new.mkv

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.