How to compress AMV using h.264

If you have questions about compression/encoding/converting look here.
User avatar
rubyeye
Joined: Wed Sep 05, 2001 1:45 pm
Org Profile

How to compress AMV using h.264

Post by rubyeye » Sat Sep 02, 2006 12:40 am

Even though it is still a relatively new codec, many folks seem to be taking advantage of it. I'm interested in playing with this myself and see if it is a viable option I can & should start using.

However, I know the "Tech Guide" and AMVapp has not been updated in years and some are working on that. So, could someone direct me to where I can learn how to compress my video using the h.264 codec - what programs I may need, the proper settings I should use, and other stats.

Some creators here have had sucess in making h.264 videos so I'd just like to know where they went to learn how to do it.

trythil
is
Joined: Tue Jul 23, 2002 5:54 am
Status: N͋̀͒̆ͣ͋ͤ̍ͮ͌ͭ̔̊͒ͧ̿
Location: N????????????????
Org Profile

Post by trythil » Sat Sep 02, 2006 1:33 am

mplayer manual page, doom9 forum, and #AMV @ irc.zirc.org worked / still works for me.

User avatar
Purge
Joined: Mon Oct 10, 2005 9:18 am
Location: Under Aus
Org Profile

Post by Purge » Sat Sep 02, 2006 3:43 am

i found a gui that does anyhting and everything to h264 in two clicks easy but it only lets you alter the bitrate and framerate.

trythil
is
Joined: Tue Jul 23, 2002 5:54 am
Status: N͋̀͒̆ͣ͋ͤ̍ͮ͌ͭ̔̊͒ͧ̿
Location: N????????????????
Org Profile

Post by trythil » Sat Sep 02, 2006 5:41 am

Purge wrote:i found a gui that does anyhting and everything to h264 in two clicks easy but it only lets you alter the bitrate and framerate.
...then it doesn't really let you do "anything and everything".

Oh, and because I missed this the first time:

There's several implementations of the H.264 standard around. The one that gets the most press around here is x264, but that's not by any means the only one out there.

User avatar
Purge
Joined: Mon Oct 10, 2005 9:18 am
Location: Under Aus
Org Profile

Post by Purge » Sat Sep 02, 2006 6:35 am

oh i meant avi/rm/mpeg etc with that comment

User avatar
Zarxrax
Joined: Sun Apr 01, 2001 6:37 pm
Location: North Cackalacky
Contact:
Org Profile

Post by Zarxrax » Sat Sep 02, 2006 10:30 am

http://x264.nl/ is a good starting point.

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Post by Qyot27 » Sat Sep 02, 2006 11:49 am

I read about the features on both doom9 and Wikipedia, followed cues within MeGUI itself, and fiddled around with the settings myself to see what I was comfortable with. Even though the settings don't always correspond to the features in XviD, the concept behind some of them is fairly similar, and just take some extrapolation and factoring in of the differences to deal with.

Although I've not released too much as of current that uses H.264 (and out of the four videos I've released that use it, only two of them have been since I stopped using the VFW, although I have gone back and 'fixed' those early ones on my end by running them through MP4Box - I just haven't made them available anywhere, because when I get the time I'll probably redo the encode entirely), but that's more because my computer is downright ancient and takes forever to encode, most of the videos I've been editing lately are shorts that I intend to put into a larger compilation, and my editing pace is at a crawl anyway.
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog

User avatar
rubyeye
Joined: Wed Sep 05, 2001 1:45 pm
Org Profile

Post by rubyeye » Sat Sep 02, 2006 12:37 pm

Whoa! :shock: Seems complicated guys. I'll have a look, so thanks for pointing me in the right direction. I sincerely hope someone is able to write a good "guide" on how to encode with this codec for the next AMV Techical Guide & AMVapp Update.

User avatar
Zero1
Joined: Fri Jan 02, 2004 12:51 pm
Location: Sheffield, United Kingdom
Contact:
Org Profile

Post by Zero1 » Sun Sep 03, 2006 3:43 am

