Jump to content

Video Compression for the Web - Tutorial


[PiG] Ponch

Recommended Posts

[PiG] Officer Frank "Ponch" Poncherello's Video Compression for the Web Tutorial.

From looking around for MTA videos on the forums I've found that a lot of people seem to be using poor compression ratios for their videos and end up with HUGE files. And now with the MTA video competition on its way I thought I would be good idea to post a tutorial for people who want to cram their masterpice into the smallest file size possible. Please note that I'm not going to cover editing of the footage you record or how to attach an audio file to your footage. (I've got links down below for that if you need to know how to do it.)

This tutorial is an addition to Thargore's Newbie Guide. Found here...

https://forum.multitheftauto.com/viewtopic.php?f=46&t=2651

PLEASE NOTE: I AM NOT EXPLAINING HOW TO CAPTURE YOUR FOOTAGE. I AM EXPLAINING HOW TO ENCODE PROPERLY!

You can make videos very small and not lose too much image quality if you know what you are doing. When you publish videos to the net you need to compress your video according to what the target market's requirements are. There is no point making a video at full resolution or at partial compression when the end viewer is only going to view the file once or twice.

With this tutorial I'm hoping I can show some budding directors how to prepare their video for the web with optimal image quality and sound with the smallest file size possile.

Tools: Fraps 3.2.2 (http://www.fraps.com)

Divx 5.X.X (http://www.divx.com)

VirtualDub (http://www.virtualdub.org)

Part #1: Video Resolution and FPS

When making a video there is no need to bother recording it a full resolution of your game. You will loose most of the image quality when compressing anyway. A good place to start at would be to set your game at 640x480x16bbp and then set FRAPS to record at half-size with no audio (you're going to replace this with music, right?). This will give you a final destination resolution of 320x240x16bbp.

Before you start telling me how crappy those settings are, let me remind you that we are making this video for a WEB based audience amd are aiming for a SMALL file size. With these settings Fraps will have the least effect on the game playing itself and you will not loose many ingame FPS

f3-movies.gif

So goto this screen from within fraps and change the settings. (N.B. this image show the default settings!) Don't forget to change the default 'hotkey' to something more convenient.

You are now ready to capture your video to your harddrive. At these settings each minute takes about 100Mb on your drive, so make sure you have enough space to record!

Once you've finished recording your footage you can now go and edit what you have and once you've done that, it's time to compress your masterpiece. You can edit with a bunch of tools available on the net. Just search google for a free video edit suite. In fact, if you want, VirtualDub CAN edit video and add the music for you; it will just take a bit longer to figure out than say an expensive program like Adobe's Premier. Goto this site http://www.virtualdub.org/ if you want to find out how. Like I said I wasn't going to go into detail here...

Part #2: Compression

There are many codecs out there for compressing. With Windows Media format, DivX and XviD being the most common these days. Personally I prefer DivX over the others because it seems to be the most common one people have installed and I also find it the easiest to use and install.

Right, first of all open VirtualDub and then open up your edited video that you want compressed.

vdub-open.jpg

Now you need to setup the video compression settings for the movie...

vdub-compression.jpg

You'll be prompted with a screen asking which codec you which to use. For my tutorial choose DivX...

select-compression.jpg

Click OK and be greeted by the DivX main screen. This is the where you set all the required codec settings.

divx1.jpg

These are DivX's default settings. They give a pretty good picture quality as defaults but this won't be good enough to get the small file size we want. The encoding bitrate is the main setting we want to change to have the most effect on the overall filesize. Don't worry about the other DivX options as these are for making advanced changed to you video. (if you want to learn more about this goto http://www.divx.com). I'll explain more about the bitrate in a second, just click ok and we'll look at it again later...

Next we have to setup your audio compression. (I take it you've already got your music attacted to your video, If you don't go to http://www.virtualdub.org to find out how). N.B. VirtualDub only handles raw WAV files as input sound, so we have to set VirtualDub to full audio processing mode to allow the program to compress the audio.

audio-full.jpg

Now choose compression from the dropdown menu...

audio-compression.jpg

Now we are faced with a screen similar to the codec choice screen but for audio codecs.

mp3-compression.jpg

Now choose an audio compression. Don't choose the best quality. We are trying to make our video as small as possible remember? I find "56KB/s 22.5KHz stereo" to be the smallest acceptable size vs quality. Anything lower than this starts adding many artifacts to the sound signal. Now we have got the smallest acceptable size for audio encoding we can now start to mess around with the video encoding bitrate.

Click "Ok" to close the windows and go back to the main VirtualDub screen.

Now we are going to render a test AVI of your work.

vdub-save-avi.jpg

This will encode your footage along with the audio to a nicely compressed AVI on your drive.

Now go to your newly encoded file and check the filesize and the quality of the image. If the filesize is too large you will need to go back to the DivX codec page in VirtualDub and reduce the encoding rate and re-encode the file again. Keep doing this until your file reaches the size you want. If possible, don't be afraid to reduce the encoding rate as much as you can. With DivX there seems to be not much difference in image quality when you start reducing it quite a bit compared to a slightly higher bitrate. Personally I have managed to encode something for a friend at 150kb/s and it looked the same as it did at 300kb/s! But I don't think you need to do any bitrate that drastic yet, unless your footage is extremely long.

If you have encoded your footage (in your opinion) at the lowest acceptable bitrate and the file size it just off what you wanted, you can still pull some tricks out of the bag with DivX to make the file a wee bit smaller.

divx2.jpg

Goto DivX's second page and you'll have a bunch of options available to you. The settings we want to mess with is 'Psychovisual Enhancement' and 'Pre Processing Source'.

'Psychovisual Enhancement' removes all the data the eye is not going to notice is missing, hence dropping the amount of information required per frame. If you are going to use this, try the different setting available as each one has a slightly different effect on your video. Re-encode serveral times to see the difference it makes.. ask yourself: is it worth quality of the picture to get the smaller filesize? (I'd say in most cases - YES!)

The next setting is 'Pre Processing Source'. This is simply a noise filter for your video. Basically the more detail the video source has the more data is going to be required to encode it. Using this setting removes 'loose' pixels in the image that aren't 100% required. Set this to light to start of with as it has a big impact on your final encoding's image quality. Setting this to max can make the image look a bit washed out but it does make a big impact on the final file size.

I hope this has been some help to people. Just remember you want to aim for a small file size. Who wants to bother downloading a 100Mb file only to find out it's crap? I'd much rather prefer the small convinient filesizes whether the end result is good or bad. No one is going to judge you because you encoded your file with a low bitrate. Just remember you can encode a 2 hour movie onto a single 700MB disk at near DVD quality at full resolution. That's about 6 MB per minute. If you want to encode your video for the web then you'll be wanting to do this at about 1-3 MB per minute. Might not look like you're at the movies, but hey, it does the job...

[PiG] Officer Frank "Ponch" Poncherello

EDIT: slight correction...

"56kb/s 44.1Khz stereo" has been changed to "56kb/s 22.5Khz stereo" under the audio compression section. Your ears won't realize the difference but you harddrive will. :wink:

Edited by Guest
Link to comment

Thanks for the feedback so far :)

It's best to get the latest divx (5.1.1) as there as heaps of improvements to the compression and to the image quality. Still the same settings. Plus as the pic above says: "it's twice as fast as their last release". That means less time waiting to encode :)

:)

Edited by Guest
Link to comment

Just remember that Fraps 1.9 doesn't do half size captures so the file raw filesize will be bigger. You'll still be able to get a small filesize once you start compressing with VirtualDub.

you can order the full "unlocked" version of FRAPS 2.0 for only US$29.95 by clicking below:

Fraps 2.0 purchase

It's worth buying if you think you're going to use this program heaps or if you want the new functions of 2.0 (like half screen and the smaller 'raw' filesize it produces)

:) Thanks for all the feedback so far :wink:

Link to comment
  • 3 weeks later...
Zipping a vid wont help cut down the size since its already compressed,infact you will make it bigger,dont try and compress somethign thats already compressed (btw .mpg and .mp3 are compressed)

isnt there somewhere that you could strike a balance between those 2 then? like compress it some with a movie compresor, and then compress it the rest of the way with winzip? just a thought

Link to comment
Just remember that Fraps 1.9 doesn't do half size captures so the file raw filesize will be bigger. You'll still be able to get a small filesize once you start compressing with VirtualDub.

I understand that you've tried to make this tutorial as simple and idiot-proof as possible, so far so good. :)

The one thing I'd like to add is that it is always better to capture at the highest resolution your system can handle, then resize it during the encoding process.

For example, capturing at 1280x960 and using two 2:1 reduction (high quality) filters in VirtualDub to bring it down to 320x240 will give a better quality final video than capturing at 320x240.

Link to comment
  • 7 months later...
  • 3 weeks later...
  • 1 month later...
  • 4 months later...

Wow only just seen this tut, very nice when i tryed to select the div x codec it wasnt a option available (even tho div x was installed)

I downloaded BigFix1.6b (freeware) that told what i needed and problem was fixed. :P

Link to comment
  • 8 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...