Log in

View Full Version : x264 avi encoding guide


teek
22nd February 2006, 06:43
Hi everyone,

First of all, I'm obviously new here, but I have been reading these forums off and on for a while now. I've found a lot of the information useful here.

I really like x264 and the results I've been able to get out of it from encoding videos of captured video game footage. As a result, many people that watch my videos often ask me how I got the quality of the video so high. After helping a few others with it, I finally decided it would be a good idea to write a good guide on how to encode videos using x264: http://teek.info/guides/video/x264encode.html

The guide covers basically how to go from an AVI in some other format to x264 video + mp3 audio in an AVI using VirtualDub. I chose mp3 since it is well supported in playback and I wouldn't have to go into depth about some other audio codec.

Now I'm pretty sure most people here already know how to do that, but I just want to get some feedback especially if I mention anything that's wrong. If you're new to this then I hope what I've written might be useful.

Initially I was going to write up a guide that included using x264-MeGUI and VirtualDub but the VirtualDub part got long enough already, so I decided to save x264-MeGUI as another guide when I get the time.

celtic_druid
22nd February 2006, 07:14
I really don't think we need a guide advocating the use of VfW for AVC encoding. I mean you wouldn't want to encourage people. So in that sense an MeGUI guide would have made more sense. I don't see why VDub would need to have been included in that though.

Why full processing mode for the video? That means converting to RGB24 and you don't appear to be suggesting using filters either. Although I guess in your context of capturing game footage your source could be RGB24 anyway.

Err, also you don't seem to explain/suggest any x264 options or anything. So basically you have a VirtualDub guide that suggests selecting x264 rather than an x264 guide that suggests using VDub.

Sharktooth
22nd February 2006, 07:31
Also you better correct the guide and tell ppl to use x264.nl builds since mine are outdated (for now).

EDIT: What's all this recent avi/vfw/vdub fuss with avc? keep avc as it's meant to be... away from avi/vfw/vdub.

ChronoCross
22nd February 2006, 07:32
stupid avc in avi. when will people learn not to do it. it takes about 5 minutes to learn how to use avisynth for editing. there is no real need for vdub or any vfw codec with respect to h264.

rushin_911
22nd February 2006, 08:32
stupid avc in avi. when will people learn not to do it. it takes about 5 minutes to learn how to use avisynth for editing. there is no real need for vdub or any vfw codec with respect to h264.
Actually VirtualDub is quite useful and easy when it comes to editting video streams, and I don't think there really is any other application which offers the same level of ease when it comes to that. For example it's a lot easier to split a video stream into 4 streams (e.g. joined episodes) using virtualdub than anything else I can think of.
That's not to say people should use vfw structure apps (I use the cli) but rather that they still represent a legitimate solution given the current circumstances.

ChronoCross
22nd February 2006, 09:20
hmm I bet you I can race you to splitting the stream into 4 mp4's rather than 4 avi's. iw would literally(I'm not joking here) take me 15 seconds to find the frames I want to spilt. Then write an avs for them.

If you look into avisynths trim funtion you'll see what I'm talking about.

dimzon
22nd February 2006, 09:25
If you look into avisynths trim funtion you'll see what I'm talking about.
Maybe he mean "split without recompression"?
In this case mp4box works fine

teek
22nd February 2006, 09:38
Thanks for some suggestions. I updated the guide and changed video processing to fast recompress instead. I also added a small bit about the AVI container and some steps about changing the reference frames. I didn't realize that the default was set to 1 reference frame since I hadn't touched the VFW codec for a while.

I'm not really trying to advocate VirtualDub-AVI, I'm just offering it as a starting point--maybe I need to emphasize that or finish the MeGUI guide. The intent of using VirtualDub/VFW and AVI vs MeGUI was to generate stuff that was more easily supported until users get used to (or are willing) to move towards other things. It's hard enough telling people to install ffdshow just to play h264 videos. I was trying to aim this guide at stuff that mostly works out of the box. With MeGUI you need the .net framework, AviSynth, and the helix codec. Use MP4 or MKV containers and you need a splitter. I didn't feel like dragging people through that entire process unless they knew what they were getting into after getting their feet wet with something relatively simple.

I do plan on having a guide on MeGUI/AviSynth. I wrote the article for people who have no experience what so ever and just want to see what x264 is all about. I understand your concerns around h264 and how it was meant to be used and yes this is more of a guide for very new people.

I also realized after writing this guide, that many more guides just on each tool can be written: virtualdub and x264 encoding options both could be several guides or even a book worth of writing to explain.

Doom9
22nd February 2006, 09:54
you need the helix codec and avisynth for vdub as well ;) at least if you're doing it properly. And there's a gknot/x264 guide already.. admittedly it could use a little brushup.. but writing megui code is just more fun.

