Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Sorry, I can't be of much help. The files that I download are always either AVI or MKV. However, if you get Visual Hub to get you the TV compatible video in MP4 (using the -an), then you may be able to convert the audio using besweet or something similar. Then afterwards remux using MP4Box or Quicktime Pro.

Thanks again. I'm trying a straight save as in Quicktime for the wmv. I'm not sure if that will do anything for me, but it's worth a shot.

As for the 5.1 mkv transaction-- I converted it to mp4, with audio passthrough, then I demuxed the audio out of the mkv with mkvextract, resulting in an mp4 and an aac file. So far, so good. However, using MP4Box yields an "Invalid IsoMedia" error when trying to reference the .mp4. Am I doing something incorrectly?
 
However, using MP4Box yields an "Invalid IsoMedia" error when trying to reference the .mp4. Am I doing something incorrectly?
Yeah, I've been getting that too. Not to worry though, you can mux using Quicktime Pro.
1.
Code:
mkvextract tracks movie.mkv 2:audio.aac
2.
Code:
MP4Box -add audio.aac audio.mp4
3. Open your MP4 movie in QTPro. Then open audio.mp4 in QTPro. Edit -> Select All. Edit -> Copy. Now make your MP4 movie the active window in QTPro. Edit -> Add to Movie.
4. File -> Export... Click on "Options...". Then select passthrough for both audio and video. Choose "Movie to MPEG-4" in the export drop down. Then save.

Now you should have an MP4 with good audio and video.
 
Please, could you post the exact terminal command ?
Thaks a lot

Nico

Ok, here's the definitive list of steps that are most likely to work.

1. Open Visual Hub. Drag and drop your matroska file into Visual Hub. Select the matroska file and press CMD-4, note down the FPS. Click on "Advanced...". In either "Extra FFMPEG Flags:" field, type "-an" (without quotes). In the "Framerate" field, type in the FPS value that we noted down earlier. Now press start.
2. After a few hours you end up with a working MP4 file with video but without audio. Open up Terminal.app and enter:
Code:
mkvextract tracks <matroskafile>.mkv 2:audio.aac
3. Still in Terminal.app:
Code:
/path/to/MP4Box -add audio.aac audio.mp4
4. Open your MP4 movie in QTPro. Then open audio.mp4 in QTPro. Edit -> Select All. Edit -> Copy. Now make your MP4 movie the active window in QTPro. Edit -> Add to Movie.
5. File -> Export... Click on "Options...". Then select passthrough for both audio and video. Choose "Movie to MPEG-4" in the export drop down. Then save.
 
Ok, here's the definitive list of steps that are most likely to work.

1. Open Visual Hub. Drag and drop your matroska file into Visual Hub. Select the matroska file and press CMD-4, note down the FPS. Click on "Advanced...". In either "Extra FFMPEG Flags:" field, type "-an" (without quotes). In the "Framerate" field, type in the FPS value that we noted down earlier. Now press start.
2. After a few hours you end up with a working MP4 file with video but without audio. Open up Terminal.app and enter:
Code:
mkvextract tracks <matroskafile>.mkv 2:audio.aac
3. Still in Terminal.app:
Code:
/path/to/MP4Box -add audio.aac audio.mp4
4. Open your MP4 movie in QTPro. Then open audio.mp4 in QTPro. Edit -> Select All. Edit -> Copy. Now make your MP4 movie the active window in QTPro. Edit -> Add to Movie.
5. File -> Export... Click on "Options...". Then select passthrough for both audio and video. Choose "Movie to MPEG-4" in the export drop down. Then save.

It actually works like a charm for me :)
Thanks

Nico
 
I found a very simple way to convert MKV to MP4 without using command line tools and with no re-encoding of the video stream, no quality lost. It requires Quicktime Pro and Perian. I wrote a quick tutorial with screen shots on my blog.
You only need to export the movie using Quicktime and yesssss, there is a Pass Through option for the video :D Quicktime always surprises me :apple:

Your tutorial link is broken and I would love to read it - got a working link please?
 
Yeah, I've been getting that too. Not to worry though, you can mux using Quicktime Pro.
1.
Code:
mkvextract tracks movie.mkv 2:audio.aac
2.
Code:
MP4Box -add audio.aac audio.mp4
3. Open your MP4 movie in QTPro. Then open audio.mp4 in QTPro. Edit -> Select All. Edit -> Copy. Now make your MP4 movie the active window in QTPro. Edit -> Add to Movie.
4. File -> Export... Click on "Options...". Then select passthrough for both audio and video. Choose "Movie to MPEG-4" in the export drop down. Then save.

Now you should have an MP4 with good audio and video.

