<p>Muxing a file simply means to extract individual streams out of existing container files or mix existing streams together into a new container file. For MP4, this can be done with ffmpeg and the <code>-c copy</code> switch. If you don't want to write command line inputs, <a href="https://www.xmedia-recode.de/" rel="nofollow noreferrer">XMedia Recode</a> is a good, free GUI for ffmpeg (<em>only available for Windows</em>). There's a documentation on the website, simply select <em>Direct Stream Copy</em> to avoid reencoding the individual streams.</p>

CC BY-SA 3.0
2017-03-16T04:13:46.053Z
Can you point me to where is Direct Stream Copy? Can't find that function you're mentioning. Thanks!
Julius Alfeche
CC BY-SA 3.0
2017-03-16T12:46:48.823Z
@JuliusAlfeche That exact phrase was taken from the website (see link). To copy a stream instead of converting it, load a file in the program, open the respective tab (video/audio) and set the *Mode* dropdown to *Copy*
MoritzLost
CC BY-SA 4.0
2020-12-07T08:58:22.707Z
XMedia Recode is **NOT** available for Linux. That link is dead.
cipricus
CC BY-SA 4.0
2020-12-07T09:31:02.087Z
@cipricus Thanks for the note, I've updated the link and added a note that it's only available for Windows.
MoritzLost
CC BY-SA 4.0
2017-03-15T14:56:33.827Z
2020-12-07T09:29:23.510Z
2020-12-07T09:29:23.510Z
MoritzLost
<p>I just went through a very similar use-case working with TS files.  MoritzLost has the key point but as <code>ffmpeg</code> options can be quite difficult to sort out when you are first getting started, here is a more detailed answer.</p>
<h1>Short Answer</h1>
<p>For a single input mp4 file and single input SRT file, we can keep all streams from both files and merge them into a new mp4 container (only transcoding the subtitle stream...ie lossless on the audio/video) like this:</p>
<pre><code>ffmpeg 
    -i input.mp4 \
    -i subtitle.srt \
    -map 0 \
    -map 1 \
    -codec copy \
    -scodec mov_text \
    output.mp4
</code></pre>
<p>If you have unknown stream types, multiple subtitle streams, or other things going on then this may not work and you might need to revise the options.</p>
<h1>MP4 vs MKV container - limitations of mp4</h1>
<p>You should know that the MP4 container does not support embedded <code>srt</code> (subrip) streams.  It only supports <code>mov_text</code> for soft-subs.  So we have to transcode the SRT to <code>mov_text</code> or use hard-coded subs (where the subtitle text is encoded into the video stream directly and cannot be turned off).</p>
<p>This is one of the reasons that I prefer the <code>mkv</code> container format over <code>mp4</code>.  It allows me to easily maintain multiple audio and subtitle streams with many different formats all within a single file (keep everything together).  Yes overall file size is larger for people that don't care about those extra audio/subs... but I don't share over the network and hard-disk space is cheap.</p>
<p>Plex and VLC and most other modern media players have no trouble with MKV right out of the box...so something to think about whether you really want to use mp4 if you are someone that cares about soft-subtitles and keeping everything together (single file).</p>
<h1>ffmpeg</h1>
<p><code>ffmpeg</code> is a very powerful free/opensource tool.  The command line options can be confusing but once you understand how to use the <code>-map</code> and <code>-codec</code> options, you can already do a lot.  If you are semi-technical and do lots of video work it is worth learning how to use the command line on your OS and how to use tools like this.  Windows Services for Linux makes this easier than ever for windows users on Windows 10.  For Mac/Linux it has always been easy to install and run these tools.</p>
<h1>How to mux multiple inputs into a single mp4 container</h1>
<p>The following would take an input <code>mp4</code> (or other) file and a second <code>srt</code> input file, take all streams from both files and mux them into a new output.mp4 file.  We tell <code>ffmpeg</code> to copy the audio/video streams (no transcoding or quality loss) and to convert any subtitle streams into <code>mov_text</code> since that is the only type that <code>mp4</code> container supports.</p>
<pre><code>ffmpeg 
    -i input.mp4 \
    -i subtitle.srt \
    -map 0 \
    -map 1 \
    -codec copy \
    -scodec mov_text \
    output.mp4
</code></pre>
<p>Depending on how you run this on windows, the <code>\</code> to continue the command on the next line may not work and you may need to remove the backslashes and condense the command into one without newlines.</p>
<p>Again but with comments explaining the options.</p>
<pre><code>ffmpeg \
    -i input.mp4 \          # first input file (index 0)
    -i subtitle.srt \       # second input file (index 1)
    -map 0 \                # select all streams from first input file
    -map 1 \                # select all streams from second input file
    -codec copy \           # copy audio/video streams (no transcode)
    -scodec mov_text \      # transcode all subtitle streams to type mov_text
    output.mp4              # name of output file