celtic_druid
22nd February 2006, 10:44
I don't really see it as a starting point. I would have thought that teaching people to use x264VfW and then saying, hey use the cli would do more damage. Better to get people more familiar to AVISynth, x264 options, AVC levels, etc. as a starting point. Always best to start on the right foot even if it is a big step I think.

I really don't see having to install a splitter as an issue. You need to install an AVC decoder anyway so why not the splitter?

Tommy Carrot
22nd February 2006, 13:28
It's nice to see some kind of civilized discussion about this subject instead of the usual flaming here. :D I don't want to start it either, i just want to share my opinion about this:

Contrary to some people's opinion, it's not true that AVC in AVI is crippled or buggy, it's working perfectly, and is able to obtain the same quality as the CLI encoder (with the same options, obviously). There is only one problem with it: it's not standard compliant (although neither is MKV, in fact). So i would say, if standard compliance is very important to you, do not use the vfw codec (or mkv output), but if it's not, you just want to get the best possible quality, it's the perfect solution. VFW and CLI can coexist peacefully, trying to persuade people about the uselessness of either of them is unnecessary.

Doom9
22nd February 2006, 13:44
it's working perfectly,If you call losing frames and the ensuing synch drift perfect..

Tommy Carrot
22nd February 2006, 13:58
Losing frames is not necessary, if virtualdub would have the same support for x264 as it has for xvid or divx, then there would be no lost frame with x264 either. And frame drifting is only an issue during editing in vfw (not perfect admittedly, but still much better than what we have for mkv or mp4), at normal directshow playback it doesn't happen at all.

celtic_druid
22nd February 2006, 15:43
Yeah, so if you want avi, then surely mencoder is the answer not VfW?

Tommy Carrot
22nd February 2006, 17:14
Mencoder is useful, but i see no reason to use it for x264 encoding when there is vfw too (in windows platform anyway). :D The frame drift is caused by an avi limitation (no out-of-order frames support), so it doesn't matter if we use mencoder or vfw. But as i said, this is only an issue at editing anyway, and the alternatives (mkv, mp4) are even worse in this regard.

IgorC
22nd February 2006, 17:40
There is a FAQ of "x264 in AVI". It's prety short and easy to understand

FAQ:

Do not encode x264 in avi.


What is better? Some new flexible features of cli version (more quality, more speed) of x264 or keep wasting time trying for helpless hack of x264 into avi?

Tommy Carrot
22nd February 2006, 17:50
What is better some new flexible features (more quality, more speed) of x264 or keep trying hellpless hack of x264 into avi?
Damn, this is exactly what i'm trying to explain here, that what you're saying is false. AVC in avi can have exactly the same quality, speed and feature-set, and probably even more flexibility, and the hacks are irrelevant in practical use. The only real "drawback" is that it's not spec compliant, that's all.

IgorC
22nd February 2006, 17:56
You don't understand me correctly.
I absolutly agree with you that x264 can have the same features but it will requiere more time to introduce/tune them for VFW and for bugfix. While the developers during the same time could create more features for higer quality and more speed optimization.
Imagine situation if Pengvado would work hard (spending all his time) on x264 implementation of all features for VFW. Probably there wouldn't be a new RD features like trellis,bime,brdo etc right now (but maybe later)

P.S. There is very high priority for future HD-DVD or/and Blue Ray compability. I'm pretty sure that all devs of all H.264 codecs are strongly wish for their codec compability. That's why there is no Elecard or Ateme/Nero VFW encoder. If not why just don't move to free-license theora? ;)