Thanks again for the help. One more issue: When I run the mp4box command, it mulls for 10 minutes or so and then spits out a 8mb "empty" mp4 file (the .aac extracted from the mkv is over a gig). Have you had this issue / know of any workarounds / other aac conversion utilities?

Regards!
 
Use mkvextract and MP4Box
http://www.bunkus.org/videotools/mkvtoolnix/
http://gpac.sourceforge.net/

mkvextract tracks temp.mkv 1:temp.aac 2:temp.h264
FPS=`mkvinfo temp.mkv | gawk '/[0-9.]\ fps/ { print $6 }' | gawk -F\( '{ print $2 }' | tail -1`
MP4Box -add temp.aac -add temp.h264 -fps $FPS temp.mp4

Not sure what you wanted to do with the subtitles though, ISO .mp4 doesn't support them...


Hi oldmanuk,

Is the purpose of the 'FPS=...' section to simply ascertain the FPS of the mkv file, so that value may be entered in the MP4Box command? If I find the FPS another way (VisualHub), can I bypass this step and simply enter in the value I have?

I dont know what im doing wrong, but I am able to extract the two files fine using mkvextract, but MP4Box fails at 99/100 when importing the aac (probably failing at the start of the .h264 import?). I've tried the command both with and without the $. See attached screenshot. I am very new to command line stuff so please forgive my ignorance.

Any help greatly appreciated (from anyone!). Thanks. :)
 

Attachments

  • Picture 1.png
    Picture 1.png
    10.8 KB · Views: 351
Thanks again for the help. One more issue: When I run the mp4box command, it mulls for 10 minutes or so and then spits out a 8mb "empty" mp4 file (the .aac extracted from the mkv is over a gig). Have you had this issue / know of any workarounds / other aac conversion utilities?

Regards!
If your .aac file over a gig then something's not right. What's the size of the original mkv?
For me, the size of the audio is usually less than 10% of the overall size of the audio + video.
Also, if you could post the output of running, in Terminal.app:
Code:
mkvinfo <yourmovie>.mkv
 
I dont know what im doing wrong, but I am able to extract the two files fine using mkvextract, but MP4Box fails at 99/100 when importing the aac (probably failing at the start of the .h264 import?). I've tried the command both with and without the $. See attached screenshot. I am very new to command line stuff so please forgive my ignorance.

Any help greatly appreciated (from anyone!). Thanks. :)
I gave up on MP4Box'ing the video. It rarely worked when trying to mux the original h264 from an mkv. Instead I re-encode the video (only the video) using Visual Hub, so as to get it to work in Quicktime and TV.
 
I've been having issues lately converting with Visual Hub for a few files. The seem to cut out either half way, ten minutes into it or something. It seems like it could be an issue with the MKV file, but it plays fine in VLC. Anyone have any advice?
 
If your .aac file over a gig then something's not right. What's the size of the original mkv?
For me, the size of the audio is usually less than 10% of the overall size of the audio + video.
Also, if you could post the output of running, in Terminal.app:
Code:
mkvinfo <yourmovie>.mkv


Sure thing, it's quite long:

Code:
[SIZE="1"]+ EBML head
|+ Doc type: matroska
|+ Doc type version: 1
|+ Doc type read version: 1
+ Segment, size 7041771129
|+ Seek head (subentries will be skipped)
|+ EbmlVoid (size: 4010)
|+ Segment information
| + Timecode scale: 1000000
| + Muxing application: libebml v0.7.7 + libmatroska v0.8.1
| + Writing application: mkvmerge v2.1.0 ('Another Place To Fall') built on Aug 19 2007 13:40:07
| + Duration: 7660.320s (02:07:40.320000000)
| + Date: Mon Dec 17 11:06:08 2007 UTC
| + Segment UID: 0xa3 0x00 0x79 0x26 0x12 0x05 0x48 0xa7 0x89 0x2f 0x32 0x69 0x68 0x04 0xe9 0x32
|+ Segment tracks
| + A track
|  + Track number: 1
|  + Track UID: 1
|  + Track type: video
|  + Enabled: 1
|  + Default flag: 1
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 1
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: V_MPEG4/ISO/AVC
|  + Codec decode all: 1
|  + CodecPrivate, length 168
|  + Default duration: 41.708ms (23.976 fps for a video track)
|  + Language: eng
|  + Name: 1280x532 - 5839 kbit/s - x264
|  + Video track
|   + Pixel width: 1280
|   + Pixel height: 532
|   + Interlaced: 0
|   + Display width: 320
|   + Display height: 133
| + A track
|  + Track number: 2
|  + Track UID: 2883852188
|  + Track type: audio
|  + Enabled: 1
|  + Default flag: 1
|  + Forced flag: 0
|  + Lacing flag: 1
|  + MinCache: 0
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: A_DTS
|  + Codec decode all: 1
|  + Language: eng
|  + Name: DTS 5.1 - 1536 kbit/s
|  + Audio track
|   + Sampling frequency: 48000.000000
|   + Channels: 6
| + A track
|  + Track number: 3
|  + Track UID: 1602268095
|  + Track type: subtitles
|  + Enabled: 1
|  + Default flag: 1
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 0
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: S_TEXT/ASS
|  + Codec decode all: 1
|  + CodecPrivate, length 627
|  + Language: eng
| + A track
|  + Track number: 4
|  + Track UID: 3860413091
|  + Track type: subtitles
|  + Enabled: 1
|  + Default flag: 0
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 0
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: S_TEXT/ASS
|  + Codec decode all: 1
|  + CodecPrivate, length 627
|  + Language: cze
| + A track
|  + Track number: 5
|  + Track UID: 2745546404
|  + Track type: subtitles
|  + Enabled: 1
|  + Default flag: 0
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 0
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: S_TEXT/ASS
|  + Codec decode all: 1
|  + CodecPrivate, length 627
|  + Language: dan
| + A track
|  + Track number: 6
|  + Track UID: 1155147425
|  + Track type: subtitles
|  + Enabled: 1
|  + Default flag: 0
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 0
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: S_TEXT/ASS
|  + Codec decode all: 1
|  + CodecPrivate, length 627
|  + Language: dut
| + A track
|  + Track number: 7
|  + Track UID: 2493474458
|  + Track type: subtitles
|  + Enabled: 1
|  + Default flag: 0
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 0
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: S_TEXT/ASS
|  + Codec decode all: 1
|  + CodecPrivate, length 627
|  + Language: fin
| + A track
|  + Track number: 8
|  + Track UID: 4049522824
|  + Track type: subtitles
|  + Enabled: 1
|  + Default flag: 0
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 0
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: S_TEXT/ASS
|  + Codec decode all: 1
|  + CodecPrivate, length 627
|  + Language: fre
| + A track
|  + Track number: 9
|  + Track UID: 2326094479
|  + Track type: subtitles
|  + Enabled: 1
|  + Default flag: 0
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 0
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: S_TEXT/ASS
|  + Codec decode all: 1
|  + CodecPrivate, length 627
|  + Language: hun
| + A track
|  + Track number: 10
|  + Track UID: 657173154
|  + Track type: subtitles
|  + Enabled: 1
|  + Default flag: 0
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 0
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: S_TEXT/ASS
|  + Codec decode all: 1
|  + CodecPrivate, length 627
|  + Language: spa
| + A track
|  + Track number: 11
|  + Track UID: 812251833
|  + Track type: subtitles
|  + Enabled: 1
|  + Default flag: 0
|  + Forced flag: 0
|  + Lacing flag: 0
|  + MinCache: 0
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: S_TEXT/ASS
|  + Codec decode all: 1
|  + CodecPrivate, length 627
|  + Language: swe
|+ EbmlVoid (size: 1024)
|+ Attachments
| + Attached
|  + File name: CronosPro-Bold.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 108928
|  + File UID: 479440785
| + Attached
|  + File name: CronosPro-Semibold.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 109724
|  + File UID: 2400569504
| + Attached
|  + File name: CronosPro-SemiboldIt.ttf
|  + Mime type: application/x-truetype-font
|  + File data, size: 135684
|  + File UID: 3963605654
|+ Cluster[/SIZE]

The original mkv is 6.5gigs, and the audio.aac that mkvextract gives me is 1.35gigs.
 
I gave up on MP4Box'ing the video. It rarely worked when trying to mux the original h264 from an mkv. Instead I re-encode the video (only the video) using Visual Hub, so as to get it to work in Quicktime and TV.

I was able to get MP4Box to work using a windows .exe binary of it under Parallels. Works like a charm.

I was actually looking into this to get .mkv files playing on my PS3, not Apple TV. If there's anyone else in the same situation, I found this great tutorial over at Doom9 http://forum.doom9.org/showthread.php?t=132386.
 
Hmm when I try to do it i get No such file or directory. Any help? I am on the terminal but everything I enter says no such file or directory
 
Sure thing, it's quite long:

Code:
[SIZE="1"]
| + A track
|  + Track number: 2
|  + Track UID: 2883852188
|  + Track type: audio
|  + Enabled: 1
|  + Default flag: 1
|  + Forced flag: 0
|  + Lacing flag: 1
|  + MinCache: 0
|  + Timecode scale: 1.000000
|  + Max BlockAddition ID: 0
|  + Codec ID: A_DTS
|  + Codec decode all: 1
|  + Language: eng
|  + Name: DTS 5.1 - 1536 kbit/s
|  + Audio track
|   + Sampling frequency: 48000.000000
|   + Channels: 6
Ok, I think I can see where you're having problems. The audio isn't aac, but it's DTS. So when you're using mkvextract to create audio.aac, it's adding the wrong file extension. Ignoring the file extension however, the MP4 container doesn't support DTS. So you'll need to somehow convert your audio to aac. Unfortunately I'm not sure how you would do this.
 
