Sign up ×
Video Production Stack Exchange is a question and answer site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation. It's 100% free, no registration required.

Related to What codecs/formats are appropriate for full motion video recording for youtube? I'm wondering exactly how I can expect Youtube to handle my videos. I know they have a rather zealous processing set up that generates multiple copies of my upload at different resolutions; 1080p, 720p and 480p and apparently a mobile one, at the very least.

What codec(s) do they use? As a producer I have an option to download the file as an MP4; however I note a third party downloader (which is extremely shady and crappy) brings the files down as FLV. I'm basically wondering if my codec is going to be preserved or overwritten with H.264 or whatever they use. Considering their amazing compatibility across devices I assume they either use a very common standard or multiple codecs for each video.

So what codec can I expect my videos to be output in, and if it depends, what does it depend on? Should I adjust my own encoding to "play nice" with Youtube's codec, or does it matter, quality-wise? I know I can throw pretty much anything on Youtube and it will take it, so I'm mostly concerned with video quality.

share|improve this question

2 Answers 2

What format YT output their video depends on various factors. For most ordinary videos they use H264 encoded streams for video (AAC or MP3 for audio) in form of MP4 and FLV container files.

These are just containers holding the encoded video data - although the H264-encoded format is no guarantee with FLV-files (or in theory with MP4 files) as they can also hold Sorenson Spark, On2 VP6 and others (especially the case with older videos).

FLV's are used as they are guaranteed to be playback-able with Flash-player.

It's not really up the downloader-software to determine the format - they just download what is available using the itag of the "internal" video URL (not the one in the browser) to identify the options. If they optionally convert the video it would be a feature, but not related to YT's formats.

There are also other formats in addition to these such as 3GP, WEBM as well as for 3D movies. Some to target phones and the new Html5 standard (being implemented as-we-speak) which can play videos directly with html (ie. without flash-player).

But back to the most common formats: Quality-wise it doesn't really matter. If the FLV contains H264 you can playback this just as fine as a MP4 container file with f.ex VideoLAN's VLC Player. If the FLV does not contain H264 and you want it as MP4 container holding H264 you'd need to recode it which mean you will loose quality.

As YT currently seem to prefer H264 I would suggest uploading in this format as well (see their information about sizes and bit-rates to avoid recoding for the best resolution).

share|improve this answer

Some general info about the formats used:

YouTube uses 4 container formats and 4 diffrent codecs. It depends on the popularity of the video what codecs are used for your video (see below why). Generally, every of your uploaded videos will be encoded in h.264 and will be muxed into an .flv and .mp4 container. Thats the standard and this will happen for every video. Though .flv will only be used for resolutions below 720p. Meaning only 360p and 480p will exist in an .flv container. Though every video below 720p will also have a mp4 version for the highest available resolution, either 360p or 480p. For 240p YouTube is using 3gp which is an rather old codec (based on MPEG-4 Part 2 (not to be confused with MPEG4 Part 10 aka h.264) meant for mobile devices (long before the smartphone era), it comes in the container .3gpp.

The other codec used is VP8 which is coming in the WebM container format. WebM is a format developed by Google and was meant as a standard video codec for HTML5, support for it is by now pretty good in most modern browsers. WebM was introduced with the HTML5 version of YouTube. YouTube only encodes some videos in WebM after they got uploaded and mostly only popular videos (going by the videos I saw encoded in WebM) so its not certain your video will be present in WebM. Though this is changing with WebM gaining some more support.

By now YouTube also supports VP9 in WebM but so far only chrome supports this codec (as of 06/2015). With VP9 they also introduced support for the Opus audio codec (besides AAC which is used in all other containers).

In regard of your linked question (maybe they should be merged?)

What codec/container should you use for uploading?

That depends, if you are limited/concerned by your upload speed then use h.264 Level 3.1/4.1 with Main Profile for SD or High Profile for HD. YouTube will accept this just fine and it will look nice after it got encoded by the YouTube servers. I would usually recommend a bitrate of ~4-5 Mbit/s for 720p material and ~8-9 Mbit/s for 1080p. For 4k go for ~15Mbit/s. This is usually a good balance between size and quality, if you want better quality go with a higher bitrate, if you want a smaller video go with a lower bitrate.

But be aware that YouTube will ALWAYS encode your video once its uploaded, doesn't matter what codec and settings you use. So if you want the theoretically best quality for your uploads choose a lossless codec for uploading or at least visually lossless. See YouTube as the final output into a delivery/consumer format and the upload to YouTube is the last step in production and during production you want to stay lossless. But please note this is all just a theoretical thing, practically I'd say it really doesn't matter as we are talking about YouTube and not about TV broadcast or Cinema.

But if you really want to do it the "perfect" way, use a production codec and not a consumer codec like h.264. MJPEG would be a good codec for that, YouTube definitely supports that in an .avi or .mov container. MJPEG is a lossy codec but the visual quality will be the same as the source (if you chose a high enough quality setting, this is practically JPEG as video codec). Going with a real lossless codec would be a waste of hard-drive space and bandwidth in my opinion.

But if you want to upload your video truly lossless and don't care about the upload time, I recommend using a standard QuickTime codec as they should be nearly all supported by YouTube (note that not all of them are lossless, h264 is also a standard QuickTime codec). Though YouTube doesn't state which QuickTime codecs are supported unfortunately. Animation or JPEG2000 should work I guess. Both codecs can be 100% lossless.

When it comes to frame rates, if you can choose then use 25FPS during recording/animating, YouTube likes that the most (the frame rate used for every video) but if your footage comes already in another frame rate then stick with that and don't interpolate up or down to 25FPS. YouTube will handle the conversion for you and generally does that better then your encoder. They have to deal with all kind of framerates everyday and solved this (actually very complicated) issue really well.


For the audio use PCM if you want to stay lossless with the audio as well but again this is really just a theoretical quality improvement. AAC will usually do the same job quality wise (subjective) and will be smaller. I recommend a bitrate of at least 192kbps for AAC. The size impact is usually not as big as the video codec so you can also just go with 320kbps. YouTube will convert audio to ~24kbps(Mobile aka 3gp) ~64kbps(240p), ~128kbps(360p/480p) and ~192kbps(720p+) using the AAC and Opus (WebM only) codec.

share|improve this answer
I agree to this answer. But there is a practical limit: the upload speed. How much time are you allowing for an upload? A whole weekend, a night, or a couple of hours until the end of your working day. I myself put the limit to 2 GB for 10 minutes of video, which needs around 4 hours of upload time in my case. But is this really restricting the quality? My 2 GB video has a bit rate of 30 Mbit/s, which YouTube converts to 3 Mbit/s. A lossless encoding would multiply the upload time, but the YouTube output would still be at 3 Mbit/s. Please set your personal limits by yourself. –  Fred42vid Feb 17 '13 at 14:11
Sure thats what I made it (hopefully) quite clear that its theoretical and in no way practical. H.264 is to be recommended for almost all cases. The only actual practical usecase for MJPEG I can think of is when color banding occours with the first h.264 encode which will get worse with the second encode from YouTube. –  Professor Sparkles Feb 17 '13 at 15:20
Just a notice, this is not a complete answer anymore. Google has added a few more HTML5 formats since I wrote this answer, I will update the answer soon after some research. –  Professor Sparkles Apr 21 '14 at 18:45
Youtube support h.264 high profile, so you should use it always. Main profile for SD content is silly. Leaving out 8x8dct is always a bad idea. In x264, enabling 8x8dct is the most efficient tradeoff of CPU time for better quality per file-size (aka rate:distortion or RD). –  Peter Cordes Jan 15 at 11:30
H.264 will look a lot better at the same bitrate than MJPEG. If you want better quality, just turn up the bitrate (or the quality setting in constant-quality instead of target bitrate mode). You can go all the way to lossless h.264 if you don't mind uploading a huge file. It will probably be smaller than lossless j2k. Both are perfect quality, though, since that's what lossless means. –  Peter Cordes Jan 15 at 11:33

protected by Friend Of George Dec 30 '12 at 2:16

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.