Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.


Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Thread Tools Search this Thread Display Modes
Old 1st December 2009, 16:55   #1  |  Link
Registered User
kapowaz's Avatar
Join Date: May 2002
Posts: 2
Remuxing MKV (H.264+DTS/AC3) to MP4 (H.264+AAC) under Mac OS X

I'm attempting to remux a number of Matroska-contained videos under Mac OS X. My objectives are that the produced video files be:

Playable on Mac OS X through QuickTime, iTunes and Front Row (rather than only VLC)
Playable on a PlayStation 3 (natively, rather than using a streaming server)

For this reason, I would like to use the MP4 container (even though this has some limitations, particularly regarding subtitles; it's still the most pragmatic choice for me).

I've already made several attempts with one video, which have involved the use of tsMuxerGUI to demux the streams and then convert the audio stream from DTS 5.1 to AAC 5.1 using ffmpeg -i source.dts -ab 1536k -ac 6 output.m4a (1536kbps is the reported bitrate of the audio stream according to tsMuxerGUI); I then remuxed using ffmpeg thus: ffmpeg -i source.264 -i output.m4a -vcodec copy -acodec aac final.m4v. There were a couple of warnings in each stage (which I'll show later), but the end result was a playable MP4 video file which suffered stuttering problems (rather than dropped frames it would seem to quickly flicker between a frame and a few frames immediately previous). The audio also didn't seem to be quite right, with odd channel distribution.

The errors I received from ffmpeg were:

From the audio conversion: [aac @ 0x188e200]This encoder does not yet enforce the restrictions on LFEs. The output will most likely be an illegal bitstream.
From the remux: Seems stream 0 codec frame rate differs from container frame rate: 47.95 (48000/1001) -> 23.98 (48000/2002)

It's possible that some part of my toolchain has introduced errors, or that the sample video in this case itself is badly encoded, but I'm not even 100% sure at this point if I'm following the correct process for re-encoding (for example) the audio. Since the overwhelming majority of guides and knowledge on doom9 is geared towards Windows users, I'm at something of a dead end without advice. If there are additional command-line tools I need, I'm happy to try compiling them; my ultimate objective is to come up with a reliable workflow for converting MKV contained content to MP4 that can be scripted/batch processed.

So, what suggestions do people have?
kapowaz is offline   Reply With Quote
Old 1st December 2009, 19:01   #2  |  Link
Registered User
Join Date: Apr 2008
Posts: 1,181
Official ffmpeg build does not support H264 frame copy from mkv.
I posted this patch on ffmpeg tracker and it should solve this problem.
roozhou is offline   Reply With Quote
Old 1st December 2009, 23:08   #3  |  Link
Registered User
kapowaz's Avatar
Join Date: May 2002
Posts: 2
Does ffmpeg have any problems remuxing using H.264 streams that were demuxed separately from it? Say with mkvextract or (as in my case) tsMuxerGUI?
kapowaz is offline   Reply With Quote
Old 2nd December 2009, 22:10   #4  |  Link
Mr VacBob
Registered User
Join Date: Feb 2005
Posts: 141
Originally Posted by kapowaz View Post
From the remux: Seems stream 0 codec frame rate differs from container frame rate: 47.95 (48000/1001) -> 23.98 (48000/2002)
This is just a random message; the error is probably about "non-monotone timestamps". Both of these are from ffmpeg's complicated attempt to find completely correct timestamps from file formats that don't have anything like them - it causes ridiculous problems like not being able to extract mp3 from avi with bad timestamps, when mp3 doesn't have timestamps anyway.

Try QTAmateur - use Export -> to MPEG-4, then select "MP4" as the format and "passthrough" as the video and audio format.
Mr VacBob is offline   Reply With Quote

mac os x, mkv, mp4, remux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 21:13.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.