Ok, I think I can see where you're having problems. The audio isn't aac, but it's DTS. So when you're using mkvextract to create audio.aac, it's adding the wrong file extension. Ignoring the file extension however, the MP4 container doesn't support DTS. So you'll need to somehow convert your audio to aac. Unfortunately I'm not sure how you would do this.

Ah, that makes plenty of sense. Unfortunately, the DTS ones are the only ones I've been having problems with. Visualhub takes AAC .mkv -> .mp4 conversion in stride. Ah well, here's hoping the Perian 1.1 upgrade will support DTS in .mkv files.

Thanks again for all of your help. :cool:
 
Not sure where to ask this, but this sounds like the closest place.

I've just started converting a bunch of .mkv files into .mp4 using VisualHub. The video quality is great, but the issue comes with the audio. I have been noticing that the audio is very unequal throughout the movie dependent upon what type of scene it is. The action scenes are very, very loud, while the scenes where there is only dialogue are disproportionately quiet. I'm assuming that this is because the .mkv's audio is encoded in 5.1 and then when it is adjusted to stereo using VisualHub there is some sort of lack of compensation.

How can I solve this? I'm looking for two fixes:

1) Pre-conversion: Is there something that I can do in VisualHub to ensure that the audio is encoded properly and that the sound remains stable throughout the movie? (So I don't have to constantly adjust the volume between action scenes and dialogue.)

2) Post-conversion: I have already converted a number of movies and deleted the .mkv files. I've tried using the iTunes equalizer which did not help at all. Is there anything I can do to equilibrate the stereo output to balance the audio between action and dialogue?

Any help/advice would be great! :)
 
? ? ? ? ?

hay folks, after reading this thread and gnkieffer's tutorial i still cant convert my mkv files. ive got a mkv file which is only 30 secs long, ideal for test converting. its format is:

H.264, 1280 x 544, Millions
AAC, 5.1 (C L R Ls Rs LFE), 48.000 kHz

if i follow gnkieffer's tutorial, pass through video etc, i still dont get sound in the new mp4, can anyone explain? one mkv file i cant select pass through at all.

on this thread, im getting the same problem as je1ani with the terminal saying no such file or directory..

its really starting to bug me as ive got quite a few mkv files to convert to dvd. any help would be appreciated!

many thanks

ps. ive got perian installed, i own quicktime pro, visualhub, n everything else.
 
Would it be possible to upload the 30sec file somewhere? So that I can see if it is indeed possible to convert it to an mp4.
 
I used the following software:

Quicktime Pro
mkvextract
mkvinfo
VisualHub

1. Get the video in the correct format. The video as it is will not play on TV. Drag and drop the movie into Visual Hub. Choose the video settings of your choice. 'High' and H.264 encoding work for me. Click advanced and in the 'Extra ffmpeg Flags:' type '-an'. Without quotes of course.
2. While Visualhub is encoding, we'll start work on the audio. Open Terminal.app
Code:
mkvinfo Downloads/Transformers.2007.nHD.720p.x264.Sample.NhaNc3.mkv
.Note the video's fps. 23.976 in this case. Then type:
Code:
mkvextract tracks 2:audio.acc
MP4Box -add audio.aac -fps 23.976 audio.mp4
3. The video should have finished encoding by now. Open it in Quicktime Pro. Then open audio.mp4 in Quicktime, press CMD-A then CMD-C. Go back to the movie you opened in Quicktime, then press CMD-OPT-V.
4. Now we fix the aspect ratio. CMD-J, select the video track, select Visual Settings, make sure Preserve Aspect Ratio is unticked, and then type 1319 into the scaled size width. Leave the height as it is. You can find the correct height value when you run mkvinfo on the original mkv file.
4. Save your movie.
5. Now export your movie to MP4. File -> Export... Then click Options, select MP4 format, and then select passthrough for both audio and video. Click Save and you should have a fully working MP4.

Here's the file that I converted:
http://rapidshare.com/files/83055664/Transformers.2007.nHD.720p.x264.Sample.NhaNc3.mp4.html
 
stomer you are actually GOD fullstop. lol

thanks for the mp4 sample im gonna get to work n try it myself. i'll get bak to you with my results, fingers crossed.

much respect, peace out
 
ok i knew there was something...

i downloaded the gpac package containing mp4box where do i install all the bits too? or have i downloaded the wrong thing?

the first code worked in the terminal program.

nearly there...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.