Compressing video files

Have a question you need to ask? Need help? Ask here!

Moderator: Core Staff

User avatar
Tonttu
CJ Newbie
CJ Newbie
Posts: 60
Joined: July 29th, 2005, 1:55 pm
Location: Finland

Compressing video files

Post by Tonttu » September 22nd, 2005, 12:27 pm

Here is some tutorials for compressing video files to XviD with VirtualDub.


Why to use XviD instead of DivX?
At least the previous version of DivX codec (DivX5) had a bug that caused the codec not to obey bitrate levels which caused the video to get too big and because of different bitrates of videos (even you set it to use the same bitrate) caused errors in joining the videofiles. Other good reason for using XviD is that it is open source.

Here is what you need:
XviD Codec: http://www.afterdawn.com/software/video ... s/xvid.cfm
XviD Bitrate Calculator: http://www.afterdawn.com/software/video ... ulator.cfm
VirtualDub: http://www.afterdawn.com/software/video ... ualdub.cfm
VirtualDubMod: http://www.afterdawn.com/software/video ... dubmod.cfm
Lame MP3 encoder: http://www.afterdawn.com/software/audio ... ncoder.cfm
RazorLame (graphical user interface for Lame): http://www.afterdawn.com/software/audio ... orlame.cfm

Installing the programs:
Install XviD Codec using the installer.
Install XviD Bitrate Calculator using the installer.
Extract VirtualDub with Winrar anywhere you want.
Extract VirtualDubMod with Winrar anywhere you want.
Extract Lame to C:\Program files\Lame
Extract RazorLame to C:\Program files\RazorLame


If you have problems starting XviD Bitrate Calculator you need VB6 runtime files: http://www.download.com/3001-2070-55312 ... egacy=cnet

If you are planning to join multiple videofiles together I recommend using tutorial 2 or 3 for compressing



Tutorial 1: Basic compression with VirtualDub to XviD (using source audio)


Tools used in this tutorial:
XviD Codec
VirtualDub


1. Open VirtualDub and go to "File" --> "Open video file..." and select the file you want to compress.
2. Go to "Audio" and check that "Source audio" and "Direct stream copy" are selected.
3. Go to "Video" and check that "Full processing mode" is selected.
4. Go to "Video" --> "Compression..." and select "XviD MPEG-4 Codec".
5. Click "Configure" and check that "Profile @ Level" is set to "AS @ L5" and that "Encoding type" is set to "Single pass".
6. Select the compression rate with slidebar or by typing a value to "Target quantizer"
7. Click OK, Click OK again in the next window
8. Go to File and choose "Save as AVI..."
9. Type the name of your file and click "Save"
10. Wait this takes some time depending on your compression rate, how long the video file is and how fast your computer is
11. Enjoy the video




Tutorial 2: Encoding Audio to MP3 with RazorLame


Setting up RazorLame:
1. Open RazorLame
2. Go to "Edit" --> "Options"
3. In the "Lame" field browse C:\Program Files\Lame\lame.exe and click "Open"
4. Click OK
5. If you want to change the bitrate then go to "Edit" --> "Lame options" and change the bitrate.

Using RazorLame:
1. Click "Add" and browse the file(s) you want to compress
2. Click "Open"
3. Click "Encode"
4. Wait



Tutorial 3: Using "Two pass" on VirtualDub compressing to XviD (using source audio)


For Multiplexing audio you should use VirtualDubMod because it has better audio support than VirtualDub but for encoding the video VirtualDub is better

Tools used in this tutorial:
XviD Codec
VirtualDub
VirtualDubMod
XviD Bitrate Calculator
Lame MP3 encoder
RazorLame

1. Open VirtualDubMod and go to File --> "Open video file..." and select the file you want to compress.
2. Go to "Streams" --> "Stream list" there should be 1 audio stream.
3. Click "Save WAW"
4. Type a name for your audio file and click save.
5. Wait
6. Click OK and close VirtualDubMod

Now you need to use the tutorial 2 for compressing the audio file. When yopu are compressed the audio file use the next steps to compress the video and multiplex the audio in it.

7. Open VirtualDub and go to File --> "Open video fiile..." and select the file you want to compress.
8. Go to "Audio" and check that "No audio" and "Direct stream copy" are selected.
9. Go to "Video" and check that "Full processing mode" is selected.
10. Go to "Video" --> "Compression..." and select "XviD MPEG-4 Codec".
11. Click "Configure" and check that "Profile @ Level" is set to "AS @ L5" and that "Encoding type" is set to "Twopass - 1st pass".
12. Click "Advanced Options..." and check that "Motion search precision" is set to "6 - Ultra High" and that "VHQ mode" is set to "1 - Mode Decision"
13. Click OK, Click OK again in the next window
14. Next step is to decide resolution. 640 pixels for width of the video is good. You want to make it 16:9 resolution so divide 640 with 16 (you get 40) now you simply multiply 40 with 9 (you get 360).
15. OK calculations are done. Now go to "Video" --> "Filters..."
16. Click "Add..." and choose "resize"
17. Click OK
18. In the "New width" field type 640 and in the "New height" field type 360 and set "Filter mode" to "Precise bicubic (A=-0.75)". Don't select "Interlaced" or "Expand frame and letterbox image"
19. Now click OK
20. All video codecs love multiplies of 16. So divide 640 with 16 (you get 40 which means that it is multiple of 16) and then divide 360 with 16 (you get 22,5 which means that it isn't multiple of 16). Now you need to get rid of 8 pixels to get it to be a multiple of 16 (360-8=352 --> 352/16=22)
21. You should still be on the "Filters" menu. Now click "Add..." and choose "null transform".
22. Click OK
23. Click "Cropping..." don't touch the "X settings". Change both "Y1 offset" and "Y2 offset" to 4 because you needed to get rid of 8 pixels and click OK
24. Now in the "Filters..." menu click OK
25. Go To "File" --> "Save as AVI..." name it in this format nameoffilehere-1st_pass
26. Select "Don't run this job now;add it to job control so I can run it in batch mode" and then click "Save"
27. OK now the "2nd pass". Go to "Video" --> "Compression..." and select "XviD MPEG-4 Codec".
28. Click "Configure" and check that "Profile @ Level" is set to "AS @ L5" and that "Encoding type" is set to "Twopass - 2nd pass".
29. Now open XviD Bitrate Calculator but don't close VirtualDub leave it on the background.

Now we are using XviD Bitrate Calculator

30. To "Movie lenght" field type the lenght of your video and to "Movie size" field type the size what you want your video to be.
31. Select "Audio" and click "Select Existing Audio File(s)". Choose the audio file(s) and click "Select"
32. Now copy "Video Size" to clipboard and close XviD Bitrate Calculator but if you are planning to join multiple videoclips copy the "Video Bitrate" to clipboard

And back to the VirtualDub

33. Now you should be back on VirtualDub's 2nd pass settings
34. Paste the video size you copied to clipboard in to the "Target size (kbytes)" field but if you are planning to join multiple videoclips click "Target size (kbytes)" so that it changes to "Target bitrate(kbps)" and paste the video bitrate that you copied to clipboard in to the field. You should use the same bitrate for all your videos that you are planning to join together
35. Click OK, click OK
36. Go to "File" --> "Save as AVI..." name it in this format nameoffilehere-2nd_pass
37. Select "Don't run this job now;add it to job control so I can run it in batch mode" and then click "Save"
38. And finally go to "File" --> "Job control..." and click "Start"
39. Wait this takes some time depending on your compression rate, how long the video file is and how fast your computer is

Encoding is now finished. Now we multiplex the audio in it

40. Open VirtualDubMod and go to "File" --> "Open video file..." and choose the video you compressed and click "Open"
41. Go to "Video" and check that "Direct stream copy" is selected
42. Go to "Streams" --> Stream list"
43. Click "Add" browse your compressed audio file and click "Open"
44. Click OK and go to "File" --> "Save as..." and in the "File name" field type a name for your video
45. In the "Save as type" select "Audio-Video Interleave (*.avi)" and click "Save"
46. Wait and enjoy the video


Tutorial 4: Using "Two pass" on VirtualDub compressing to XviD (using external audio)


For Multiplexing audio you should use VirtualDubMod because it has better audio support than VirtualDub but for encoding the video VirtualDub is better

Tools used in this tutorial:
XviD Codec
VirtualDub
VirtualDubMod
XviD Bitrate Calculator


These are almost the same steps as in tutorial 3

1. Open VirtualDub and go to "File" --> "Open video file..." and select the file you want to compress.
2. Go to "Audio" and check that "No audio" and "Direct stream copy" are selected.
3. Go to "Video" and check that "Full processing mode" is selected.
4. Go to "Video" --> "Compression..." and select "XviD MPEG-4 Codec".
5. Click "Configure" and check that "Profile @ Level" is set to "AS @ L5" and that "Encoding type" is set to "Twopass - 1st pass".
6. Click "Advanced Options..." and check that "Motion search precision" is set to "6 - Ultra High" and that "VHQ mode" is set to "1 - Mode Decision"
7. Click OK, Click OK again in the next window
8. Next step is to decide resolution. 640 pixels for width of the video is good. You want to make it 16:9 resolution so divide 640 with 16 (you get 40) now you simply multiply 40 with 9 (you get 360).
9. OK calculations are done. Now go to "Video" --> "Filters..."
10. Click "Add..." and choose "resize"
11. Click OK
12. In the "New width" field type 640 and in the "New height" field type 360 and set "Filter mode" to "Precise bicubic (A=-0.75)". Don't select "Interlaced" or "Expand frame and letterbox image"
13. Now click OK
14. All video codecs love multiplies of 16. So divide 640 with 16 (you get 40 which means that it is multiple of 16) and then divide 360 with 16 (you get 22,5 which means that it isn't multiple of 16). Now you need to get rid of 8 pixels to get it to be a multiple of 16 ( 360-8=352 --> 352/16=22)
15. You should still be on the "Filters" menu. Now click "Add..." and choose "null transform".
15. Click OK
16. Click "Cropping..." don't touch the "X settings". Change both "Y1 offset" and "Y2 offset" to 4 because you needed to get rid of 8 pixels and click OK
17. Now in the "Filters..." menu click OK
18. Go To File --> "Save as AVI..." name it in this format nameoffilehere-1st_pass
19. Select "Don't run this job now;add it to job control so I can run it in batch mode" and then click "Save"
20. OK now the "2nd pass". Go to "Video" --> "Compression..." and select XviD MPEG-4 Codec.
21. Click configure and check that "Profile @ Level" is set to "AS @ L5" and that "Encoding type" is set to "Twopass - 2nd pass".
22. Now open XviD Bitrate Calculator but don't close VirtualDub leave it on the background.

Now we are using XviD Bitrate Calculator

23. To "Movie lenght" field type the lenght of your video and to "Movie size" field type the size what you want your video to be.
24. Select "Audio" and click "Select Existing Audio File(s)". Choose the audio file(s) and click "Select"
25. Now copy "Video Size" to clipboard but if you are planning to join multiple videoclips copy the "Video Bitrate" to clipboard
26. Close XviD Bitrate Calculator

Back to the VirtualDub

27. Now you should be back on VirtualDub's 2nd pass settings
28. Paste the video size you copied to clipboard in to the "Target size (kbytes)" field but if you are planning to join multiple videoclips click "Target size (kbytes)" so that it changes to "Target bitrate(kbps)" and paste the video bitrate that you copied to clipboard in to the field. You should use the same bitrate for all your videos that you are planning to join together
29. Click OK, click OK
30. Go to "File" --> "Save as AVI..." name it in this format nameoffilehere-2nd_pass
31. Select "Don't run this job now;add it to job control so I can run it in batch mode" and then click "Save"
32. And finally go to "File" --> "Job control..." and click "Start"
33. Wait this takes some time depending on your compression rate, how long the video file is and how fast your computer is

The encoding is now finished. Now we multiplex the audio in it

34. Close VirtualDub and open VirtualDubMod
35. Go to "File" --> "Open video file..." and choose the nameoffilehere-2nd_pass and click "Open"
36. Dunno if this is necessary but go to "Video" --> "Compression...", select "XviD MPEG-4 Codec" and click OK
37. Go to Sterams --> "Stream list" click "Add" and select the audio file(s) and click "Open"
38. (optional) Right click the icon(s) and select "Interleaving..."
39. (optional) In the "Delay audio track by" type the value you want
40. Click OK untill you are back in the main window
41. Go to "Video" and check that "Direct stream copy" is selected, you don't want/need to encode the file again
42. Go to "File" --> "Save as..." and type any file name you want to
43. In the "Save as type" select "Audio-Video Interleave (*.avi)" and click "Save"
44. Wait for a while this shouldn't take long
45. Enjoy the video



Tutorial 5: Splitting AVI files with VirtualDub


Tools used in this tutorial:
VirtualDub


1. Open VirtualDub and go to File --> "Open video file..." and select your previously compressed file and click "Open"
2. Go to "Video" and check that "Direct stream copy" is selected
3. Go to "Audio" and check that "Direct stream copy" and "Source audio" are selected
4. Normally people want to split their files in half that's what this tutorial does. There is a slider on bottom of VirtualDub's window. The frame text bellow the slider should say something like "Frame 0 (0:00:00.000) [K]".
5. Move the slider as far right as you can. Now you should see the number of the last frame (it's integer not the time counter).
6. Divide the number of last frame with 2
7. Move the slider back to beginning and click "Home" button on your keyboard
8. Then press "Shift" (keep it pressed) and move the slider to right near the value you got by dividing the number of the last frame with 2. Shift makes VirtualDub to jump between keyframes and not every frame. Keyframes are needed in the beginning and end of the video.
9. Now that you have moved the slider near the value release "Shift" and press "End" on your keyboard
10. Now you should see that half of the timeline is blue. Go to File --> "Save as AVI..." type any file name you want and click "Save". This shouldn't take long so we don't use batch mode.
11. Wait for a while this shouldn't take long
12. Now your slider is allready on the half of the timeline. Press "Home" on your keyboard
13. Press "Shift" (keep it pressed again) and move the slider to the end of the timeline.
14. Release "Shift" and press "End" on your keyboard
15. Go to "File" --> "Save as AVI..." type in any file name you want and click "Save"
16. Wait for a while this shouldn't take long
17. Enjoy the videos



Tutorial 6: Joining AVI files with VirtualDub


IMPORTANT: This will NOT work for files that have different framerates, codecs or resolutions.


Tools used in this tutorial:
VirtualDub


1. Open VirtualDub and go to "File" --> "Open video file..." and select the first part of your video and click "Open"
2. Move the slider in the end of the timeline
3. Go to "File" --> "Append AVI Segment..."
4. Now the file browser should pop up again. Select the second part of your video and click "Open". This is where you get problems if the files have different framerates, codecs or resolutions.
5. Go to "Video" and check that "Direct stream copy" is selected
6. Go to "Audio" and check that "Direct stream copy" and "Source audio" are selected
7. Go to "File" --> "Save as AVI..." and type in any name you want and click "Save".
8. Wait for a while this shouldn't take long
9. Enjoy the video

I noticed that the "Using "Two pass" on VirtualDub compressing to XviD (using source audio)" didn't work well in the previous tutorial. So I added "Encoding Audio to MP3 with RazorLame" tutorial and changed "Using "Two pass" on VirtualDub compressing to XviD (using source audio)" so that you "rip" the audio off the video and multiplex it back in MP3 format to get smaller file.
Last edited by Tonttu on September 30th, 2005, 9:33 am, edited 4 times in total.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » September 22nd, 2005, 3:34 pm

Very nice and very useful.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Neon
Too cool for CoDJumper
Too cool for CoDJumper
Posts: 3535
Joined: April 21st, 2005, 8:54 pm
Location: England, Redditch

Post by Neon » September 22nd, 2005, 5:14 pm

Drofder2004 wrote:Very nice and very useful.
Image
"If we can hit that bull's-eye, the rest of the dominoes will fall like a house of cards...Checkmate."
"Seriously... .45k/sec it is a joke.. I could have just gone out and taken my own photos of children in this time."
"You have just become my fave youtuber!" - KillerSam in regards to myself. Win.

User avatar
MuRpHy*
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 2159
Joined: May 10th, 2005, 11:02 pm
Location: Tha A.T.L Baby ;)

Post by MuRpHy* » September 22nd, 2005, 9:45 pm

i agree, nice tutorial.
Image
Image

User avatar
Tonttu
CJ Newbie
CJ Newbie
Posts: 60
Joined: July 29th, 2005, 1:55 pm
Location: Finland

Post by Tonttu » September 30th, 2005, 9:32 am

Tutorial is now edited so you get better quality using "Tutorial 3: Using "Two pass" on VirtualDub compressing to XviD (using source audio)". Because of the changes in "Using "Two pass" on VirtualDub compressing to XviD (using source audio)" I also added new tutorial "Tutorial 2: Encoding Audio to MP3 with RazorLame".

User avatar
Neon
Too cool for CoDJumper
Too cool for CoDJumper
Posts: 3535
Joined: April 21st, 2005, 8:54 pm
Location: England, Redditch

Post by Neon » September 30th, 2005, 4:17 pm

nj m8 :) gd work :P
Image
"If we can hit that bull's-eye, the rest of the dominoes will fall like a house of cards...Checkmate."
"Seriously... .45k/sec it is a joke.. I could have just gone out and taken my own photos of children in this time."
"You have just become my fave youtuber!" - KillerSam in regards to myself. Win.

User avatar
MuRpHy*
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 2159
Joined: May 10th, 2005, 11:02 pm
Location: Tha A.T.L Baby ;)

