Log in

View Full Version : muxing aac-lc track to existing m4v file


jingo_man
13th March 2009, 18:05
i am in the process of converting my mkv's to m4v's for use on appletv.

the mkv's originally contained the ac3 soundtrack, and an h264 video track (the bare minimum anyway). i used vlc to export the audio to aac-lc 6-channel format, in a new .mp4 file. using MP4Box -info filename.mp4, this lists as:
* Movie Info *
Timescale 90000 - Duration 01:37:25.546
Fragmented File no - 1 track(s)
File Brand isom - version 0
Created: GMT Sat Mar 14 12:00:11 2009

File has no MPEG4 IOD/OD

Track # 1 Info - TrackID 1 - TimeScale 48000 - Duration 01:37:25.546
Media Info: Language "Undetermined" - Type "soun:mp4a" - 274010 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 6 Channel(s) - SampleRate 48000
Self-synchronized


i used mpeg streamclip to convert the mkv to an mp4 file (m4v actually) but this still contains the ac3 sound track:
* Movie Info *
Timescale 45000 - Duration 01:37:25.600
Fragmented File no - 2 track(s)
File Brand qt - version 537199360
Created: GMT Sat Mar 14 09:59:18 2009

Moov Meta type: "mdta" - 0 resource item(s)
File has no MPEG4 IOD/OD

Track # 1 Info - TrackID 1 - TimeScale 1000 - Duration 01:37:25.173
Media Info: Language "Undetermined" - Type "vide:avc1" - 140144 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 1280 x 720 - Profile High @ Level 5.1
NAL Unit length bits: 32
Self-synchronized
Track Meta type: "mdta" - 0 resource item(s)

Track # 2 Info - TrackID 2 - TimeScale 1000 - Duration 01:37:25.600
Media Info: Language "Unknown" - Type "soun:ac-3" - 182675 samples
AC3 stream - Sample Rate 1 - 3 channel(s) 16 bits per samples
Track Meta type: "mdta" - 0 resource item(s)




using a pre-compiled Mac OSX version of MP4Box 0.4.6-DEV (build 1) (available from any good google search) i tried to add the 1st track into the 2nd. this results in:
/Applications/MP4Box -add /Volumes/EditSpace/Anchorman/Anchorman.The.Legend.Of.Ron.Burgundy.mkv.a1.mp4#trackID=1 /Volumes/EditSpace/Anchorman/Anchorman_\ The\ Legend\ Of\ Ron\ Burgundy.720p.m4v

outputs following (after a progress bar completes to 100%, and then is removed from the screen)
IsoMedia import - track ID 1 - Audio (SR 48000 - 6 channels)
Setting up iTunes/iPod file...
Forcing AVC/H264 SAR to 1:1...
Saving /Volumes/EditSpace/Anchorman/Anchorman_\ The\ Legend\ Of\ Ron\ Burgundy.720p.m4v: 0.500 secs Interleaving
Segmentation fault


can anyone help or explain the issue that is happening? i tried a few additional audio options in the mp4box, ie -sdr, but still errors. are the file(s) faulty/corrupt? process wrong? binaries not properly compiled?

regards

jingo_man

b66pak
13th March 2009, 19:11
i suspect it is ac3 track fault...

try: mp4box -add Burgundy.720p.m4v#trackID=1 -add Anchorman.The.Legend.Of.Ron.Burgundy.mkv.a1.mp4#trackID=1 -new final.m4v
_

jingo_man
13th March 2009, 19:41
must be a mind reader. that was the next thing i tried after posting my item, like you said to remove the ac3 from the equation totally.

unfortunately, same result...

even with the verbose switch, i get no further output as to what the error may actually be.

b66pak
13th March 2009, 19:50
ok...use mkvtoolnix to extract the .h264 stream from the original .mkv...then mux the .h264 with the aac with mp4box (don't forget to specify the fps for the video or you will get 25fps by default)...
_

jingo_man
13th March 2009, 23:42
cheers b66pak

the video track is the problem. i tried separately to add the audio track to a new mp4 container, which worked, then the video to another new mp4 container, resulting in the "segmentation fault" error once again.


i tried to re-demux the original file. the only method that seems to work for me is to use the MPEG Streamclip application (which specifies an mp4 extension, not m4v). the other tools, including iMKVExtract, MKVTools and Mkvtoolnix dont seem to properly extract the video tracks (i havent checked the other tracks). if i run a MP4Box -info on the exported files above, they return:

(MKVInfo) No EBML head found.

or

File has 1 tracks
Track 1 type: Video (....)



so with the mpeg streamclip exported file, MP4Box -info returns:

* Movie Info *
Timescale 45000 - Duration 01:37:25.173
Fragmented File no - 1 track(s)
File Brand mp42 - version 1
Created: GMT Sat Mar 14 21:56:52 2009

File has no MPEG4 IOD/OD

Track # 1 Info - TrackID 1 - TimeScale 1000 - Duration 01:37:25.173
Media Info: Language "English" - Type "vide:avc1" - 140144 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 1280 x 720 - Profile High @ Level 5.1
NAL Unit length bits: 32
Self-synchronized
Track Meta type: "mdta" - 0 resource item(s)


i checked the frame rate in both the original mkv file (using mkvinfo) and vlc with the demuxed video track. they seem different:
mkvinfo output (in video track section, as this also has the ac3 sound track too):
+ Default duration: 41.708ms (23.976 fps for a video track)

vlc (from "window" > "information" > "adv stats": 23.809524

so i tried to the following command to add this track to my successful new aac-lc mp4 file:
MP4Box -add /new/video.mp4 -fps 23.809524 /previous/mp4box/audio.m4v

and

MP4Box -add /new/video.mp4 -fps 23.976 /previous/mp4box/audio.m4v

both return the same error:
IsoMedia import - track ID 1 - Video (size 1280 x 720)
Setting up iTunes/iPod file...
Forcing AVC/H264 SAR to 1:1...
Saving /Volumes/EditSpace/Anchorman.m4v: 0.500 secs Interleaving
Segmentation fault

any more suggestions? are there more specific video switches that need applying? or more info i can gather to more accurately reveal any other settings that may need applying?

i also note from the MP4Box -info command that its running at h.264 profile 5.1 - i believe the appletv only supports up to 4.1. can i change this on mac osx? (or linux, failing that, with appropriate compiled binary)

cheers again

jingo_man

jingo_man
14th March 2009, 00:01
for note, i also tried to mux the Mktoolnix extracted MP4 file into the original aac-lc MP4 file. here i got a totally different error:

MP4Box(4766) malloc: *** mmap(size=4223586304) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Bus error