Answers.Body: <p>Try</p>
  
  <pre><code>ffmpeg -i inputMovie.mkv -c copy -map 0 outputmovie.m4v
  </code></pre>
  
  <p>Depending on the subtitle format, they may not get copied over. In which case,</p>
  
  <pre><code>ffmpeg -i inputMovie.mkv -c copy -c:s mov_text -map 0 outputmovie.m4v
  </code></pre>
  
  <p><strong>Edit</strong>: Once you have a text-based subtitle format like SRT or ASS, you can use</p>
  
  <pre><code>ffmpeg -i inputMovie.mkv -i subtitle.srt -c copy -c:s mov_text -map 0:v -map 0:a -map 1 outputmovie.m4v
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-25T05:30:49.780Z
Answers.Text: Thank you for quick response, but they dont work ! In First one I become error: Could not write header for output file #0 (incorrect codec parameters : invalid argument. And for second i become:Error while opening encoder for output stream #0:3 - maybe incorrect parameters such as bit_rate, rate, width or height !!
Answers.UserDisplayName: salix
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-25T06:01:45.497Z
Answers.Text: Paste the readout of `ffprobe inputmovie.mkv` into your question.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-25T19:39:22.600Z
Answers.Text: Your subtitles are image-based and need to be converted to a text-based format like SRT. Once done, you can use the revised 2nd command. Use [Subtitle Edit](http://www.videohelp.com/software/Subtitle-Edit) to import from MKV.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-25T22:04:12.477Z
Answers.Text: i try it to do with 3 code (after the srt was exported - or downloaded) and i become again error message: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Answers.UserDisplayName: salix
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-26T04:19:47.613Z
Answers.Text: Paste the readout of ffprobe srt into your question.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-12T14:28:30.973Z
Answers.Text: that's the solution: "Edit: Once you have a text-based subtitle format like SRT or ASS, you can use": ffmpeg -i inputMovie.mkv -i subtitle.srt -c copy -c:s mov_text -map 0:v -map 0:a -map 1 outputmovie.m4v
Answers.UserDisplayName: salix
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-12T14:30:45.750Z
Answers.Text: now i do it with h265 and it is work; for i in *.mkv; do ffmpeg -i $i -map 0 \
  -c:v libx265 \
  -preset medium -x265-params crf=20:\
  qcomp=0.7:\
  ctu=32:\
  max-tu-size=16:\
  aq-mode=1:\
  aq-strength=1.0:\
  qg-size=16:\
  psy-rd=0.7:\
  psy-rdoq=5.0:\
  rdoq-level=1:\
  merange=50:\
  sao=0:\
  rect=0:\
  amp=0:\
  deblock=-2\\:-2 \
  -tag:v hvc1 -vsync 2 \
  -c:a libfdk_aac \
  -cutoff 18000 \
  -profile:a aac_he \
  -b:a 128k \
  -c:s mov_text \
  $i.mp4; done
Answers.UserDisplayName: salix
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-24T15:09:03.137Z
Answers.LastActivityDate: 2016-01-25T19:41:51.533Z
Answers.LastEditDate: 2016-01-25T19:41:51.533Z
Answers.UserDisplayName: Gyan
Answers.Body: <p>I thin <a href="http://www.videohelp.com/software/MKVtoolnix" rel="nofollow noreferrer">MKVtoolnix</a> is better and can help you get the result that you want.</p>
  
  <p><code>MKVtoolnix</code> is a set of tools to <strong>create</strong>, <strong>alter</strong>, <strong>split</strong>, <strong>join</strong> and <strong>inspect</strong> Matroska files(mkv). Use MKVCleaver or gMKVExtractGUI to extract/demultiplex mkv video and audio files. </p>
  
  <p><strong>Supported operating systems:</strong> Windows - Mac OS - Linux</p>
  
  <p><strong>Screenshot :</strong></p>
  
  <p><a href="https://i.sstatic.net/qcbic.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qcbic.jpg" alt="MKVtoolnix Version:8.8.0"></a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-25T18:59:30.777Z
Answers.Text: hm i write i need output in m4v and this tool can just mkv output ??
Answers.UserDisplayName: salix
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-25T19:05:19.477Z
Answers.Text: you can extract or add subtitle from/to mkv videos with it and many other things like extracting or creating chapters, extracting audio separately in a few seconds... try it and you'll see
Answers.UserDisplayName: MedK
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-25T17:15:44.367Z
Answers.LastActivityDate: 2016-01-25T17:15:44.367Z
Answers.UserDisplayName: MedK
Body: <p>I'm trying to convert a movie, using ffmpeg, from Movie.mkv to Movie.m4v. The Movie has 2 Languages and 1 subtitle stream.</p>
  
  <p>Using</p>
  
  <pre><code>ffmpeg -i inputMovie.mkv outputmovie.m4v
  </code></pre>
  
  <p>the result is just one audio and no soft subtitles.</p>
  
  <p>What should I use to keep both languages and the subtitle (to toggle On-off on streaming box)</p>
  
  <p>Thank you.</p>
  
  <p>The ffprobe from movie is:</p>
  
  <pre><code>ffprobe version 2.8.5 Copyright (c) 2007-2016 the FFmpeg developers
    built with Apple LLVM version 7.0.2 (clang-700.1.81)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.5 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5 --enable-nonfree --enable-vda
    libavutil      54. 31.100 / 54. 31.100
    libavcodec     56. 60.100 / 56. 60.100
    libavformat    56. 40.101 / 56. 40.101
    libavdevice    56.  4.100 / 56.  4.100
    libavfilter     5. 40.101 /  5. 40.101
    libavresample   2.  1.  0 /  2.  1.  0
    libswscale      3.  1.101 /  3.  1.101
    libswresample   1.  2.101 /  1.  2.101
    libpostproc    53.  3.100 / 53.  3.100
  Input #0, matroska,webm, from 'DasParfum.mkv':
    Metadata:
      encoder         : libmakemkv v1.9.9 (1.3.3/1.4.4) darwin(x86-release)
      creation_time   : 2016-01-22 21:40:23
    Duration: 02:21:28.44, start: 0.000000, bitrate: 5414 kb/s
      Chapter #0:0: start 0.000000, end 395.200000
      Metadata:
        title           : Chapter 01
      Chapter #0:1: start 395.200000, end 633.880000
      Metadata:
        title           : Chapter 02
      Chapter #0:2: start 633.880000, end 816.400000
      Metadata:
        title           : Chapter 03
      Chapter #0:3: start 816.400000, end 1031.680000
      Metadata:
        title           : Chapter 04
      Chapter #0:4: start 1031.680000, end 1294.280000
      Metadata:
        title           : Chapter 05
      Chapter #0:5: start 1294.280000, end 1593.800000
      Metadata:
        title           : Chapter 06
      Chapter #0:6: start 1593.800000, end 1928.680000
      Metadata:
        title           : Chapter 07
      Chapter #0:7: start 1928.680000, end 2262.000000
      Metadata:
        title           : Chapter 08
      Chapter #0:8: start 2262.000000, end 2598.960000
      Metadata:
        title           : Chapter 09
      Chapter #0:9: start 2598.960000, end 2845.960000
      Metadata:
        title           : Chapter 10
      Chapter #0:10: start 2845.960000, end 3193.320000
      Metadata:
        title           : Chapter 11
      Chapter #0:11: start 3193.320000, end 3427.320000
      Metadata:
        title           : Chapter 12
      Chapter #0:12: start 3427.320000, end 3652.480000
      Metadata:
        title           : Chapter 13
      Chapter #0:13: start 3652.480000, end 3966.560000
      Metadata:
        title           : Chapter 14
      Chapter #0:14: start 3966.560000, end 4235.920000
      Metadata:
        title           : Chapter 15
      Chapter #0:15: start 4235.920000, end 4531.280000
      Metadata:
        title           : Chapter 16
      Chapter #0:16: start 4531.280000, end 4796.480000
      Metadata:
        title           : Chapter 17
      Chapter #0:17: start 4796.480000, end 5003.960000
      Metadata:
        title           : Chapter 18
      Chapter #0:18: start 5003.960000, end 5383.040000
      Metadata:
        title           : Chapter 19
      Chapter #0:19: start 5383.040000, end 5708.040000
      Metadata:
        title           : Chapter 20
      Chapter #0:20: start 5708.040000, end 5943.080000
      Metadata:
        title           : Chapter 21
      Chapter #0:21: start 5943.080000, end 6212.960000
      Metadata:
        title           : Chapter 22
      Chapter #0:22: start 6212.960000, end 6488.560000
      Metadata:
        title           : Chapter 23
      Chapter #0:23: start 6488.560000, end 6734.000000
      Metadata:
        title           : Chapter 24
      Chapter #0:24: start 6734.000000, end 6951.880000
      Metadata:
        title           : Chapter 25
      Chapter #0:25: start 6951.880000, end 7214.480000
      Metadata:
        title           : Chapter 26
      Chapter #0:26: start 7214.480000, end 7466.680000
      Metadata:
        title           : Chapter 27
      Chapter #0:27: start 7466.680000, end 7756.840000
      Metadata:
        title           : Chapter 28
      Chapter #0:28: start 7756.840000, end 7935.200000
      Metadata:
        title           : Chapter 29
      Chapter #0:29: start 7935.200000, end 8488.440000
      Metadata:
        title           : Chapter 30
      Stream #0:0(eng): Video: mpeg2video (Main), yuv420p(tv, bt470bg), 720x576 [SAR 64:45 DAR 16:9], max. 7200 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
      Metadata:
        BPS-eng         : 4572420
        DURATION-eng    : 02:21:28.440000000
        NUMBER_OF_FRAMES-eng: 212211
        NUMBER_OF_BYTES-eng: 4851589546
        SOURCE_ID-eng   : 0100E0
        _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
        _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      Stream #0:1(ger): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
      Metadata:
        title           : Surround 5.1
        BPS-eng         : 448000
        DURATION-eng    : 02:21:28.416000000
        NUMBER_OF_FRAMES-eng: 265263
        NUMBER_OF_BYTES-eng: 475351296
        SOURCE_ID-eng   : 0180BD
        _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
        _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
      Metadata:
        title           : Surround 5.1
        BPS-eng         : 384000
        DURATION-eng    : 02:21:28.416000000
        NUMBER_OF_FRAMES-eng: 265263
        NUMBER_OF_BYTES-eng: 407443968
        SOURCE_ID-eng   : 0182BD
        _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
        _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      Stream #0:3(ger): Subtitle: dvd_subtitle, 720x576 (default)
      Metadata:
        BPS-eng         : 2188
        DURATION-eng    : 02:11:22.676977777
        NUMBER_OF_FRAMES-eng: 871
        NUMBER_OF_BYTES-eng: 2156572
        SOURCE_ID-eng   : 0120BD
        _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
        _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      Stream #0:4(ger): Subtitle: dvd_subtitle, 720x576
      Metadata:
        BPS-eng         : 2079
        DURATION-eng    : 02:10:36.918400000
        NUMBER_OF_FRAMES-eng: 839
        NUMBER_OF_BYTES-eng: 2037440
        SOURCE_ID-eng   : 0122BD
        _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
        _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  </code></pre>
  
Tags: <ffmpeg>
Title: ffmpeg Multiple Audio Language and Soft- Subtitle
UserDisplayName: salix
ThreadText: # ffmpeg Multiple Audio Language and Soft- Subtitle
  
  (Asked by: username_0 on 2016-01-24)
  
  I'm trying to convert a movie, using ffmpeg, from Movie.mkv to Movie.m4v. The Movie has 2 Languages and 1 subtitle stream.
  
  Using
  
  ```
  ffmpeg -i inputMovie.mkv outputmovie.m4v
  
  ```
  
  the result is just one audio and no soft subtitles.
  
  What should I use to keep both languages and the subtitle (to toggle On-off on streaming box)
  
  Thank you.
  
  The ffprobe from movie is:
  
  ```
  ffprobe version 2.8.5 Copyright (c) 2007-2016 the FFmpeg developers
    built with Apple LLVM version 7.0.2 (clang-700.1.81)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.5 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5 --enable-nonfree --enable-vda
    libavutil      54. 31.100 / 54. 31.100
    libavcodec     56. 60.100 / 56. 60.100
    libavformat    56. 40.101 / 56. 40.101
    libavdevice    56.  4.100 / 56.  4.100
    libavfilter     5. 40.101 /  5. 40.101
    libavresample   2.  1.  0 /  2.  1.  0
    libswscale      3.  1.101 /  3.  1.101
    libswresample   1.  2.101 /  1.  2.101
    libpostproc    53.  3.100 / 53.  3.100
  Input #0, matroska,webm, from 'DasParfum.mkv':
    Metadata:
      encoder         : libmakemkv v1.9.9 (1.3.3/1.4.4) darwin(x86-release)
      creation_time   : 2016-01-22 21:40:23
    Duration: 02:21:28.44, start: 0.000000, bitrate: 5414 kb/s
      Chapter #0:0: start 0.000000, end 395.200000
      Metadata:
        title           : Chapter 01
      Chapter #0:1: start 395.200000, end 633.880000
      Metadata:
        title           : Chapter 02
      Chapter #0:2: start 633.880000, end 816.400000
      Metadata:
        title           : Chapter 03
      Chapter #0:3: start 816.400000, end 1031.680000
      Metadata:
        title           : Chapter 04
      Chapter #0:4: start 1031.680000, end 1294.280000
      Metadata:
        title           : Chapter 05
      Chapter #0:5: start 1294.280000, end 1593.800000
      Metadata:
        title           : Chapter 06
      Chapter #0:6: start 1593.800000, end 1928.680000
      Metadata:
        title           : Chapter 07
      Chapter #0:7: start 1928.680000, end 2262.000000
      Metadata:
        title           : Chapter 08
      Chapter #0:8: start 2262.000000, end 2598.960000
      Metadata:
        title           : Chapter 09
      Chapter #0:9: start 2598.960000, end 2845.960000
      Metadata:
        title           : Chapter 10
      Chapter #0:10: start 2845.960000, end 3193.320000
      Metadata:
        title           : Chapter 11
      Chapter #0:11: start 3193.320000, end 3427.320000
      Metadata:
        title           : Chapter 12
      Chapter #0:12: start 3427.320000, end 3652.480000
      Metadata:
        title           : Chapter 13
      Chapter #0:13: start 3652.480000, end 3966.560000
      Metadata:
        title           : Chapter 14
      Chapter #0:14: start 3966.560000, end 4235.920000
      Metadata:
        title           : Chapter 15
      Chapter #0:15: start 4235.920000, end 4531.280000
      Metadata:
        title           : Chapter 16
      Chapter #0:16: start 4531.280000, end 4796.480000
      Metadata:
        title           : Chapter 17
      Chapter #0:17: start 4796.480000, end 5003.960000
      Metadata:
        title           : Chapter 18
      Chapter #0:18: start 5003.960000, end 5383.040000
      Metadata:
        title           : Chapter 19
      Chapter #0:19: start 5383.040000, end 5708.040000
      Metadata:
        title           : Chapter 20
      Chapter #0:20: start 5708.040000, end 5943.080000
      Metadata:
        title           : Chapter 21
      Chapter #0:21: start 5943.080000, end 6212.960000
      Metadata:
        title           : Chapter 22
      Chapter #0:22: start 6212.960000, end 6488.560000
      Metadata:
        title           : Chapter 23
      Chapter #0:23: start 6488.560000, end 6734.000000
      Metadata:
        title           : Chapter 24
      Chapter #0:24: start 6734.000000, end 6951.880000
      Metadata:
        title           : Chapter 25
      Chapter #0:25: start 6951.880000, end 7214.480000
      Metadata:
        title           : Chapter 26
      Chapter #0:26: start 7214.480000, end 7466.680000
      Metadata:
        title           : Chapter 27
      Chapter #0:27: start 7466.680000, end 7756.840000
      Metadata:
        title           : Chapter 28
      Chapter #0:28: start 7756.840000, end 7935.200000
      Metadata:
        title           : Chapter 29
      Chapter #0:29: start 7935.200000, end 8488.440000
      Metadata:
        title           : Chapter 30
      Stream #0:0(eng): Video: mpeg2video (Main), yuv420p(tv, bt470bg), 720x576 [SAR 64:45 DAR 16:9], max. 7200 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
      Metadata:
        BPS-eng         : 4572420
        DURATION-eng    : 02:21:28.440000000
        NUMBER_OF_FRAMES-eng: 212211
        NUMBER_OF_BYTES-eng: 4851589546
        SOURCE_ID-eng   : 0100E0
        _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
        _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      Stream #0:1(ger): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
      Metadata:
        title           : Surround 5.1
        BPS-eng         : 448000
        DURATION-eng    : 02:21:28.416000000
        NUMBER_OF_FRAMES-eng: 265263
        NUMBER_OF_BYTES-eng: 475351296
        SOURCE_ID-eng   : 0180BD
        _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
        _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
      Metadata:
        title           : Surround 5.1
        BPS-eng         : 384000
        DURATION-eng    : 02:21:28.416000000
        NUMBER_OF_FRAMES-eng: 265263
        NUMBER_OF_BYTES-eng: 407443968
        SOURCE_ID-eng   : 0182BD
        _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
        _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      Stream #0:3(ger): Subtitle: dvd_subtitle, 720x576 (default)
      Metadata:
        BPS-eng         : 2188
        DURATION-eng    : 02:11:22.676977777
        NUMBER_OF_FRAMES-eng: 871
        NUMBER_OF_BYTES-eng: 2156572
        SOURCE_ID-eng   : 0120BD
        _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
        _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
      Stream #0:4(ger): Subtitle: dvd_subtitle, 720x576
      Metadata:
        BPS-eng         : 2079
        DURATION-eng    : 02:10:36.918400000
        NUMBER_OF_FRAMES-eng: 839
        NUMBER_OF_BYTES-eng: 2037440
        SOURCE_ID-eng   : 0122BD
        _STATISTICS_WRITING_APP-eng: MakeMKV v1.9.9 darwin(x86-release)
        _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-22 21:40:23
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
  
  ```
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-01-24. Score: 3
  
  Try
  
  ```
  ffmpeg -i inputMovie.mkv -c copy -map 0 outputmovie.m4v
  
  ```
  
  Depending on the subtitle format, they may not get copied over. In which case,
  
  ```
  ffmpeg -i inputMovie.mkv -c copy -c:s mov_text -map 0 outputmovie.m4v
  
  ```
  
  **Edit**: Once you have a text-based subtitle format like SRT or ASS, you can use
  
  ```
  ffmpeg -i inputMovie.mkv -i subtitle.srt -c copy -c:s mov_text -map 0:v -map 0:a -map 1 outputmovie.m4v
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you for quick response, but they dont work ! In First one I become error: Could not write header for output file #0 (incorrect codec parameters : invalid argument. And for second i become:Error while opening encoder for output stream #0:3 - maybe incorrect parameters such as bit_rate, rate, width or height !!  
  > **username_1**: Paste the readout of `ffprobe inputmovie.mkv` into your question.  
  > **username_1**: Your subtitles are image-based and need to be converted to a text-based format like SRT. Once done, you can use the revised 2nd command. Use [Subtitle Edit](http://www.videohelp.com/software/Subtitle-Edit) to import from MKV.  
  > **username_0**: i try it to do with 3 code (after the srt was exported - or downloaded) and i become again error message: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument  
  > **username_1**: Paste the readout of ffprobe srt into your question.  
  > **username_0**: that's the solution: "Edit: Once you have a text-based subtitle format like SRT or ASS, you can use": ffmpeg -i inputMovie.mkv -i subtitle.srt -c copy -c:s mov_text -map 0:v -map 0:a -map 1 outputmovie.m4v  
  > **username_0**: now i do it with h265 and it is work; for i in *.mkv; do ffmpeg -i $i -map 0 \ -c:v libx265 \ -preset medium -x265-params crf=20:\ qcomp=0.7:\ ctu=32:\ max-tu-size=16:\ aq-mode=1:\ aq-strength=1.0:\ qg-size=16:\ psy-rd=0.7:\ psy-rdoq=5.0:\ rdoq-level=1:\ merange=50:\ sao=0:\ rect=0:\ amp=0:\ deblock=-2\\:-2 \ -tag:v hvc1 -vsync 2 \ -c:a libfdk_aac \ -cutoff 18000 \ -profile:a aac_he \ -b:a 128k \ -c:s mov_text \ $i.mp4; done  
  
  ---
  
  ### Answer by username_2 on 2016-01-25. Score: 0
  
  I thin [MKVtoolnix](http://www.videohelp.com/software/MKVtoolnix) is better and can help you get the result that you want.
  
  `MKVtoolnix` is a set of tools to **create**, **alter**, **split**, **join** and **inspect** Matroska files(mkv). Use MKVCleaver or gMKVExtractGUI to extract/demultiplex mkv video and audio files.
  
  **Supported operating systems:** Windows - Mac OS - Linux
  
  **Screenshot :**
  
  [![MKVtoolnix Version:8.8.0](https://i.sstatic.net/qcbic.jpg)](https://i.sstatic.net/qcbic.jpg)
  
  > **Comments:**
  > **username_0**: hm i write i need output in m4v and this tool can just mkv output ??  
  > **username_2**: you can extract or add subtitle from/to mkv videos with it and many other things like extracting or creating chapters, extracting audio separately in a few seconds... try it and you'll see  
  
  ---
  
  