Thread: [Video] Preparing an MKV file for editing (Windows/Mac/Linux)

Results 1 to 5 of 5
  1. #1 [Video] Preparing an MKV file for editing (Windows/Mac/Linux) 
    SWAG ME OUT Ace Domenica's Avatar
    Join Date
    Apr 2012
    Location
    Washington
    Posts
    20
    So you got a fandub or an AMV planned and you got all your resources together. You have the videos you want to use, sound effects, lines and whatnot.

    However, your video is in an MKV format. A lot of video editors, even the really expensive ones, cannot open an MKV file. Also, your video contains those pesky subtitles and you don't want to crop out precious video.



    Windows Tutorial

    In this tutorial, I will show how to change an MKV file to an MP4 file without converting under the right conditions.

    The conditions are:
    • The video must be encoded in the H.264 standard. (Also called MPEG-4 Part 10 or AVC)
    • The audio must be an MPEG standard. (MP2, MP3, AAC, etc.)
    • The video needs to be softsubbed, meaning you're able to turn it on and off in the player settings.


    The main goal is to go through as little transcoding processes as we can. The less transcodes, the less degradation on the video/audio quality.

    However, if your MKV file does not have a video encoded in the H.264 standard or audio tracks encoded in an MPEG standard, then don't worry. We'll just have to go through a couple more steps. But if your video is hardsubbed, then you're out of luck.

    In order to check, open up VLC player, play your video and check the codec information.



    We see that this file has an H.264 video stream, two AAC audio streams, and two subtitle streams. Perfect, this video will not go through a conversion process.

    First, you must download this program: MkvToMp4
    You do not have to install it. Just extract the folder to wherever you like. NOTE: It is recommended that you have QuickTime installed, but for my purposes I won't need it. It is used for converting the audio streams. If you have Windows XP, you will need the Microsoft Visual C++ 2008 Redistributable Package, or else the program won't run.



    ----------
    Next, add the video you want to change by clicking "Add", or dragging and dropping.



    It should list what's in the file. Now check/uncheck the streams you want/don't need.

    ----------
    Now go to "Setup" and choose an output destination. Click "Save" and you're ready to go.



    ----------
    However, if your video needs to be re-encoded, then this program will do it for you. Instead of clicking save, go to the "Audio" tab. Pick whatever settings you like. (NOTE: This is where that QuickTime thing kicks in.)



    ----------
    Same thing for the video. Click on the "Video" tab and choose a preset.



    If you're picky about video quality, you can customize the presets and input your own parameters using the textbox.



    ----------
    Once you are ready, save and click "Start". It'll prompt you to "Start the process?" Just click yes. Depending on the video you have, the program will either start demuxing and muxing your video or converting it.



    ----------
    When that's done, you will get another prompt.



    If you're converting, this process will take a lot longer. Go ahead and close the program (which will prompt you AGAIN).

    ----------
    If everything goes well, you will have a nice MP4 file waiting to be edited.



    And VOILA!



    Your video is now editable and subtitle-less.

    And if we look at the codec information...



    We only have one audio stream and no subtitles.

    If you still have questions, post 'em and I'll try to answer them as best as I can.

    ----------
    Mac/Linux Tutorial

    It is still possible to do all this without a Windows machine, but the process is a bit more difficult. You will need two programs: mkvtoolnix and MP4Box. I'll be using the gpac package which comes with MP4Box. However, gpac needs to be complied so if you don't know how compile, then you have a couple options depending on your operating system. Linux users can just type in "apt-get install gpac". Mac users can use an already compiled standalone MP4Box program. Once you've got those programs, get ready because this process is Terminal-heavy.

    I am using Ubuntu, so your commands may be different from mine.

    ----------
    The first tool (or toolset in this case) we're going to use is mkvtoolnix. Open up Terminal and change the directory to wherever your video is. It's best if you rename your video to something less complicated. I renamed mine EoE.mkv

    Next, type in this command:
    Code:
    mkvmerge -i video.mkv
    Of course, replace 'video.mkv' with the file name of your file.



    This will identify the IDs of the individual tracks. We can see here that #1 is the video, #2 is an audio track, and so on.

    ----------
    Now, pick which tracks you want to extract.



    Use this command as a guideline:
    Code:
    mkvextract tracks "input.mkv" 1:"video.h264" 2:"audio.aac"
    The reason I'm not using .mp4 for the video and .m4a for the audio is because MP4Box will think your streams are corrupted. So you're going to have to use the codec extension. (e.g., DivX=.divx, XviD=.xvid...)

    The good thing about this method is if you have a video that's MPEG-4 Part 2 (DivX, XviD), MPEG-2, or MPEG-1 encoded, then you're in luck. Since they are an MPEG standard, they will fit in an MP4 file container. You are not forced to convert your video into H.264 exclusively.

    ----------
    Once it is done extracting, you should have two new files (or however many you extracted) inside the directory.

    Now we are going to use MP4Box, so clear all that previous junk from the terminal.



    Use this as a guide line:
    Code:
    MP4Box -add "video.h264":fps=x -add "audio.aac" "output.mp4"
    You need to specify the framerate of your video or MP4Box will choose for you. More often than not, MP4Box is usually wrong. If you don't specify the right framerate, then your audio and video streams will be out of sync.

    So no rounding.

    ----------
    If everything goes right, you should have a nice MP4 file.



    For Mac and Linux users, sorry there isn't an easier way to do this. If you find an easier way, please post them.
    Last edited by Ace Domenica; 04-14-2012 at 08:07 AM. Reason: Finished Mac/Linux tutorial.
    Reply With Quote  
     

  2. #2 Re: [Video] Preparing an MKV file for editing 
    あいしてる。 ~ChibiSammii's Avatar
    Join Date
    Mar 2011
    Location
    New York
    Posts
    1,753
    Blog Entries
    13
    This is JUST what I need, since my other converter's screwing up the video and adjusting the colors for some reason ^^ Do you know if this works on the Mac ?

    Available for Scouting?: Maybe. Contact me about it.
    Reply With Quote  
     

  3. #3 Re: [Video] Preparing an MKV file for editing 
    SWAG ME OUT Ace Domenica's Avatar
    Join Date
    Apr 2012
    Location
    Washington
    Posts
    20
    Sorry, Windows only. I have no experience with Macs, but I heard that this process is A LOT more harder. I know the programs compatible with Mac is mkvtoolnix and MP4Box, but I don't know how to work MP4Box yet. They are both cross-platform, so the processes for Windows and Mac should be similar. If I can figure it out, I'll add a Mac portion to the tutorial.

    The important thing you need is a video de/multiplexer, also called a muxer. I'm sure there are some muxers for Mac.

    EDIT: Here is the MKVtoolnix specifically for Mac.
    Last edited by Ace Domenica; 04-12-2012 at 08:50 PM. Reason: Adding to tutorial for Mac
    Reply With Quote  
     

  4. #4 Re: [Video] Preparing an MKV file for editing 
    あいしてる。 ~ChibiSammii's Avatar
    Join Date
    Mar 2011
    Location
    New York
    Posts
    1,753
    Blog Entries
    13
    Darn, okay DX Guess I'll just play around with those programs myself~

    Available for Scouting?: Maybe. Contact me about it.
    Reply With Quote  
     

  5. #5 Re: [Video] Preparing an MKV file for editing 
    SWAG ME OUT Ace Domenica's Avatar
    Join Date
    Apr 2012
    Location
    Washington
    Posts
    20
    I got a Mac/Linux portion up, but it's a bit more complicated. And since I don't have a Mac or Linux machine, I'm kinda weary on how well this will work so someone's gonna have to tell me.

    EDIT: I redid it with using Linux, so it should be a little bit more easier to follow. Hopefully.
    Last edited by Ace Domenica; 04-14-2012 at 08:12 AM.
    Reply With Quote  
     

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •