2

I have been trying to convert mkv to mp4 using ffmpeg -i input.mkv -vcodec copy -acodec copy output.mp4

The input.mkv has two different audio track and one subtitle .

But the problem I am getting is that when I convert only the default audio track remains and the 2nd audio track & the subtitle does not get converted

Reference image

3 Answers 3

6

You may not use a mp4 container if the subtitle stream contains a format other than the special MPEG-4 Timed Textformat. But you can tranform it:

ffmpeg -i input.mkv -vcodec copy -acodec copy -scodec mov_text output.mp4

This way you take all streams including the converted subtitles.

This command only copies the video and audio streams, they are not reencoded. The subtitles are translated into "timed text"

2
  • Not sure what you mean, I have many .mp4 files with multiple audio streams & multiple subtitle streams. en.wikipedia.org/wiki/MPEG-4_Part_14
    – codlord
    Mar 30, 2021 at 21:37
  • yes-I'Ve seen that. But for me it doesn't work using ffmpeg: ` Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument ` . If i change to "output.mkv" it works. It works with "timedText" for mp4 but not with "subrip" - which is on most DVD and bluerays. I'll update my answer
    – kanehekili
    Mar 31, 2021 at 18:02
3

Use -map advanced option. See manpages (man ffmpeg) but basically use -map 0

Excerpt from manpage:

For example, to map ALL streams from the first input file to output 

ffmpeg -i INPUT -map 0 output
4
  • It works!!! I also just figured it out right now . I used ffmpeg -i input.mkv -c:v copy -map 0 -c:s mov_text -x265-params crf=25 output.mp4 . ` -c:s mov_text -x265-params crf=25` for subtitles . -map 0 for audio tracks. -c:v copy for video stream Mar 30, 2021 at 17:17
  • @ShravanMhatre You are stream copying the video with -c:v copy, so -x265-params crf=25 is being ignored.
    – llogan
    Mar 31, 2021 at 17:01
  • @Ilogan - you are correct. I've updated my answer - and removed my unqualified comment ;-)
    – kanehekili
    Mar 31, 2021 at 18:13
  • @llogan I am stream copying because I just wanted to change the video extension not the codec. Apr 1, 2021 at 15:54
0

As a GUI for ffmpeg there is this tool: dmMediaConverter.

Very easy to use, but with subtitles I had to edit the subtitle codec and change to mov_text, as indicated in the other answer by @kanehekili.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .