Creating 2-pass On2VP6 FLV files for free

MarkWWW wrote on 7/19/2007, 1:01 PM
I've recently been investigating creating .FLV files, a format that sadly Vegas can't yet render to on its own.

As I'm purely an amateur and do this stuff only for my own amusement I was looking for a way to do it for free if possible, or for very little money if not. I found that although it is easy to create the earlier Flash6/Spark/FLV1 format files using a number of free utilities (SUPER, a friendly front end for FFMPEG, is the example most often suggested hereabouts) it did not seem to be possible to create the much superior Flash8/On2VP6 format files without spending some money. I've not been very impressed with the quality of the Spark FLV files I've seen (this is the format used by YouTube) so I was keen to be able to create On2VP6 FLV files if at all possible. The cheapest way to create On2VP6 FLV files seemed to be with On2's Flix software, but annoyingly the affordable version restricts you to only creating files using one-pass rendering - two-pass rendering is only available in the much more expensive versions which are way out of my price range for amateur dabbling.

But after a bit of hunting around the WWW I have discovered that it is possible to create two-pass-encoded On2VP6 FLV files without spending any money at all (so long as it is for private use only). What follows is a description of how to do it, in case anyone else is interested in creating FLV files from their Vegas videos. (I don't make any claims to have invented any of this myself - all the information has come from Klaus Post's webpage here and the pages he links to - I've merely simplified the procedure to do as much of the work as possible in Vegas.)

Creating the FLV is a two-stage process. The first stage uses Vegas to render the video to a On2VP6-encoded .AVI file and the second stage uses a modified version of FFMPEG to extract the audio and video streams from the AVI and put them into a FLV wrapper.

0 - Preparation:

First you need to install the On2VP6 VFW codec which can be downloaded from here (free for personal use.) Then you need to download the modified version of FFMPEG which can be obtained from here and unzip it into a convenient directory somewhere on your PC.

1 - Creating the VP6 AVI

For some reason the FLV format seems to have a different idea of which way is up than the AVI format does. This means that unless you take steps to correct it your video will play back upside down once it has been converted to FLV. To compensate for this you need to render your VP6 AVI upside down. You could do this using Track Motion in Vegas, but it's much quicker to use the free Adam's Flip plugin which can be downloaded from here

When you've finished editing and are ready to render, add the "Adam's Flip Vertical Only" effect to the Video Output FX (you'll see the Video Preview will now turn upside down) and then click on File|Render As... Then choose "Video for Windows (.avi)" and click on the Custom button.

Under "Video Format" choose "VP62 Heightened Sharpness Profile" and choose suitable values for Frame Size, Pixel Aspect Ratio, etc - in testing I've used 320x240, PAR 1.000, Progressive, 25fps. Then click the Configure button and on the Settings tab choose Two Pass - First Pass. You can go to the General tab and vary some of the setttings if you like, but I have just left things as they are preset - 300kbps VBR. Then click OK. Now on the Audio tab choose MPeg Layer 3 and choose a suitable bitrate. All FLV files I've ever seen have used MP3 audio but I'm not sure if there are any restrictions on bitrates, etc. In testing I've used 56kbps, 22.050kHz, Stereo which seems to work OK. Now click on OK, choose a suitable filename, and finally click on Save to start the first pass of the render. (After the render is completed you will have an .avi file and a pair of files called firstpass.fpf and firstpass.fpf.sst which presumably contain the details that will guide allocation of bits in the second pass.)

Now click on File|Render As... again and make the same setting changes under Custom as you did the first pass, except this time choose "Two Pass - Second Pass - Local File Playback" on the Settings tab in the VP6 Configuration page. (To save time you could save these combinations of settings as templates, of course.) Now click OK, then OK again, and finally click on Save to start the second pass of the render (choose to overwrite the avi file that was created by the first pass). Eventually you should end up with a two-pass On2VP6-encoded .avi file. If you play this file using a file player you will find that it is upside down but otherwise plays OK (though it will probably only play on machines that have had the On2VP6 codec installed on them).

2 - Wrapping the Audio and Video streams in an FLV wrapper.

Copy the modified version of the FFMPEG .exe file to the directory where the VP6 .avi is located and then open a command prompt window and browse to the appropriate directory and issue the following command (this assumes the .avi is called test.avi):

ffmpeg -vcodec copy -i "test.avi" -acodec copy -i "test.avi" "test.flv"

Now play the .flv file in your favourite Flash video file player and you should find that it works OK (right side up now, of course).

(The "-vcodec copy" and "-acodec copy" bits tell FFMPEG to use the streams as is, i.e. without recoding, so it just takes the audio and video data and wraps them up in a FLV wrapper and saves it as test.flv.)

Hopefully Vegas 8 will be able to render to Flash so all this will be unnecessary but I thought I'd post the details here in case anyone was interested.

Mark

Comments

apit34356 wrote on 7/19/2007, 2:22 PM
Thanks Mark for the reminder about 2V6.
CClub wrote on 7/19/2007, 6:42 PM
Mark,
I downloaded all the files and copied your instructions. If that works as you say, that's a great help to me also, as I'm not going to spend $100's on a program I'll use like 4 times. Thanks for taking the time.
DJPadre wrote on 7/19/2007, 7:28 PM
my biggest issue here is the flipping, being that those working in interlaced formats will be prety much nuking their field order, as vegas itself will rebuild that order back to lower field (for DV) if the original has been flipped around.
One way round this of course is to use progressive.. but its somethign to think about
.
CClub wrote on 7/19/2007, 8:11 PM
But given that you're likely going to be using the rendered file on a computer (why else would you use the flv format), wouldn't you want it in a progressive format anyways?
DJPadre wrote on 7/19/2007, 8:59 PM
why not render to progressive?? motion blur, sharpness, camera motion, etc etc all affect the way a video is percieved. Some ppl are dumb enough to think that a web demo is what an actual DVD might look like.. i kid u not.. those uneducated people make decisions based on what they see and even though you and i know that compression is heavily used to make it downloadable, some people dont see it this way. In turn, their final judgements to the work their seeing are not only basedon compostion filming and editing, but also the final delivery "qualtiy"

yes there are dopey ppl out there and we gotta cater for them too im afraid
riredale wrote on 7/19/2007, 9:10 PM
What's been your experience with 2-pass? Someone on this Board mentioned last year that he didn't see much difference in the encoded flv files between 1 or 2-pass.
farss wrote on 7/20/2007, 5:58 AM
Oh boy, did you say a mouthful.
One client had me encode to flash to his clients specs, postage stamp sized stuff for streaming. First thing the end client does is blow it up full screen and then complain it doesn't look very sharp.

Bob.
DJPadre wrote on 7/20/2007, 9:09 AM
u got it in one bob...
Jay Gladwell wrote on 7/20/2007, 9:14 AM

Bob, and what was his response when you explained the facts of life to him?

Billy d wrote on 7/20/2007, 4:18 PM
Great info. Little too late for me though, I bought the cheap one-pass version of on2's software a couple of weeks ago.
The quality (at the small sizes I want it for, 320x240 and smaller) is great. Amazing compared to wmv's done in Vegas.
Well worth buying.

Came across that upside down thing too.
In order to get widescreen I encode the avi with a PAR of .9091 and then encode with the on2 software. However it comes out upside down (but only if you do not use the standard PAR for widescreen 1.2something).
Fix was to encode the avi uncompressed in vegas (at .9091).
Now on2 produces it right side up and letterboxed.
Of course you need rather a lot of spare space on your hard drive!
Hmm, I aught to try the Adams flip plug in though.

As far as quality goes - I doubt that you would notice the difference between one and two pass at the small sizes I'm greating.
Laurence wrote on 7/21/2007, 8:16 AM
To my eyes, there is a world of difference between 1 and 2 pass flv encodes. I do a lot of outdoor stuff and the scenes with lots of grass and leaves benefit greatly from the extra data that the 2nd pass lets you add to the parts of your video that need it. Two pass encodes can't be used for streaming video, but for the progessive download that most of us use, they really make what the final viewer sees look good.
Coursedesign wrote on 11/10/2007, 11:54 AM
Two pass encodes can't be used for streaming video

Exactly how would the streaming server know if the file it is asked to stream went through one or two passes during its encoding?


UKAndrewC wrote on 11/10/2007, 3:15 PM
I appreciate it's free but even so I don't understand why you would go to all that trouble when the Flix Std encoder is only $39?

Andrew
Terry Esslinger wrote on 11/10/2007, 3:58 PM
<<First you need to install the On2VP6 VFW codec which can be downloaded from here (free for personal use.) >>

Downloaded the codec but V7 dows not recognize it and bring it up as a choice!!!!

Also Andrew,
Cannot find Flix standard to download or check out. Do you have a link?
rmack350 wrote on 11/10/2007, 4:11 PM
It's an AVI choice, which is probably why you don't see it, and why the complex process of getting an FLV file out of it.

If time is money then spending the 40 bucks or even 400.00 bucks is worthwhile. If time is no object then maybe this is the method.

Seems like I was just looking at something in Ubuntu that makes FLV files...

Rob
Terry Esslinger wrote on 11/10/2007, 6:07 PM
I would be willing to spend the $40 if I could find the product??
MarkWWW wrote on 11/11/2007, 3:50 AM
Because, as I said in the original post, the affordable encoder (your $39 one) will not allow you to do a 2-pass encode. To get the 2-pass facility you need to pay the much larger fee for the "Pro" version.

Or, if you are prepared to fiddle about a bit, you can do it for free using the method I described.

Mark
UKAndrewC wrote on 11/11/2007, 6:26 AM
Flix is here : http://www.on2.com/index.php?387

At the resolutions generally used for FLV, there is no discernable quality difference between 1 and 2 pass.

The best results I have obtained are to use DVD quality MPEG output from Vegas then encode single pass with Flix.

Andrew
deusx wrote on 11/11/2007, 9:24 AM
Playing with different settings, Variable 1-2 pass, and bit rates, you can see the difference or feel it in download times.

But VP6 being vastly superior to Squeeze.... not true.
I can see right away that VP6 produces more contrasty images, which is not necessarily better, but as far as artifacting and stuff that really matters, you need a microscope to see the difference. And file sizes are roughly the same for similar quality.

Maybe VP6 is better at low rate encoding, video at 500 kbs or lower, but if you want to produce that kind of crap , you shouldn't be in this business.