Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Business

Sean Edevane
Sean Edevane
9,133 Points

Video Quality & Compression Settings

I couldn't help but notice how amazingly well compressed Treehouse video files were, especially at 720p. I was wondering what settings were used when encoding the files, particularly for the .mp4 container? Was any additional compression performed after it was rendered?

Compared to the videos I've madeโ€”using Premiere and Youtube's recommended encoding standardsโ€”they are at least 60% smaller for the same or better quality. Please tell me your secrets! ;)

Tagged: Michael Poley Brittney Blews Fred Zara Ariel Zengotita Chris Zabriskie Tu Do Wade Christensen

Hey Sean Rogers, let me add to what Wade Christensen has already said.

The Treehouse video team uses Adobe Premiere or Media Encoder for exporting in the H.264 format as MP4 files.

For a while, we were using VBR (Variable Bit Rate) compression settings. VBR is supposed to help reduce file sizes, but can cause artifacts and weird compression problems to appear when you're holding on one image for too long.

Because most of the product that we produce are screencasts, we spend a lot of time looking at code on a screen where not much is changing. While you would think that VBR would be perfect, we've had more success with CBR (Constant Bit Rate) compression settings โ€“ and we basically played with those until we found something that we were happy with.

After we compress the files they go through a second compression process using Zencoder, which creates the 'High' and 'Low' quality versions of our video files as well as a WebM versions of our videos which you'll see in the browser if you're using Chrome.

Zencoder may also create different files for the iPad and Android apps โ€“ I'm not sure, I'll ask the mobile team if those settings are tweaked.

Sean Edevane
Sean Edevane
9,133 Points

Interesting, I'm using the first two parts (Premiere and ME), I'll have to experiment with the CBR settings myself. Most of the video I do is movement tutorials (I teach parkour, among other things) so VBR might still work okay in my case.

Zencoder looks like a cloud specific solution for, are you aware of any that run as desktop applications? If not, no worries, my google-fu is strong. :)

Wade Christensen
Wade Christensen
Treehouse Teacher

Hi Sean,

It sounded like you're using YouTube for distribution. Is there any reason you want to create multiple files on your computer before upload? YouTube will do all the crunching needed to provide different streaming qualities (what we use Zencoder for). Let me know more about your distribution and workflow, and I can reply again.

Sean Edevane
Sean Edevane
9,133 Points

Ah, yes. Historically I've been using Youtube, currently looking into Vimeo as a primary host, but I imagine they handle encoding as well? Otherwise the reason for considering it would be to distribute downloadable files for bundled courses that I host on my own website or via AWS. Granted part of the attraction of Vimeo is that they do allow for direct downloads of hosted video.

The one downside, and the reason I'm still researching it is they offer the full HQ mp4 as a download, not smaller versions.

2 Answers

Wade Christensen
STAFF
Wade Christensen
Treehouse Teacher

Hi Sean,

We are currently exporting things with a constant bit rate of 8Mbps using H.264 compression and the High Profile, which is a little more data than YouTube recommends for 720p at 5Mbps.

A few things to keep in mind when it comes to file size. The way H.264 compression works is by predicting how to produce the next frame and rendering that frame based on the prediction. When you look at our videos, very few things in the frame are changing (the teacher is in the same place, the background is constant, the colors are constant, etc.). This makes compression much easier because little changes from frame to frame, which requires fewer macro blocks in the H.264 prediction to be re-drawn. I hope that makes sense. Basically, the fewer things changing in the video from frame to frame, the more efficient the compression becomes and the lower data rate we can use.

Also, we are using a constant bit rate. With a constant bit rate we know that no part of the video will exceed the data rate of 8Mbps, which makes for more predictable video size. This isn't necessarily an advantage in all cases, but it's good for what we do.

Lastly, when looking at data rates be sure to note capitalization (i.e. Mbps is different than MB/s). Mbps (lower case b) is megabits per second. MB/s (capital B) is megabytes per second. One byte is 8 bits, so 8Mbps is 1MB/s. This is helpful to keep in mind when you're buying memory cards and need to decide how fast the card needs to be or how long you can record with a certain size card. Wikipedia has a decent article on data rate.

Again, I hope this is helpful. If you have more questions or want more detail, just ping me again, and I'll be happy to follow-up.

Best,

Wade

Sean Edevane
Sean Edevane
9,133 Points

Super interesting, I didn't realize that the amount of change in frame contents would have such an effect on sizes. That does explain why videos where I use more cross-fades tend to be larger. Does color correction only have a serious impact on file size when it's not uniform across the footage then?

Aside from that, does source footage resolution have much influence? Right now I do the bulk of filming with a GoPro and have been experimenting with recording 1440p footage and zooming to crop the frame (typically to fit at 1080p), which makes the fish-eye lens less apparent.

Thanks very much Wade Christensen & Michael Poley!

Wade Christensen
Wade Christensen
Treehouse Teacher

Hey Sean,

Sorry for the delayed response. When it comes to color correction, the method you use can make a difference in your file size (for example, multiple layers of footage for HDR will add to the file size). It's hard to say how much any particular color correction will affect your final file size, because there are so many other variables in play.

The resolution can make a difference, but generally it makes more of an impact on the size of the footage you are working with when editing (the source files you pulled off the camera). Generally, more resolution will lead to a larger file; however, this is not always true. Each camera manufacturer and model handles things a little differently, but this is where data rate comes into play again. I'm not sure how the GoPro handles things, but many cameras show you data rate in addition to resolution. This is important, because a 1080 file recorded at 100Mbps should be the same size as a 4096 file recorded at 100Mbps using the same codec. The data rate is the data rate regardless of resolution. Also, a camera may list data rate at 200mbps for example, but not actually record at that data rate continuously. A camera can use a variable bit rate that maxes out at a certain data rate but doesn't necessarily record at that rate all the time.

All that said, generally more resolution requires a higher data rate and creates a larger file. When exporting your footage, if you use variable bit rate compression, a larger source file will create a larger final export. However, when using constant bit rate to export, your larger source files will still have to fit into that bit rate on export (usually leading to longer export times, and, sometimes less visual quality).

Again, a lengthy response from me, but I hope it helps.

Wade

Sean Edevane
Sean Edevane
9,133 Points

Very helpful thanks! Right now for color correction it would be just single layer stuff, just Fast Color Correction and RGB curves for the most part, no fancy layering.

From the specs the GoPro can handle up to 45/Mbs, limited more by the card speed, my current one supports up to 30/Mbs (class 10). I'll have to do some experiments with exporting and data rates next time I'm doing a round of editing.

Again, huge thanks for the help and the detailed responses are most certainly appreciated. :)

Hey Sean, you could maybe tag a few staff members in charge of video on the About page to see if they could give you some tips. More about person tagging here.

Sean Edevane
Sean Edevane
9,133 Points

Gotcha, and thanks, added some tags now!