A Script to Remux MKV Videos Into MP4 Videos
I’ve written a script that dumps the audio and video from an mkv file, encodes the audio into a two channel AAC stream, and remuxes the audio/video into a MP4 wrapper so it’s playable on the Xbox 360. The script is Linux-only, obviously, written in bash using mplayer, normalize-audio, mencoder, MP4Box, mkvinfo, and mkvextract as tools.
It works pretty well:
phil@philDesktop:~/videos$ time reMuxToMP4 test.mkv
[x] reMuxToMP4 script, v0.5.0, written by jexxie
[x] Contact at: http://ubuntuforums.org/member.php?u=207388
[x] Source filename: test.mkv
[x] Destination filename: test.mp4
[x] Video stream found, 1280 x 720 @ 23.976 fps, using ffh264
[x] Audio stream found, 6 audio channels, using a52
[x] Muxed in mkv format
[x] Dumping the audio…success
[x] Normalizing the audio…success
[x] Encoding the audio to low-complexity AAC…success
[x] Extracting audio from MP4 container (silly neroAacEnc)…success
[x] Extracting the video from the mkv…success
[x] Muxing video at 23.976 fps…success
[x] Deleting audio and video tempfiles…success
[o] All done!
real 8m21.845s
user 3m58.467s
sys 0m39.446s
Here’s a link to the source:
remuxtomp4





4 Comments
Hi.
First thanks for your great job, and i would like to ask you a trouble that i’m havin’g with your script. When i try to executa it by sh remuxtomp4.sh i get the followin error:
: not foundsh: 2:
: not foundsh: 7:
: not foundsh: 12:
: not foundsh: 15:
: not foundsh: 17:
: not foundsh: 19:
: not foundsh: 22:
: not foundsh: 24:
remuxtomp4.sh: 76: Syntax error: “}” unexpected (expecting “then”)
and if i do ./remuxtomp4.sh:
bash: ./remuxtomp4.sh: /bin/bash^M: intérprete incorrecto: No existe el fichero ó directorio
.
I have to put it in /usr/local/bin/ witw the same results.
O don’t know what to do.
I’ m using ubuntu 8.04 and i’ve looked a lot on google and ubuntu forums. Can you help me?
thanks a lot
Please try again, the script was in DOS format for some reason.
Cheers
Thanks! I love the script (it’s so very convenient). It doesn’t work with subtitles, but for all my other videos it’s perfect! I’m going to try and see if I can remux the subtitles into it on my own, and if I can I’ll post my results.
Thanks! This script is great (it’s so very convenient)! It doesn’t do subtitles, but I’ll try to patch it and if successful I’ll post my results.