</code></pre>
<p>Running this command will show you output something like the following for a simple input <code>mp4</code> with a single audio and video stream.</p>
<pre><code>...
Stream mapping:
  Stream #0:0 -&gt; #0:0 (copy)
  Stream #0:1 -&gt; #0:1 (copy)
  Stream #1:0 -&gt; #0:2 (subrip (srt) -&gt; mov_text (native))
...
</code></pre>
<p>You can see it copies the first two streams (audio/video) from input <code>0</code> (the first input) and does a conversion on the third stream from input <code>1</code> (the second input...the srt file).</p>
<h1>Alternatively, go from MP4+SRT to MKV with mkvtoolnix</h1>
<p>If you aren't opposed to MKV containers, then there is no reason you can't just take the input mp4 and separate subtitle file and mux all the streams into a new MKV file instead.  This would also keep the SRT as an SRT and not transcode it into <code>mov_text</code>.</p>
<p>Remember MP4 and MKV are just &quot;containers&quot; and so you can copy around the video/audio/subtitle streams from inside these containers without any transcoding (loss of data/quality)...as long as the destination container type supports that stream's codec.</p>
<pre><code>mkvmerge \
    --output output.mkv \
    input.mp4 \
    subtitle.srt
</code></pre>
<p>In this case, because we are taking all streams from the input files and <code>mkvmerge</code> doesn't do any transcoding, the command is much simpler.</p>
<p>If it was me with your use-case I would just go to <code>mkv</code> unless you are trying to build a file for a player that only supports mp4 and don't have any other option (ie get a different player).</p>
<h1>References</h1>
<p><a href="https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/subtitle_options#Set_Subtitle_Codec" rel="nofollow noreferrer">https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/subtitle_options#Set_Subtitle_Codec</a></p>

CC BY-SA 4.0
2020-12-05T12:27:32.563Z
2020-12-05T12:27:32.563Z
mattpr
<p><a href="https://dmsimpleapps.blogspot.com/2014/04/dmmediaconverter.html" rel="nofollow noreferrer">dmMediaConverter</a> is very similar to MKVToolnix.</p>

<p>It is just a <code>ffmpeg</code> gui, so it can save in any format.</p>

<p><a href="https://i.sstatic.net/p4Ntb.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/p4Ntb.png" alt="enter image description here"></a></p>

<p>To replicate the described MKVToolnix use, select "Convert", then "Add files", selecting both video and subtitles.</p>

<p>Check "Enabled" to keep the stream, uncheck to remove it.</p>

<p>Check "Copy" to keep the stream as it is, uncheck  to trasnscode it.</p>

CC BY-SA 4.0
2020-04-08T21:16:24.407Z
2020-04-08T21:16:24.407Z
cipricus
<p>Good day! I'm looking for <a href="https://mkvtoolnix.download/downloads.html" rel="noreferrer">MKVToolNix</a> equivalent software for .MP4's. I will use it in a video file without subtitles, I'll find it's subtitle and merge it with the video file just like what I did in MKVToolNix. Thanks!</p>

CC BY-SA 3.0
2017-08-02T10:27:07.793Z
I needed the same thing. I couldnt find, and contacted them, and asked to add ability to "bake" the result in "mp4" too, not only in mkv..
T.Todua
CC BY-SA 3.0
2017-08-02T10:41:06.697Z
waiting their answer.. till that, i've found nice topic here - https://forum.videohelp.com/threads/382060-I-want-a-software-which-converts-mkv-to-mp4-without-reencoding
T.Todua
<mp4><subtitles><mkv>
MKVToolNix equivalent for .MP4's
Julius Alfeche
# MKVToolNix equivalent for .MP4's

(Asked by: username_0 on 2017-03-15)

Good day! I'm looking for [MKVToolNix](https://mkvtoolnix.download/downloads.html) equivalent software for .MP4's. I will use it in a video file without subtitles, I'll find it's subtitle and merge it with the video file just like what I did in MKVToolNix. Thanks!

**Tags:** mp4, subtitles, mkv

> **Comments:**
> **username_1**: I needed the same thing. I couldnt find, and contacted them, and asked to add ability to "bake" the result in "mp4" too, not only in mkv..  
> **username_1**: waiting their answer.. till that, i've found nice topic here - https://forum.videohelp.com/threads/382060-I-want-a-software-which-converts-mkv-to-mp4-without-reencoding  

---

## 3 answers

### Answer by username_2 on 2017-03-15. Score: 2 | Accepted answer

Muxing a file simply means to extract individual streams out of existing container files or mix existing streams together into a new container file. For MP4, this can be done with ffmpeg and the `-c copy` switch. If you don't want to write command line inputs, [XMedia Recode](https://www.xmedia-recode.de/) is a good, free GUI for ffmpeg (*only available for Windows*). There's a documentation on the website, simply select *Direct Stream Copy* to avoid reencoding the individual streams.

