Results 1 to 10 of 10

Thread: .mkv to .mp4 remux - mkvextract and mp4box?

  1. #1
    Join Date
    Nov 2008
    Location
    San Francisco, California
    Beans
    389
    Distro
    Ubuntu 12.04 Precise Pangolin

    .mkv to .mp4 remux - mkvextract and mp4box?

    Can someone please post a simple guide for converting .mkv to .mp4 without re-encoding? I have tried a process that FakeOutdoorsman outlined for me with ffmpeg, but it failed (apparently ffmpeg has problems with .mkv), and I tried following this guide, but the script caused the video to turn out really poor, lots of pixellation:

    http://ubuntuforums.org/showthread.p...extract+mp4box

    If someone can help, I would really appreciate it.

    Thanks!

  2. #2
    Join Date
    Sep 2006
    Beans
    3,578

    Re: .mkv to .mp4 remux - mkvextract and mp4box?

    What errors did FFmpeg give? Show your complete FFmpeg command and the full FFmpeg output.

  3. #3
    Join Date
    Dec 2005
    Location
    St. Petersburg, FL
    Beans
    532
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Re: .mkv to .mp4 remux - mkvextract and mp4box?

    Code:
    mkvextract tracks "video.mkv" 1:"video.h264" 2:"audio.aac" 3:"subtitles.srt"
    (change 1:, 2:, and 3: as needed - 1: is not always video, or not always H.264, 2: is not always audio or AAC, there might not be any subs at all, etc.)

    Code:
    mp4box -add "video.h264":fps=X -add "audio.aac" "output.mp4"
    (substituting the actual framerate for X)



    This is assuming, of course, that you have both mkvextract and mp4box installed.

  4. #4
    Join Date
    Nov 2008
    Location
    San Francisco, California
    Beans
    389
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: .mkv to .mp4 remux - mkvextract and mp4box?

    Quote Originally Posted by FakeOutdoorsman View Post
    What errors did FFmpeg give? Show your complete FFmpeg command and the full FFmpeg output.
    Thanks, here is the info:

    Code:
    nixie@lion:~/Videos$ ffmpeg -i battlestar.galactica.s01e01.720p.mkv -vcodec copy -acodec libfaac -ab 128k -vframes 300 output.mp4
    FFmpeg version SVN-r19439, Copyright (c) 2000-2009 Fabrice Bellard, et al.
      configuration: --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab
      libavutil     50. 3. 0 / 50. 3. 0
      libavcodec    52.32. 0 / 52.32. 0
      libavformat   52.36. 0 / 52.36. 0
      libavdevice   52. 2. 0 / 52. 2. 0
      libswscale     0. 7. 1 /  0. 7. 1
      built on Jul 15 2009 18:44:42, gcc: 4.3.2
    
    Seems stream 0 codec frame rate differs from container frame rate: 47.95 (48000/1001) -> 23.98 (24000/1001)
    Input #0, matroska, from 'battlestar.galactica.s01e01.720p.mkv':
      Duration: 00:44:35.93, start: 0.000000, bitrate: N/A
        Stream #0.0(eng): Video: h264, yuv420p, 1280x720, PAR 1:1 DAR 16:9, 23.98 tbr, 1k tbn, 47.95 tbc
        Stream #0.1(eng): Audio: ac3, 48000 Hz, 6 channels, s16
    Output #0, mp4, to 'output.mp4':
        Stream #0.0(eng): Video: libx264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=2-31, 1k tbn, 1k tbc
        Stream #0.1(eng): Audio: aac, 48000 Hz, 6 channels, s16, 128 kb/s
    Stream mapping:
      Stream #0.0 -> #0.0
      Stream #0.1 -> #0.1
    Press [q] to stop encoding
    [NULL @ 0x1e55700]error, non monotone timestamps 167 >= 83
    av_interleaved_write_frame(): Error while opening file
    nixie@lion:~/Videos$ ls
    battlestar.galactica.s01e01.720p.mkv  output.mp4  remuxmkv.sh
    nixie@lion:~/Videos$ ffmpeg -i output.mp4
    FFmpeg version SVN-r19439, Copyright (c) 2000-2009 Fabrice Bellard, et al.
      configuration: --enable-gpl --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab
      libavutil     50. 3. 0 / 50. 3. 0
      libavcodec    52.32. 0 / 52.32. 0
      libavformat   52.36. 0 / 52.36. 0
      libavdevice   52. 2. 0 / 52. 2. 0
      libswscale     0. 7. 1 /  0. 7. 1
      built on Jul 15 2009 18:44:42, gcc: 4.3.2
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x1d4e370]moov atom not found
    output.mp4: Error while opening file
    qyot27 - thanks for the commands! I will try them.. I think the packages are mkvtoolsnix and gpac, correct?

  5. #5
    Join Date
    Dec 2005
    Location
    St. Petersburg, FL
    Beans
    532
    Distro
    Ubuntu 14.10 Utopic Unicorn

    Re: .mkv to .mp4 remux - mkvextract and mp4box?

    For mkvtoolnix I would recommend going and adding the official repo so that you're using the most up-to-date version:
    http://www.bunkus.org/videotools/mkv...ds.html#ubuntu

    Make sure to snag the GPG key so that it doesn't complain when you go to update the listings.

    As far as GPAC goes, I compiled and installed that from source, but I assume so.

  6. #6
    Join Date
    Dec 2006
    Beans
    7,178

    Re: .mkv to .mp4 remux - mkvextract and mp4box?

    Hi qyot27,

    Wooo hoooo I am famous . Just saw my name as the other packager for Slackware package of mkvtoolnix!

    Andrew
    You think that's air you're breathing now?

  7. #7
    Join Date
    Sep 2006
    Beans
    3,578

    Re: .mkv to .mp4 remux - mkvextract and mp4box?

    Quote Originally Posted by Nixie Pixel View Post
    Thanks, here is the info:

    [CODE][NULL @ 0x1e55700]error, non monotone timestamps 167 >= 83
    av_interleaved_write_frame(): Error while opening file
    This may be a bug in FFmpeg. I wish I knew how to fix it for you.

    Wooo hoooo I am famous . Just saw my name as the other packager for Slackware package of mkvtoolnix!

    Andrew
    And I just got my first FFmpeg patch applied! Soooooo nerdy.

  8. #8
    Join Date
    Nov 2008
    Location
    San Francisco, California
    Beans
    389
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: .mkv to .mp4 remux - mkvextract and mp4box?

    No problem, thanks anyway!

    I'll settle for help on where I can get and install gpac from source, if you know it?

  9. #9
    Join Date
    Dec 2006
    Beans
    7,178

    Re: .mkv to .mp4 remux - mkvextract and mp4box?

    Hi FakeOutdoorsman,

    Quote Originally Posted by FakeOutdoorsman View Post
    And I just got my first FFmpeg patch applied! Soooooo nerdy.
    Congratulations!! Just spotted it now:

    Code:
    andrew@skamandros~$ svn log svn://svn.mplayerhq.hu/ffmpeg/trunk -r 19447
    ------------------------------------------------------------------------
    r19447 | stefano | 2009-07-17 08:32:41 +1000 (Fri, 17 Jul 2009) | 5 lines
    
    Rename invalid option name "gop" to "g" in opt_target(), so that
    -target *-dvd works correctly.
    
    Patch by *** **** <$firstname@fakeoutdoorsman com>.
    All the best,

    Andrew
    Last edited by andrew.46; July 18th, 2009 at 12:31 AM. Reason: Kept the Fakeoutdoorsman anonymous :-)
    You think that's air you're breathing now?

  10. #10
    Join Date
    Oct 2008
    Beans
    2

    Re: .mkv to .mp4 remux - mkvextract and mp4box?

    Here is a little script that i wrote a while back find it fairly good for converting mkvs to mp4's to play on my iphone.

    Uses mkvtoolnix to demux and mp4box to remux so you'll need to install them pop the script into your bin directory and setup permissions.

    To use just go to the directory that the mkvs are located in and run
    Attached Files Attached Files

Tags for this Thread

Bookmarks

Posting Permissions

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