Look at this site to choose from free encoders.
This is from Wikipedia.
YouTube’s video playback technology is based on Macromedia’s Flash Player. This technology allows the site to display videos with quality comparable to more established video playback technologies (such as Windows Media Player, QuickTime and RealPlayer) that generally require the user to download and install a web browser plugin in order to view video. Flash also requires a plug-in, but Adobe considers the Flash 7 plug-in to be present on about 90% of online computers. Users can view videos in windowed mode or full screen mode and it is possible to switch modes during playback without reloading it due to the full-screen function of Adobe Flash Player 9. The video can also be played back with third-party media players such as GOM Player, gnash, VLC as well as some ffmpeg-based video players.
Videos uploaded to YouTube are limited to ten minutes in length, and a file size of 1GB. One video at a time can be uploaded through the standard interface, and multiple videos can be uploaded with a Windows based plugin. YouTube converts videos into the Flash Video format after uploading. YouTube also converts content to other formats so that it can be viewed outside of the website (see below).
YouTube accepts uploaded videos in the .WMV, .AVI, .MOV, MPEG and .MP4 formats. It also supports 3GP, allowing videos to be uploaded directly from a mobile phone.