8

There's a lot of advice on the internet on encoding settings to apply to your video before uploading to YouTube (https://support.google.com/youtube/answer/1722171?hl=en,

, ...). They say that not only will compression allow your video to upload faster but it will make it look better when played back on YouTube (an example of this is at 0:18 in the YouTube link above).

What I also read is that YouTube re-encodes any video that you upload (example: "Telestream Episode product manager Kevin Louden started by noting that YouTube re-encodes all video uploaded to the site" - http://www.streamingmedia.com/Articles/Editorial/Featured-Articles/Encoding-for-YouTube-How-to-Get-the-Best-Results-83876.aspx).

So the obvious question for me is if YouTube re-encodes anything that it's asked to upload, why should different codecs make a difference to final playback quality on YouTube? To get the best playback quality on YouTube, shouldn't I upload a lossless file and let YouTube compress it however it wants?

I don't care about upload time or file size, I just care about playback quality on YouTube.

  • Those suggested bitrates are high enough to be transparent (with a decent encoder). They don't suggest even higher probably for bandwidth cost reasons. (for them). I have NO idea why they specify such a tiny GOP, though. A keyframe every 1/2 second? A video I downloaded from youtube was 640x480 h.264 baseline (yuck), with a keyframe every 3 secs or so, even absent scenecuts. That's a lot shorter than the x264 default of 250 frames, but also a LOT longer than every 1/2 second. – Peter Cordes Jan 15 '15 at 10:48
  • With all the guidelines on how many B frames, and GOP size, it made me wonder if youtube would use your bitstream untouched as the 1080p or 720p stream if it met all the criteria. – Peter Cordes Jan 15 '15 at 10:50
  • Youtube parallelizes the encode of the uploaded file via segmenting, so a low GOP probably makes it more efficient for them. – Gyan Jan 16 '16 at 6:26
6

I've answered a similar question some time ago. YouTube added a few codecs since then but all the info there still applys: How does YouTube encode my uploads and what codec should I use to upload?

Short answer: Yes if you are concerned about maximum quality a lossless codec or visually lossless codec is the way to go. Re-encoding always means loss of information if you re-encode with a lossy codec like h264. Saying that videos will look better with compression is just a wrong statement. Compression reduces file size, that's the only benefit you get from it. Best case you don't loose information with that compression but with most codecs like h264 you do because they discard information and re-arrange it in order to achieve a high compression.

Though different codecs do have an affect on the outcome, encoding a video with MPEG2 or h264 makes a huge difference. The former will usually have way more compression artifacts depending on your encoding settings than an h264 encoded video with similar bitrate. So if your source is already having artifacts the second encode from YouTube won't make it look any better but worse.

2

You should upload the highest quality your tubes can afford. The current YouTube help text on uploads is misleading. It states:

Your videos will process faster if you encode into a streamable file format. For more information, visit our Help Center.

It contradicts what Colleen Henry, formerly of Google, now at Facebook said:

Colleen Henry, Video Hacker, Google Video Infrastructure, with some great suggestions to help you get the best video quality on YouTube:

It's important to think of the files you upload to YouTube as golden masters, as they will be used as source material to generate video streams for years to come. Simply put, the better the quality of the file you upload to YouTube today, the better quality the viewer's experience will be throughout your video's life on YouTube.

As displays increase in size, compression techniques become more efficient, playback devices become more sophisticated, and internet connections improve, so will the quality YouTube will be able to provide to the viewers of your videos. This means, while you may reach a limit on perceived benefits from higher bitrates or more efficient encoding if you were to test it today, that does not mean you should stop there. You will see a huge benefit over the lifetime of your video being available on YouTube, as internet speeds, hardware, and software evolve. Upload the best quality video that you can create and squeeze through your internet connection!

Bonus tips:

  • Many encoders can spend more CPU time to create a much more efficient file. If you have a powerful computer, but a slow internet connection, look into using more complex and efficient encoding to save upload time.

  • You can noticeably improve the quality of your video on YouTube by using a sophisticated, scene aware, denoising filter prior to uploading.

  • Keyframe interval doesn't really matter much at this moment in time, but please keep it under 5 for VOD.

  • The sample rate of your audio should match your source's sample rate in which it was produced.

  • If you make sure to use a streaming format, like an mkv, .mp4 or a .mov, with the metadata at the front of the container we will begin processing your video WHILE you are uploading it, drastically reducing overall turnaround time. This will make things MUCH faster, with no negative side effect. You can add the metadata atom to the front of your file with something qtfaststart, or select it when you are creating the file in Squeeze, Episode, etc.

  • It is ideal to use constant quality encoding. This will let you create a high quality variable bitrate file, at the speed of a single pass. It will maintain a consistent target quality throughout the file, rather than trying to allocate bits to hit an arbitrary bitrate, which can easily under-shoot or over-shoot, and with two pass, take extra long to create.

  • You can put uncompressed PCM audio in an .mov or .mkv container and deliver it to us if you like. However, make sure not to create multiple discrete mono streams when you do it.

source: http://www.streamingmedia.com/Articles/Editorial/Featured-Articles/Encoding-for-YouTube-How-to-Get-the-Best-Results-83876.aspx

  • What's the lie? – Gyan Jan 16 '16 at 6:27
  • 1
    I guess more of misleading than a lie. While it is true they may process faster if they are in a streamable format (because processing can start right away) it gives the impression that that is what users should do, upload a streamable format. What users should do is upload the highest quality they can, not a necessarily a streamable format. The help text on YouTube should clarify that. – Elijah Lynn Jan 19 '16 at 12:26
  • 1
    I think you're assuming that they want everyone to upload high-bitrate videos. More likely, they are concerned about controlling storage capacity expansion for the raw sources, so their policy is to decide on a minimum threshold and set that as the guideline. Savvy users can tweak their videos as they see fit whereas all the green users don't go around uploading 30 mbps feeds of their cat and dog going at each other. – Gyan Jan 19 '16 at 12:33
1

Ultimately youtube is thinking about upload quality versus upload speed. If someone tries to upload lossless on a less-than-amazing internet connection, they'll get frustrated and quit. If they upload with a lossy codec which is less-than-satisfactory (eg. motion-jpeg or mpeg2) they'll either take a long time to upload, have a poor quality end result, or both!

The best solution is the upload a video using a codec which has the best quality-to-size ratio, which at this point in time (2015) is either h264 or webm (in terms of codecs which are widely-supported at least).

If you use a decent encoder (eg. MeGUI) and high quality settings (eg. multiple passes, high maximum bitrate) it is doubtful you will see a significant difference between uploading lossless and h264. However, the filesize will be significantly smaller and the upload time a fraction of the lossless upload time.

Perhaps some day when we have quadruple-light-speed internet connections, we won't have to worry about these 'implementation details' - however until then, quality-to-filesize ratios will always be important, particularly in the age of 4K and ever-increasing screen resolutions. Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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