PDA

View Full Version : muxing h.264 in mp4


ivan_alias
26th October 2004, 11:42
Does anyone know of a way to put h.264 in an mp4 container? (in windows)

I thought mp4creator would work, but the version I have is from May and it doesnt seem to like the raw h.264 bit stream.

Videolan doesnt seem to do it.

mencoder doesnt output mp4

ffmpeg doesn encode h.264

Im stuck!

Anyone have an idea of how to do this!?

Thanks a lot

tiki4
26th October 2004, 18:21
I made some x264 encodes with ffdshow in AVI container. I was able to mux them to MP4 with VLC latest 0.8.0 beta. Nero Showtime was able to decode that files, so give it a try.

tiki4

edit: typo

bond
26th October 2004, 21:08
latest cvs of mp4creator should do it too

pogo stick
27th October 2004, 00:13
Is there anywhere I can find compiled version of it?
And by the way, does VLC produce compliant mp4 files now?

tiki4
27th October 2004, 07:32
Here (http://www.videolan.org/vlc/download-windows.html), latest beta package (0.8.0-test2), dunno about mp4creator, I could possibly compile it for Linux, though.

tiki4

Drachir
27th October 2004, 11:21
Originally posted by pogo stick
And by the way, does VLC produce compliant mp4 files now?

NO, VLC doesn't produce compliant mp4 files.

"mp4.c" have not changed for 2 months.( http://developers.videolan.org/cgi-bin/viewcvs.cgi/trunk/modules/mux/ )

Kurtnoise
27th October 2004, 13:11
Originally posted by ivan_alias
Does anyone know of a way to put h.264 in an mp4 container? (in windows)

I thought mp4creator would work, but the version I have is from May and it doesnt seem to like the raw h.264 bit stream.

Fenrir has made a tool to store raw video h.264 in an AVI container. I haven't tested yet but you can grap it here (http://atlas2.tgv.net/~media-video/forum2/download.php?id=1486). Then, with mp4crator you could create your mp4 file.

gotaserena
27th October 2004, 13:43
no need for that, since mencoder can output avi already. Also, mp4creator does not like to use avi files, and v1.1 does not recognize h.264 streams in the avi container.

I'll give another shot at compiling the mpeg4ip CVS at home and try to mux it. If it works I'll upload the binaries somewhere.

ivan_alias
27th October 2004, 14:57
Thanks gotaserena

Hope it works!

then I hope videolan will be able to play it back..

gotaserena
27th October 2004, 15:12
CVS worked fine in linux:
$ mp4info video.mp4
mp4info version 1.1.7
video.mp4:
Track Type Info
1 video H.264, 203.520 secs, 1068 kbps, 320x256 @ 25.000000 fps
Metadata Tool: mp4creator 1.1.7
I even muxed two video streams in the same file by mistake! :P

In case pp are trying to play it in mplayer (best for slow < 2.0GHz computers), just remember to edit codecs.conf:
videocodec ffh264
info "FFmpeg H.264"
status working
fourcc H264,h264,avc1
format 0x10000005
driver ffmpeg
dll h264
out YV12,I420,IYUV
since mp4creator changes the fourcc of the stream when importing. I don't know if celtic_druid's builds have this problem, but it did show in my compilation.

ivan_alias
27th October 2004, 18:08
Well this is good news.

Does anyone have a windows compile?? :-)

gotaserena
27th October 2004, 18:29
here (http://s9.yousendit.com/d.aspx?id=FF977DBAAA1E88C1AA7DFD6E646E9D5E)!

Seems to work here (in a P4), but don't blame me if it breaks anything (or itself).

bond
27th October 2004, 18:46
Originally posted by Drachir
NO, VLC doesn't produce compliant mp4 files.hm, i read somewhere that the nero filters can play h.264 vlc-muxed .mp4 files, so i dunno if they arent spec compliant already and the failure was in neros filters

or do you have other info, why these files are not compliant?

Drachir
27th October 2004, 19:19
I posted here a question to mp4 files produced with vlc: http://sourceforge.net/forum/forum.php?thread_id=1144961&forum_id=287546


Jean Le Feuvre1- the IODS box/atom is optional in MP4 specification
2- more quoting:
"There are a number of possible file types based on usage, depending on the descriptor:
Presentation, contains IOD which contains a BIFS stream (MP4 file)
Sub-part of a presentation, contains an IOD without a BIFS stream (MP4 file)
Sub-part of a presentation, contains an OD (MP4 file)
Free-form file, referenced by MP4 data references (free-format)
Sub-part of a presentation, referenced by an ES URL.
NOTE - The first three are MP4 files, a file referenced by a data reference is not necessarily an MP4 file, as it is free-format. Files referenced by ES URLs, by data references, or intended as input to an editing process, need not have an Object Descriptor Box."


so the files created by VLC should not be treated as "compliant MPEG-4 presentation" by a player - which doesn't mean it won't read it, cf gpac:)

bond
27th October 2004, 20:33
ah thanks, totally forgot that thread

gotaserena
27th October 2004, 20:49
ffdshow-20041012 doesn't like avc1 in mp4 it seems. I just manage to open a h.264 encode done by mencoder in avi using graphedit, but if I mux the raw stream into mp4 using mp4creator I can't decode it anymore. Splitter was 3ivx's. I changed the fourcc from h264 to avc1 and ffdshow still played it.

VLC 0.8-2 opens the mp4 without any problems, though.

bond
27th October 2004, 20:59
the 3ivx splitter doesnt support avc-in-mp4, you cant use it with such files!

gotaserena
27th October 2004, 21:10
Yes, now I see that. But isn't the splitter supposed to give some error message when it encounters a track that it cannot handle?

gotaserena
28th October 2004, 20:02
Ok, I've managed to encode my first H.264+5.1AAC using mencoder, faac and mp4creator! I'm feeling like that ape from 2001: clutching at bones trying to figure them out!

Bad news is that mp4creator still has some trouble importing AVC. Even with --rate=25 the reported fps of the video stream is "61.553780 fps". mplayer (linux) did not complain, though. VLC plays it also but reports the length of the video as 11h35min, and only decodes stereo. I have to wait till next moonlights beta splitter to try ffdshow.

ak
28th October 2004, 23:25
Hm, just checked bunch of samples lying around (.mp4's with x264 encodes inside), it shows fps correctly on all of them (mp4info that is). They are mostly video-only though.

As for decoders, moonlight h264 ds decoder is the only one that can decode b-frames correctly at the mo. Even with new nero filters it's jerky and corrupted all over the place, just like with lavc :shocked:

gotaserena
29th October 2004, 00:38
This problem only showed so far with a 1h show encode I've got. All the shorter samples displayed fps and time acurately in mp4info.

pogo stick
30th October 2004, 01:07
Originally posted by gotaserena
here (http://s9.yousendit.com/d.aspx?id=FF977DBAAA1E88C1AA7DFD6E646E9D5E)!
Seems to work here (in a P4), but don't blame me if it breaks anything (or itself).
Thanks a lot! :)
Interesting, are files produced by mp4creator compliant?
I tried only short files so it seems to work. Raw MEncoder's x264 don't have problems. But video track from Nero H.264 sample that I downloaded can not be extracted properly:

MP4ERROR: MP4File::FindBytesProperty: no such property moov.trak[2].mdia.minf.stbl.stsd.*[0].esds.decConfigDescr.decSpecificInfo[0].info

And the main problem with HE-AAC is remains the same. I wish mp4creator could take audio from MP4 and not only from AAC. :(

pogo stick
30th October 2004, 15:44
Here (http://pogo-stick.nm.ru/Kiki.mp4) is very small (37 sec, 822 KB) MP4 sample with x264 video, 2 Nero HE-AAC audio (Japanese and Russian), English subtitle and chapters inside. First I made MP4 with Recode, then deleted Nero video track and added raw x264 with mp4creator.
mp4creator told me:
MakeIsmaCompliant:can't make ISMA compliant when file contains an avc1 track
But it seems to work ok.
Don't look at the quality. Video is only 100 kbps.
Can be played back with MPlayer, VLC and in DShow using Nero parser or Moonlight Demultiplexer.
Nero parser will not let choose audio and only first one will be played. And chapter selection is buggy:

http://pogo-stick.nm.ru/nero chap bug.jpg

It seems like Nero ShowTime is the only player that can show subs. VLC shows an option, but subs are not shown:

http://pogo-stick.nm.ru/VLC Subs.jpg

Moonlight Demultiplexer have no problems with audio. Chapters are not supported. Playback with Moonlight H.264 decoder is buggy.

celtic_druid
31st October 2004, 07:30
@pogo stick, have you tried ffdshow as the decoder? Seems to work fine here, although I only tested one short clip.

pogo stick
31st October 2004, 16:26
Thanks you for new build! :)
I downloaded it, but I can not install it now. I am re-encoding FFV1 file in VDub now. I will report about it as soon as I'll finish.

gotaserena
31st October 2004, 16:33
mpegip CVS was updated 1.1.8. The time code problem still shows.

pogo stick
31st October 2004, 20:11
Originally posted by celtic_druid
@pogo stick, have you tried ffdshow as the decoder? Seems to work fine here, although I only tested one short clip.
I have posted a little report in Moonlight Demultiplexer (http://forum.doom9.org/showthread.php?postid=564436#post564436) thread. I guess it's more appropriate.

RadicalEd
14th November 2004, 13:25
Link died :\

pogo stick
15th November 2004, 01:25
Thanks to Celtic Druid it is available here:
http://celticdruid.no-ip.com/xvid/Misc/mpeg4iptools2004.11.03.7z

RadicalEd
15th November 2004, 02:18
Hmm... with this build I just get "video compressor H264" not recognized (same with AVC1).

mp4creator60 -allow-avi-files -create=in.avi out.mp4

celtic_druid
15th November 2004, 04:26
Don't think it supports h264 in avi's yet.

avi2raw x264.avi whatever.264
mp4creator --create=whatever.264 rate=?

Also I believe that outputting raw streams with mencoder or I guess ffdshow works.

RadicalEd
15th November 2004, 04:57
Ah yeah, works like a charm. Thanks.

yaz
15th November 2004, 13:02
Originally posted by celtic_druid
... Also I believe that outputting raw streams with mencoder or I guess ffdshow works. sure, both they do it. that way the stripping step can be saved but the stream cannot be checked (wout wrapping, of course :-)

the bests
y

ak
15th November 2004, 13:33
MPlayer should playback raw h264

> mplayer bla.h264 -fps 23.976
> ...
> Cache fill: 0.00% (0 bytes) H264-ES file format detected.

So does ffplay, btw.

gotaserena
15th November 2004, 14:20
And mp4creator support for h.264 is not really reliable yet. I did not manage to import a sample encoded using the reference encoder, for instance. Plus, the problem I mentioned with longer streams (>44min) still persists.

BTW, anybody has any idea what I can use to mux raw video into a container, other than ffmpeg & mencoder?

gotaserena
23rd November 2004, 16:51
cvs is now on version 1.1.14 and at least the problem with longer samples is gone.