   [web] Uploading videos to a website ala Youtube/Vimeo etc?
  I'm working on a web project and the client would like the ability for registered users to upload and post videos from their computer, in a similar style as YouTube or Vimeo. I suppose this boils down to 3 things:A) File uploadB) Encoding to a common format (probably FLV)C) Updating the website and databases with the new videoNow C) is trivial to do. I am guessing A) can be done pretty easily as well (and I'm sure I can find out some Flash file uploaders if I look around, or quickly whip out my own).Now the real problem is B) Encoding all the uploaded videos to a common format. Does anyone know of any good CGI libs or programs that can do that for me? Or would I have to write up something myself (possibly using some of the open-source encoders as a base).My host will most likely be apache/linux, but that is not set in stone yet.   
  Heya!I implemented this on the commercial game "line rider" so it is indeed possible!  They also did this for the spore creature creator.Here's what my experiences were, yours may vary (it was like 2 years ago so things might have changed)A) File uploading - We had to contact youtube and get permission to do this.  They were real friendly and allowed it and gave us access to a web based API to upload videos.  It wasn't too hard to get it working (:  We let people put their username and password in from in game and it would upload their video straight to their youtube account.  Youtube had some very specific rules about how you had to do things, some instructions were "do this" and some were "don't do this" and some were "do it however you want".  I used libcurl to talk http to their servers and it worked nicely.B) Encoding to a common format - I forget the function name, but there is an API for recording video from a windows application.  Basically, it makes a window popup where it allows the user to choose any of the encoding codecs stored on their computer and they choose which one they want to use.  If part of your game installer installs a video codec of your choice, you can instruct the user to use that codec perhaps?  There are licensing fees on most video codecs which is lame, but there are some free ones built into windows that may be good enough for your purposes since youtube will convert it to their own format after upload anyhow!  How we did the video recording was take a screen cap every frame and saved it to disk, and then afterwords we had the video codec put all those screen caps into a video.  DETAILS ABOUT HOW TO HANDLE SOUND LOWER DOWN - VERY IMPORTANT!C) Updating the website and databases with the new video - Yeah, this is just part of the youtube API, check out the reference for that for more info!  I think there may be some public access allowed, but if you go for commercial use, i think thats where you have to get special permission from them.SOUND:  Capturing sound for your video capture is actually kind of a difficult process.We tried a couple of things before finding the good solution.#1 - we tried "just recording".  The problem here is that how video recording works, it takes a screen cap and writes it to disk every frame, which slows things down A LOT.  That means maybe your game is running at 10fps (or less) instead of 30, but your sound is still running at full speed.  It makes it really weird when you put the video together, the sound is too fast (like the chipmunks)#2 - we tried artificially slowing down the screen capture to something like 5fps, and slowed down the sound to 1/6th the speed.  Our hope was that all video recording would be AT LEAST 5fps.  As long as that was true... our video and sound would stay synchronized.  Problems - sometimes recording was A LOT SLOWER.  Also, recording sounded really weird (all the sound effects were really low pitch) and took forever (at 5 fps it took 6 times as long as real time!)#3 - the solution!So the solution is actually kind of nice...A) let the person initiate when they want to start the recording and when they want to stop recording.  During this time, play the game at full speed and just keep a record of what sound effects and music was played at what frame #'sB) After the person presses stop, put up a progress bar "rendering movie please wait" and then re-simulate what the player did, let it run at FULL SPEED, and take screen caps of it, write them to disk, but never display them to the screen.  Instead, just show the progress bar progressing forward.  You know how far % wise the movie is from being done because you know how many frames you have to render and you know how many you have rendered.C) When that's done, next up what you need to do is use your timeline of sound effects and music to reconstruct a wav file (or mp3) of your timeline.  There are programs out there which let you do mixing of sound effects so that for instance you could mix 2 wave files together into a resulting sound file.  Mix all your sound effects and music together from your timeline, offset by the right amounts and then bam, at the end you have the sound track for your video.D) combine the sound track and your screenshots into a video with sound.  The video will run at full speed (no lag, even if the game lagged during the "recording" process) and the sound will be perfectly in sync.grats you win :P   ;Quote:Original post by KoobazaurNow the real problem is B) Encoding all the uploaded videos to a common format. Does anyone know of any good CGI libs or programs that can do that for me? Or would I have to write up something myself (possibly using some of the open-source encoders as a base).One word: ffmpeg. Or have a look at mencoder or transcode. I'm assuming here that you're on a *nix-ish webserver (i.e. Linux).;  Ah sorry, i misunderstood what you were trying to do.Hopefully some of the information is still relevant.   ;Quote:Original post by SanderOne word: ffmpeg.What he said.You might have to play with the configuration to roll your own compilation with the file types and options you want included. You also have to be able to put this on the server. If you want to go the "youtube" route, try encoding to FLV (flash). I highly recommend using Flowplayer. If you do, you make sure to pay for a license and support the good work they do.* Word of caution: Until the dust settles from the Apple vs. Adobe vs. Google vs. Flash vs. HTML5 issue, this is my advice. If Flash ends up being yesterday's news and some other video format comes to the fore, you might have an issue with having to convert a stack of videos for which you have no originals. In the meantime, you might have an issue with Apple/iPhone (if that matters to you).   ;Quote:Original post by leiavoia* Word of caution: Until the dust settles from the Apple vs. Adobe vs. Google vs. Flash vs. HTML5 issue, this is my advice. If Flash ends up being yesterday's news and some other video format comes to the fore, you might have an issue with having to convert a stack of videos for which you have no originals. In the meantime, you might have an issue with Apple/iPhone (if that matters to you).Disk space is cheap. You might as well keep the original videos around so you can convert them to Theora or VP8 later on when the dust settles. Or you could go the fancy route. Offer HTML5+Ogg/Theora and offer FLV+Flowplayer for those without HTML5 support.   