celtic_druid
22nd February 2006, 18:03
mencoder has more options than VfW, I don't think looses frames and it is here now, no need to wait.

So what exactly is the advantage of avi over mp4 or mkv? If there isn't one then why continue to use it when you could have spec compliant mp4 or at least natively store the video in mkv if you want alternative audio. You don't get compatibility like you do with XviD/DivX, well other than the fact that windows ships with an avi splitter and due to VfW limitations it isn't really any easier to edit.

Tommy Carrot
22nd February 2006, 18:11
You don't understand me correctly.
I absolutly agree with you that x264 can have the same features but it will requiere more time to introduce/tune them for VFW and for bugfix. While the developers during the same time could create more features for higer quality and more speed optimization.
Imagine situation if Pengvado would work hard (spending all his time) on x264 implementation of all features for VFW. Probably there wouldn't be a new RD features like trellis,bime,brdo etc right now (but maybe later)
Sure, the developers have the right to do what they want, no question. What i wrote was just a reaction for the common misbelief here that avc in avi is utter crap, and that some people want to convert everyone to use the cli encoder. Sure, the cli is necessary if someone want to get spec compliance, but if you don't need standalone hardware support, the vfw version is just as good.
P.S. There is very high priority for future HD-DVD or/and Blue Ray compability. I'm pretty sure that all devs of all H.264 codecs are strongly wish for their codec compability. That's why there is no Elecard or Ateme/Nero VFW encoder. If not why just don't move to free-license theora? ;)
But where's the proof that the standalone players will support mp4 container? HD-DVD and Blu-Ray surely won't use it, they'll probably use a VOB or MPEG-like container to store the movies.

