I knew live streaming of VP6 was impossible, but in my recent research, even automated encoding of it is complicated, and almost impossible to do free as well. [VP6 is a video codec, format, supported by flash, flash supports only 3 codecs]
Then I remembered about a comment on a forum post of mine. Use h.264! h.264 was just recently added to flash, which can be a problem for some people, on the up-side, it can have better quality then VP6, and there’s several open encoders for it!
First thought: Encode with VLC.
Problem: VLC’s mp4 muxer doesn’t seem to work for Flash. Odd.
Then I found this guide.
In that guide, it uses several programs to encode into a h.264/aac video. A little longer then I wanted, but I managed to get it working.
After nearly 2 weeks of work perfecting and fixing problems arising in the encoder, I finally have a working encoder script. [Note to all: Timecodes, missing frames, and variable frame rates annoy the heck out of me now]
Meaning that I can finally allow uploads to Capped – my demoscene flash video site.
My method is even longer then the one outlined in the guide above. I was aiming for quality.
Here’s a step-by-step guide on how my encoder script works: [For the curious, also may help others]
1) Obviously, get a video. My encoder grabs it from a “to encode” directory, along with a info file provided by the uploader.
2) Use getid3 on the video to get the video size. [May require a few recursive functions to explore the output array find the size]
3) Calc the new video size [on capped it's 450x338, may be changed to 640x480 for full-screen videos] and then pass the video into VLC to resize and dump raw frames to a file.
4) VLC takes care of sync and all those codec issues.
5) Pass the video into mencoder + x264 [Available on the original guide above]
6) Pass again with the second pass params set
7) Split audio from VLC’s file
8 ) Pass audio through a aac encoder. Two pass again since it doesn’t take too much time. [Once again available on the original guide]
9) Shove the newly encoded video and audio together using mp4box. [Etc]
10) You have a video playable in the latest version of flash. [Capped here would publish the video to the web folder and sync it across servers]
The encoder takes about 10 minutes to encode a 5 minute video.
Anyway, Capped will require users to sign in with their sceneid in a attempt to keep it demoscene-only. I have it setup on two fairly powerful servers to keep the encoding time low. I’m planning on allowing url downloads so people won’t have to upload large AVI files already available on the internet.
Capped will be out sometime in the next 2 weeks.
And sorry if this blog entry is a bit odd, I’m tired.
Looks good to me! if you ever feel like giving the source out, my email is in the comment somehwere in your database
.
It’s good to actually see some people who explain HOW this is all done. I am on Windows XP, however, and I cannot seem, for the world, to find a way to encode my video to mp4/h.264! I found a nice little app that does that, but Flash doesn’t like it – either doesn’t play it, or plays it garbled. The app is called SUPER, by eRightSoft – I cannot figure out whether the problem arises out of the app, or the codec that I have installed (I THINK it’s x264, but honestly, I am already so confused with this codec stuff, it’s not even funny anymore). Any ideas on how to successfully convert my screen-captured-AVIs (via Cam Studio) to Flash-playable mp4s??
Thanks a bunch!
Aoironeko – I use mostly command-line based tools for encoding.
http://images.micksam7.com/lame-mp4-encoder.7z is the set I use.
I included a little readme.txt file in there to help a bit. Just poke me if you need anymore.