> **Comments:**
> **username_0**: Can you point me to where is Direct Stream Copy? Can't find that function you're mentioning. Thanks!  
> **username_2**: @JuliusAlfeche That exact phrase was taken from the website (see link). To copy a stream instead of converting it, load a file in the program, open the respective tab (video/audio) and set the *Mode* dropdown to *Copy*  
> **username_3**: XMedia Recode is **NOT** available for Linux. That link is dead.  
> **username_2**: @username_3 Thanks for the note, I've updated the link and added a note that it's only available for Windows.  

---

### Answer by username_4 on 2020-12-05. Score: 4

I just went through a very similar use-case working with TS files.  username_2 has the key point but as ffmpeg options can be quite difficult to sort out when you are first getting started, here is a more detailed answer.
Short Answer
For a single input mp4 file and single input SRT file, we can keep all streams from both files and merge them into a new mp4 container (only transcoding the subtitle stream...ie lossless on the audio/video) like this:
ffmpeg 
    -i input.mp4 \
    -i subtitle.srt \
    -map 0 \
    -map 1 \
    -codec copy \
    -scodec mov_text \
    output.mp4

If you have unknown stream types, multiple subtitle streams, or other things going on then this may not work and you might need to revise the options.
MP4 vs MKV container - limitations of mp4
You should know that the MP4 container does not support embedded srt (subrip) streams.  It only supports mov_text for soft-subs.  So we have to transcode the SRT to mov_text or use hard-coded subs (where the subtitle text is encoded into the video stream directly and cannot be turned off).
This is one of the reasons that I prefer the mkv container format over mp4.  It allows me to easily maintain multiple audio and subtitle streams with many different formats all within a single file (keep everything together).  Yes overall file size is larger for people that don't care about those extra audio/subs... but I don't share over the network and hard-disk space is cheap.
Plex and VLC and most other modern media players have no trouble with MKV right out of the box...so something to think about whether you really want to use mp4 if you are someone that cares about soft-subtitles and keeping everything together (single file).
ffmpeg
ffmpeg is a very powerful free/opensource tool.  The command line options can be confusing but once you understand how to use the -map and -codec options, you can already do a lot.  If you are semi-technical and do lots of video work it is worth learning how to use the command line on your OS and how to use tools like this.  Windows Services for Linux makes this easier than ever for windows users on Windows 10.  For Mac/Linux it has always been easy to install and run these tools.
How to mux multiple inputs into a single mp4 container
The following would take an input mp4 (or other) file and a second srt input file, take all streams from both files and mux them into a new output.mp4 file.  We tell ffmpeg to copy the audio/video streams (no transcoding or quality loss) and to convert any subtitle streams into mov_text since that is the only type that mp4 container supports.
ffmpeg 
    -i input.mp4 \
    -i subtitle.srt \
    -map 0 \
    -map 1 \
    -codec copy \
    -scodec mov_text \
    output.mp4

Depending on how you run this on windows, the \ to continue the command on the next line may not work and you may need to remove the backslashes and condense the command into one without newlines.
Again but with comments explaining the options.
ffmpeg \
    -i input.mp4 \          # first input file (index 0)
    -i subtitle.srt \       # second input file (index 1)
    -map 0 \                # select all streams from first input file
    -map 1 \                # select all streams from second input file
    -codec copy \           # copy audio/video streams (no transcode)
    -scodec mov_text \      # transcode all subtitle streams to type mov_text
    output.mp4              # name of output file

Running this command will show you output something like the following for a simple input mp4 with a single audio and video stream.
...
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #1:0 -> #0:2 (subrip (srt) -> mov_text (native))
...

You can see it copies the first two streams (audio/video) from input 0 (the first input) and does a conversion on the third stream from input 1 (the second input...the srt file).
Alternatively, go from MP4+SRT to MKV with mkvtoolnix
If you aren't opposed to MKV containers, then there is no reason you can't just take the input mp4 and separate subtitle file and mux all the streams into a new MKV file instead.  This would also keep the SRT as an SRT and not transcode it into mov_text.
Remember MP4 and MKV are just "containers" and so you can copy around the video/audio/subtitle streams from inside these containers without any transcoding (loss of data/quality)...as long as the destination container type supports that stream's codec.
mkvmerge \
    --output output.mkv \
    input.mp4 \
    subtitle.srt

In this case, because we are taking all streams from the input files and mkvmerge doesn't do any transcoding, the command is much simpler.
If it was me with your use-case I would just go to mkv unless you are trying to build a file for a player that only supports mp4 and don't have any other option (ie get a different player).
References
https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/subtitle_options#Set_Subtitle_Codec


---

### Answer by username_3 on 2020-04-08. Score: 2

[dmMediaConverter](https://dmsimpleapps.blogspot.com/2014/04/dmmediaconverter.html) is very similar to MKVToolnix.

It is just a `ffmpeg` gui, so it can save in any format.

[![enter image description here](https://i.sstatic.net/p4Ntb.png)](https://i.sstatic.net/p4Ntb.png)

To replicate the described MKVToolnix use, select "Convert", then "Add files", selecting both video and subtitles.

Check "Enabled" to keep the stream, uncheck to remove it.

Check "Copy" to keep the stream as it is, uncheck to trasnscode it.


---