Tommy Carrot
22nd February 2006, 18:28
So what exactly is the advantage of avi over mp4 or mkv?
I didn't say it's better (except the editability... i have to disagree with you, even with the frame-drifting it's much easier to edit), my point is that it's not really worse either, definitely not so bad as it is widely considered around here, so if you don't need spec compliance, i see no reason not to use it.

Doom9
22nd February 2006, 18:43
actually, editability is about to become a non issue for MP4: http://forum.doom9.org/showthread.php?t=103918

[)370|\|470!2
22nd February 2006, 18:58
actually, editability is about to become a non issue for MP4: http://forum.doom9.org/showthread.php?t=103918

Isn't it only for linux?

celtic_druid
22nd February 2006, 19:02
No. It is cross platform.

[)370|\|470!2
22nd February 2006, 19:09
I really don't see having to install a splitter as an issue. You need to install an AVC decoder anyway so why not the splitter?

Avi splitter allow explorer to create a thumbnail from 1st video frame. Mp4 nor mkv splitters do such thing. Yea, it could seem silly and funny but for me it has
its aesthetic value. :p Moreover, it's easier to navigate when you see thumbnails. Imo.

ChronoCross
22nd February 2006, 19:15
Sure, the developers have the right to do what they want, no question. What i wrote was just a reaction for the common misbelief here that avc in avi is utter crap, and that some people want to convert everyone to use the cli encoder. Sure, the cli is necessary if someone want to get spec compliance, but if you don't need standalone hardware support, the vfw version is just as good.

But where's the proof that the standalone players will support mp4 container? HD-DVD and Blu-Ray surely won't use it, they'll probably use a VOB or MPEG-like container to store the movies.

The thing is even if mp4 isn't supported on HD players the file is still spec complient and can play perfectly on a PC. Whereas avi has sync problems and isn't going to be supported on standalones either( for h264 playback).

Tommy Carrot
22nd February 2006, 20:26
mp4 (...) can play perfectly on a PC. Yes, but so is avi :p
Whereas avi has sync problemsDunno, maybe i'm doing something wrongly but i never had sync problems.
and isn't going to be supported on standalones either( for h264 playback).True, but MKV will not be supported either, as it's not spec compliant either, and it's still pretty popular around here. :D

Sharktooth
22nd February 2006, 20:35
Old and uncompliant techs should and must not mess with new techs.
AVC in AVI is BAD. Period. The reasons have been explained hundreds of times.
Use a container that was meant to "host" AVC (be it .mkv or .mp4 or even the dated but full compliant .mpg).
AVI is simply NOT GOOD as well as VFW for encoding... let them R.I.P.

pete
22nd February 2006, 20:46
@Tommy Carrot:

Maybe if people like you (who should know better) would stop promoting vfw and advise newbies to use CLI for encoding their content, easy editing alternatives to VirtualDub could actually emerge, since developers would be bugged by their users till they add support for mp4.

ChronoCross
22nd February 2006, 20:50
@Tommy Carrot:

Maybe if people like you (who should know better) would stop promoting vfw and advise newbies to use CLI for encoding their content, easy editing alternatives to VirtualDub could actually emerge, since developers would be bugged by their users till they add support for mp4.

Agreed.

Tommy Carrot
22nd February 2006, 21:01
@Tommy Carrot:

Maybe if people like you (who should know better) would stop promoting vfw and advise newbies to use CLI for encoding their content, easy editing alternatives to VirtualDub could actually emerge, since developers would be bugged by their users till they add support for mp4.
I would like to see that happening too, but since right now there is no real alternative to avi, i have to use what's the the best for me. And arguments like "avi is old and not good for avc" are not really convincing, especially if there is no real technical reason behind it.

xyloy
22nd February 2006, 21:02
Avi splitter allow explorer to create a thumbnail from 1st video frame. Mp4 nor mkv splitters do such thing. Yea, it could seem silly and funny but for me it has
its aesthetic value. :p Moreover, it's easier to navigate when you see thumbnails. Imo.
Haali Matroska Splitter, as well as the Matroska Prop 2.0 shell extension have this function. It's just not activated by default.

pete
22nd February 2006, 21:10
there is no real alternative to avi
...if you are using VirtualDub.

On the other side, why would you even want to edit your files AFTER they are encoded? Any practical uses?

Sharktooth
22nd February 2006, 21:25
The fact is... there are alternatives!
mp4box (and Yamb) support splitting and joining... mkvtoolnix has several editing utils, now avidemux supports mp4...

bond
22nd February 2006, 21:55
avi and vfw means needing lots of hacks and workarounds for getting things to work properly. things that are not needed with newer technologies
thats why avi and vfw are outdated and therefore shouldnt be used (imho)

[)370|\|470!2
23rd February 2006, 00:08
I would like to see that happening too, but since right now there is no real alternative to avi, i have to use what's the the best for me. And arguments like "avi is old and not good for avc" are not really convincing, especially if there is no real technical reason behind it.


:goodpost: I totally agree with that statement.


Haali Matroska Splitter, as well as the Matroska Prop 2.0 shell extension have this function. It's just not activated by default.

Omg. 10x mate ;) as they say it's never too late to learn

edit:
Well, pity but Haali Splitter doesn't do this even when shell extracting enabled :|

xyloy
23rd February 2006, 17:39
there is no real alternative to avi
...There is no real alternative to .MKV :cool:

Chapters, subs(vobsubs or subrip's texte files), it's ability to put a countless number of video and audio steams of different formats in one file, full compatibility with almost every audio/video (lossless or lossy) format(including H.264 and (HE) AAC), and the slightest overhead, etc...

AVI's hardsubbing(only a few standalone players can handle .srt files), hacked VBR audio(and H.264) "support" and large overhead(.OGM is the "winner" for this matter)... not for me!

And if your problem is splitting a file in two CDs or more, MKVmerge can do it for you. :D

See ? Everyone can be stubborn :p

(just joking...)

edit:
Well, pity but Haali Splitter doesn't do this even when shell extracting enabled :|
I suppose it only works with the "miniatures" view mode of Windows's explorer.

EDIT: I've updated my Haali Media Splitter, enabled thumbnail extraction in it's settings, installed the last official version of the Matroska Shell Extension (http://www.matroska.org/downloads/shellextension/), enabled it's directshow decoder during install, and finally rebooted. Now, it works! ;)

Sharktooth
23rd February 2006, 20:04
Just one of the problems caused by AVI:
http://forum.doom9.org/showthread.php?p=789819#post789819