Log in

View Full Version : Which Linux MP4-encoding packages?


taipan67
19th January 2008, 16:14
Hi all,

I'm sure the information i'm after has been posted before, so i apologise in advance for any duplication that occurs, but i've been unable to find precisely what i'm looking for...

I'm building a fresh Gentoo system, & would like to set it up to encode MP4-files from DVD & probably from other input-sources as well.

My preferred encoder is mencoder, which i've used previously to pipe raw output through x264-encoder & oggenc before muxing into MKV's using mkvtoolnix.

When it comes to MP4 containers, it seems i can use gpac or mpeg4ip, & it looks like ffmpeg might also create them. I'd prefer gpac over mpeg4ip mostly because of it's fewer dependencies, but mpeg4ip (or it's libmp4v2 component) appears to be used by just about every other package that deals with MP4's on Linux (atomic-parsley, amarok, faad2, etc.).

The main reason for this query is that the release-notes for mplayer-1.0rc2 list (among other things) "FFmpeg/libavcodec: Matroska muxer", which suggests to me that it should now be possible to build mencoder with support for x264 & AAC, then encode straight into an MKV-container using the '-of lavf' option, & re-mux into MP4 with gpac's mp4box - however, the online mencoder-doc's (generated nightly from svn) make no mention of this, & still list the old method of encoding to AVI, dumping the tracks to raw AAC & H264, then muxing with mpeg4ip's mp4creator (see "14.7.8 Remuxing as MP4 (http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-quicktime-7.html#menc-feat-quicktime-7-remux)").

What i want to create is standards-compliant, platform & player independent MP4-files. So what i want to know is :-

a). Does mencoder now mux directly into MP4 or MKV?

b). Is one muxing app. more standards-compliant than the others (metadata-tags seem to be an 'apple' creation)?

c) Probably some other stuff that i've temporarily forgotten. :o

I'd like to get this straight before i start building any of them, so as to avoid the possible need to uninstall/reinstall things like faac or ffmpeg if they need to be built after something else to avoid upsetting the dependency auto-detection of later packages (if you know what i mean).

Thanks to anyone who's still reading at this point, & any help you can provide will be greatly appreciated.

taipan ;)

microchip8
19th January 2008, 17:10
a). Does mencoder now mux directly into MP4 or MKV?

Yes mp4 and mkv is supported, however I'd advise you to stay away from the 'lavf' muxer if you deal with B-Frames as it will assign incorrect timestamps and thus generate corrupt/broken files. The 'lavf' muxer only works without a problem with ffmpeg

b). Is one muxing app. more standards-compliant than the others (metadata-tags seem to be an 'apple' creation)?

both mp4box and mpeg4ip are "standard-compliant". I'm not sure about mpeg4ip, but mp4box has support for meta-tags

taipan67
19th January 2008, 20:03
Thanks for the reply, froggy. ;) Yes mp4 and mkv is supported, however I'd advise you to stay away from the 'lavf' muxer if you deal with B-Frames as it will assign incorrect timestamps and thus generate corrupt/broken files. The 'lavf' muxer only works without a problem with ffmpeg...
Hmmm, so have mplayer gotten rid of the 'B-frames' warning without actually fixing the feature, then?

Have you (or anyone else reading this) encoded any MP4's directly with ffmpeg? I'm wondering whether or not i can just use that. I realise it won't read DVD's, only VOB's, but DVD-content could be fed to it by mplayer through a named-pipe (rather than having a huge VOB-file on the hard-drive), couldn't it? Something like...mkfifo dvd-title.vob && \
mplayer dvd://1 -dumpstream -dumpfile dvd-title.vob & \
ffmpeg -i dvd-title.vob <shitloads-of-options> dvd-title.mp4; done
(Please excuse my lack of syntax-knowledge)

...Any idea what the standards-compliance of such output would be, or for that matter whether it could actually be done in the first place?

If this is too exotic (or unfeasible), what methods are other forum-members using at the moment?

Thanks again, taipan

microchip8
19th January 2008, 21:41
Thanks for the reply, froggy. ;)
Hmmm, so have mplayer gotten rid of the 'B-frames' warning without actually fixing the feature, then?

no, the warning is still there when one uses the lavf muxer - scroll up a bit when starting to encode. They only removed the i_certify_that_this_stream_does_not_use_bframe option which is no longer needed. The problem with mplayer/mencoder is that it was/is originally designed to output to AVI only and thus it's timestamp code is only written for this container. For this reason, the lavf muxer doesn't work like it should. They are trying to integrate/fix it but it has taken a long time.

Have you (or anyone else reading this) encoded any MP4's directly with ffmpeg? I'm wondering whether or not i can just use that.

I personally dislike ffmpeg because of it's puke ugly syntax and because most if not all of its options are undocumented, but I've heard that it has no problems in generating mp4 compliant video and containers

I realise it won't read DVD's, only VOB's, but DVD-content could be fed to it by mplayer through a named-pipe (rather than having a huge VOB-file on the hard-drive), couldn't it? Something like...mkfifo dvd-title.vob && \
mplayer dvd://1 -dumpstream -dumpfile dvd-title.vob & \
ffmpeg -i dvd-title.vob <shitloads-of-options> dvd-title.mp4; done
(Please excuse my lack of syntax-knowledge)

I guess you can try that. I'm not very good with pipes/fifo's

taipan67
20th January 2008, 14:29
Thanks again, froggy. ;)

I put "ffmpeg howto" into google, & the third hit i got was...

http://howto-pages.org/ffmpeg/

Which looks much more helpful than either the official online doc's or the manpage (check out the 'mapping channels' section - should be good for VOB's).

As FFmpeg is used by practically every encoder available for Linux, i'm gonna give it a try as proposed in my previous post. It'll be a little while before i get it installed, but once i do i'll be sure to post my experiences here...

In the meantime, i'd be very interested in hearing what methods other Linux-user's have employed for this purpose...? :confused:

taipan

microchip8
20th January 2008, 14:37
I use the h264enc script which uses MEncoder and then remuxes the AVI to MP4 using MP4Box

http://h264enc.sourceforge.net

rootkit
6th February 2008, 02:35
I use my own tool: http://forum.doom9.org/showthread.php?t=134460

taipan67
6th February 2008, 04:46
I use my own tool: http://forum.doom9.org/showthread.php?t=134460
Thanks for the feedback, Matteo. I already grabbed your script-bundle (along with 'aacplusenc' & the 'Nero' binary) at pretty much the same time i started this thread - i especially like the idea of HE-AAC over the FAAC alternative. :cool:

At the moment, my priority is getting an email-setup (& a few other things) in place on the new system, but once i'm ready to focus my energies on encoding, i'll be giving BOTH of the methods suggested a try, & will be sure to post my observations here... ;)

taipan