Post by MuRpHy* » September 30th, 2005, 10:02 pm

Neon wrote:nj m8 :) gd work :P
Image
Image

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » October 3rd, 2005, 10:01 pm

lol neon and murphy got an agreement to quote each others posts or something? :P
very nice tut, i mentioned virtualdub ages ago but noone seemed interested :), but divx is better than xvid in my experience :lol: great info tho m8 thx

User avatar
MuRpHy*
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 2159
Joined: May 10th, 2005, 11:02 pm
Location: Tha A.T.L Baby ;)

Post by MuRpHy* » October 3rd, 2005, 10:37 pm

no neon started doing it, and i just followed ;)
Image
Image

User avatar
Neon
Too cool for CoDJumper
Too cool for CoDJumper
Posts: 3535
Joined: April 21st, 2005, 8:54 pm
Location: England, Redditch

Post by Neon » October 3rd, 2005, 11:04 pm

MuRpHy* wrote:no neon started doing it, and i just followed ;)
it was soviet ;)
Image
"If we can hit that bull's-eye, the rest of the dominoes will fall like a house of cards...Checkmate."
"Seriously... .45k/sec it is a joke.. I could have just gone out and taken my own photos of children in this time."
"You have just become my fave youtuber!" - KillerSam in regards to myself. Win.