http://aflux.deltaanime.net/Zero1/MP4/x264.html

Mostly complete but not polished up. I basically need to check that I haven't said anything misleading (I started writing this guide in something like November 2005) and that what I say makes sense (haven't even proof read it yet).

It covers encoding of video to H.264 using x264. You will have to check out audio encoding yourself, but I advise you use LC-AAC, and for that, iTunes is one of the best encoders (believe it or not). If you have the Nero burning ROM suite, that also has an AAC encoder, but do not use high efficiency. It's sort of false economy. It leads you to think it uses some advanced compression features, but it basically cuts the audio at 22.05KHz or 24KHz (depending on whether the source is 44.1 or 48KHz) and interpolates/reconstructs on playback. Often it sounds like the midrange is missing to me.

So when you have your audio and x264 script/batch, you will need to mux using mp4box. The most simple command line is:

Code: Select all

mp4box -add "video.264" -add "audio.aac" -fps 23.976 "output.mp4"
Remember to change the FPS to what suits your video. You can also do stuff like name the tracks by adding:

Code: Select all

:name="Name of track"
Similarly, if you are adventurous enough to try anamorphic editing/encoding, here you can specify the aspect ratio too. It works in a similar way to adding the name to the track:

Code: Select all

:sar=40:33
Also you can define the language of the tracks, say for instance you have Japanese audio, or for a multi track video, you can give each track it's own language. This is done in a similar way:

Code: Select all

:lang=eng or :lang=jpn
To add multiple tracks, it's simple. Just put an "-add" line in for the track you want to include, for example;

Code: Select all

mp4box -add "video.264" -add "audioeng.aac" -add "audiojpn.aac" -fps 23.976 "output.mp4"
Now we can put these together. Just like in my guide, it's as simple as building something with Lego. The final product can be huge and complex, but if you handle it a brick at a time and build it up in steps, it's easy. These commands for naming tracks etc, essentially stack up on eachother. If we put the whole command line together now, it might look like this:

Code: Select all

mp4box -add video.264:par=40:33:lang=jpn:name="H.264 High Profile - 16/9" -add audioeng.aac:lang=eng:name="LC-AAC Stereo" -add audiojpn.aac:lang=jpn:name="LC-AAC Stereo"-fps 23.976 output.mp4

Now a couple of tips. If you followed my guide and put your files to be encoded/muxed in the same folder as mp4box and x264, then you can use short filenames, otherwise you need to specify the full path when muxing, for example:

Code: Select all

mp4box -add "E:\AMV\encodes\video.264" -add "E:\AMV\encodes\audio.aac" -fps 23.976 "E:\AMV\encodes\output.mp4"
Also if you did store the files in the same place as mp4box, but do not have spaces in the filenames, you can refer to the files without the "":

Code: Select all

mp4box -add video.264 -add audio.aac -fps 23.976 output.mp4
I use batches a lot, but for muxing I tend to type the mp4box command by hand. Another tip is that in your command shell you can begin to type the first few letters of the filename and press tab for completion (just like in IRC for peoples nicknames). If you get the wrong file, just tab again to cycle through the matches.

Any problems contact me in the #AMV IRC channel. Any comments, complaints, suggestions are greatly appreciated. Either way, should you do this, I'd like to hear how you went on.

If however you use some of the examples I wrote here and you find they don't work, don't be too surprised, I wrote this off the top of my head without referring to mp4box, but it should be accurate. To view all the options in mp4box, type:

Code: Select all

mp4box -h all

User avatar
Jnzk
Artsy Bastid
Joined: Tue Jan 28, 2003 5:30 pm
Location: Finland
Org Profile

Post by Jnzk » Sun Sep 03, 2006 6:59 am

I appreciate your work Zero, but don't you think the guide is a bit too detailed for the un-1337 AMV masses? :P Maybe a simple MeGUI guide a la EADFAG with the basic settings and maybe a few tips would make people more willing to try h.264 encoding.

Locked

Return to “Conversion / Encoding Help”