Author Topic: Video Encodery  (Read 11732 times)

FyberOptic

  • King of Earth
  • Administrator
  • Hero Member
  • *****
  • Posts: 2522
  • Oh god what is that?
    • Fybertech.com
Video Encodery
« on: February 07, 2005, 09:43:42 pm »
Such steps are involved in making anything look good and still maintain a reasonable file size.  I figured I'd be encoding things all the time when I got this ATI All-In-Wonder, but it's much more time-consuming than I realized.  I spent a whole day just trying to find how to encode that Power Rangers SPD intro, which is about 60 seconds long.

It's still not down to a science, but I think I came up with what seems to be the best steps to go from TV to an AVI file.

1.)  CAPTURE.  Any program that'll do such a thing is probably fine.  I would prefer to use VirtualDub since it's totally free and I use it later for encoding, but it leaves pops and clicks in the sound at times since it's still in a beta state, so I ended up using Pinacle Studio 8 or a little freeware program called STOIK Capturer.  I prefer to capture the audio/video uncompressed, but this results in huge file sizes.  Like a gig per minute in 640x480.  Though I think using 720x480 may be best for the initial capture, so that's what I've started using.  This is also partially because STOIK lets me encode to a DV Video codec (which required that high resolution), and takes me down to about 200 megs per minute.  THIS IS STILL PRETTY BIG.  If you have plenty of space or are only capturing a short amount of video, it should be fine though, even if you go uncompressed.

2.)  DE-INTERLACE.  I came to realize that when you record from a video source, the resulting file is interlaced.  This resulted in the picture looking jaggy and jerky at times, with what seemed to be lots of horizontal lines in the actual video.  I thought this was a recording problem at first.  Later I found out that with VirtualDub I can use a filter to de-interlace the video.  This squarshes the laced frames together into one.  While this doesn't necessarily look the most awesome if you look close at individual frames (you'll see what looks somewhat like streaking, with two different frames on top of each other), it's all I know of at the moment that works.  I heard of a fancier method to fix this, but it just never worked correctly for me.  OH WELL.  Keep in mind that you would generally do this as part of the next step to save encoding time, but it's worth mentioning seperate.

3.)  RE-ENCODE.  You want this video file to be smaller.  Much smaller.  This means using some codec to compress it, for both the video and audio.  For audio I just told VirtualDub to use standard MP3, in 128kbps.  Easy Peasy.  For the video, I added the de-interlacing filter, added a second filter to resize to 640x480 (using bicubic mode), then selected the codec to compress with.  Xvid seems to be all the rage since it's free and works as good as Divx supposedly, so that's what I used.  It took me quite a while to figure out the best way to do things (and I still dunno what all the stuff means), but if you want the best possible image quality with a smaller filesize, you're gonna want to use the two-pass method.  So, I set it to 1st pass mode, fiddled with a buncha other settings on it, and saved this new avi with the appropriate name. 

THEN COMES LOTS OF ENCODING TIME.  Probably at least 1-2x the time of the video itself.  Just depends on your computer speed mostly.  Mine's an Athlon XP 3200+, but that's just about 2.2 actual ghz.  You'll want as much horsepower as you can get. 

4.)  PASS TWO.  Now you load up the first pass AVI file.  You don't need to mess with the audio this time, so you can just carry the same stream over.  You also don't need the video filters for de-interlacing and resizing.  All you need is to set the Xvid codec options to 2nd pass, which then lets you set the bitrate.  Apparently around 1200 will give you around 10 megs of disk space per minute.  It looked okay too I guess.  Then once you tell it to Save As for this new version, encoding begins again.  It reads in a tiny file that Xvid created for the 1st pass to know how best to do this 2nd pass as best as possible.

MORE ENCODING TIME HAPPENS.

5.)  WATCH.  That's it!  Start it up and watch it.  If it looks crappy, you might have to go raise the bitrate for the video, but that's gonna bring the filesize up more and more depending on how long your video is.  It also means you'll have to wait for it to encode yet again.  There's other options you can mess with in the Xvid codec settings but I won't go and tell you what any of them are or do because I don't really know either.

If you don't care about large filesize, you can just keep the 1st pass file.  It's gonna be a lot larger than a 2nd pass would be, but it's still much smaller than the DV Video or uncompressed source file, and retains almost original quality.  You might wanna keep it anyway, along with the .PASS file from Xvid, in case you ever wanna re-encode it again some other time.  I did this when I made a smaller version of the SPD intro for internet folk to get.

I guess this is about it!  I'll post more tricks I learn as I go on.  Most of this might sound confusing, but I figure if you read this far, you've messed with video encoding before enough to have an idea of what I did.  And if there's any questions, ask away.