Luke
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 1774
Joined: May 31st, 2005, 12:42 am
Location: Cornwall, UK

Post by Luke » October 3rd, 2005, 11:34 pm

rofl, i do it sometimes too, just noticed u guys were emerging a pattern :P

Soviet
Core Staff
Core Staff
Posts: 7760
Joined: April 23rd, 2005, 9:12 pm
Location: Plano, Texas
Contact:

Post by Soviet » October 4th, 2005, 12:10 am

Neon wrote:
MuRpHy* wrote:no neon started doing it, and i just followed ;)
it was soviet ;)
kiss my ass :wink:
Image
ImageImageImage
Image
"Zaitsev is a cunt." - Pedsdude

User avatar
Neon
Too cool for CoDJumper
Too cool for CoDJumper
Posts: 3535
Joined: April 21st, 2005, 8:54 pm
Location: England, Redditch

Post by Neon » October 4th, 2005, 7:54 am

Soviet wrote:
Neon wrote:
MuRpHy* wrote:no neon started doing it, and i just followed ;)
it was soviet ;)
kiss my ass :wink:
nah im gd thx :wink:
Image
"If we can hit that bull's-eye, the rest of the dominoes will fall like a house of cards...Checkmate."
"Seriously... .45k/sec it is a joke.. I could have just gone out and taken my own photos of children in this time."
"You have just become my fave youtuber!" - KillerSam in regards to myself. Win.

User avatar
MuRpHy*
Past/Inactive Team Member
Past/Inactive Team Member
Posts: 2159
Joined: May 10th, 2005, 11:02 pm
Location: Tha A.T.L Baby ;)

Post by MuRpHy* » October 4th, 2005, 1:03 pm

:P rofl....
Image
Image

Soviet
Core Staff
Core Staff
Posts: 7760
Joined: April 23rd, 2005, 9:12 pm
Location: Plano, Texas
Contact:

Post by Soviet » October 4th, 2005, 1:42 pm

Neon wrote:
Soviet wrote:
Neon wrote: it was soviet ;)
kiss my ass :wink:
nah im gd thx :wink:
no, its okay, i know you want to, just admit it :wink:
Image
ImageImageImage
Image
"Zaitsev is a cunt." - Pedsdude

Locked

Who is online

Users browsing this forum: No registered users and 5 guests