My compression confusion

bbowdon1

macrumors newbie
Original poster
Sep 21, 2019
3
0
New Jersey
Pardon my ignorance, but lack of knowledge is kind of the point of these forums, eh? :)

My internet searches of "What kind of video compression does YouTube use?" have generated the same responses: H.264. But there are other things going on I clearly don't understand.

For example, I have a music video on my MacBook Pro that I edited in FCP, and output as 1920x1080HD, 24p, H.264. Duration is 3:39, and file size is 337.7MB. It lives on my computer as a .mov file.

If I take that file, upload it to YouTube, then download it back from YouTube using iTube Studio software I get a surprise. The post-YouTube crunch, according to Quicktime is also 1920x1080, also 24p, and also H.264. But it's a .mp4 file, and it's size is only 83.2MB. What?

My child's-level understanding is that .mov and .mp4 are just the video file wrapper standards, and it's the H.264 performing the true, lossy video compression. Yet, despite both files showing H.264 compression, the file after uploading and downloading from YouTube is less than one-fourth the size, while still allegedly maintaining the same 1920x1080, 24p resolution? There's something huge I'm missing here.

Thanks in advance!
 

iluvmacs99

macrumors 6502
Apr 9, 2019
380
180
Pardon my ignorance, but lack of knowledge is kind of the point of these forums, eh? :)

My internet searches of "What kind of video compression does YouTube use?" have generated the same responses: H.264. But there are other things going on I clearly don't understand.

For example, I have a music video on my MacBook Pro that I edited in FCP, and output as 1920x1080HD, 24p, H.264. Duration is 3:39, and file size is 337.7MB. It lives on my computer as a .mov file.

If I take that file, upload it to YouTube, then download it back from YouTube using iTube Studio software I get a surprise. The post-YouTube crunch, according to Quicktime is also 1920x1080, also 24p, and also H.264. But it's a .mp4 file, and it's size is only 83.2MB. What?

My child's-level understanding is that .mov and .mp4 are just the video file wrapper standards, and it's the H.264 performing the true, lossy video compression. Yet, despite both files showing H.264 compression, the file after uploading and downloading from YouTube is less than one-fourth the size, while still allegedly maintaining the same 1920x1080, 24p resolution? There's something huge I'm missing here.

Thanks in advance!
It depends on the bitrate used; low bit rate from 0.64Mbps equal smaller files to higher bit rate @20Mbps equal bigger files. Youtube is known to adopt a lower bitrate for 1080p to conserve bandwidth, thus your original file h.264 will show lesser quality when played with Youtube than you do playing natively on your computer. Your original movie file will always have the highest quality before you upload to any social media sites. It's up to the sites to downgrade the quality of the file to a more suitable broadcast quality for efficient streaming.
 

bbowdon1

macrumors newbie
Original poster
Sep 21, 2019
3
0
New Jersey
Thanks for your response.

You're quite right; the bit rate I see when opening the files in Quicktime and hitting Command-I reveal that the bit rates differences correspond neatly with the file size differences, (in this example where duration, resolution, frame rate and H.264 compression are all held constant, the fat file bit rate was 12.30MB/sec vs. 3.04MB/sec for the YouTube upload-download).

Any idea how I would reduce the bit rate of my own file, if I wanted to replicate what YouTube did? I don't see bit rate as a Final Cut Pro output settings parameter -- nor as an option in Quicktime export function. Is there software, in other words, that can "downrate" a video file? Thanks again!!
 

iluvmacs99

macrumors 6502
Apr 9, 2019
380
180
Thanks for your response.

You're quite right; the bit rate I see when opening the files in Quicktime and hitting Command-I reveal that the bit rates differences correspond neatly with the file size differences, (in this example where duration, resolution, frame rate and H.264 compression are all held constant, the fat file bit rate was 12.30MB/sec vs. 3.04MB/sec for the YouTube upload-download).

Any idea how I would reduce the bit rate of my own file, if I wanted to replicate what YouTube did? I don't see bit rate as a Final Cut Pro output settings parameter -- nor as an option in Quicktime export function. Is there software, in other words, that can "downrate" a video file? Thanks again!!
Yes there are several software that will do this. The most common one is Handbrake which is free. In handbrake, bitrate is defined as RF (Rate Factor), but you can pre-define precise bitrate if you chose to re-compress using the CPU. Whereas if you use the GPU (either the internal, discrete or external GPU) using the videotoolbox option, then you would have to choose the Rate Factor (RF) for a lower bit rate. Obviously, compressing h.264 file created from FCP to a lower bit rate via Handbrake will be faster using the GPU than using many cores in your CPU, but the quality and size compression will always look better using CPU compression rather than using the GPU, if quality and size is your preference. iMovie allows you to choose the bitrate quality by selecting different compression factor, but for most professional NLE video editing software, the default is usually high quality compression.
 

bbowdon1

macrumors newbie
Original poster
Sep 21, 2019
3
0
New Jersey
That's super helpful.

To be clear, the reason I ask is to better understand the optimal design of a future video streaming platform. Not unlike YouTube (in this respect), we'll be ingesting videos from a variety of content creators, then streaming them to a separate set of users. So our goal (also like YouTube, in this regard) will be to minimize streaming costs without materially affecting the average viewer experience.

Given that, I'm wondering if people have published on YouTube's bit rate algorithm. Although I'm seeing dozens of posts about how to encode video if uploading to YouTube -- nothing on YouTube's method.

For example I downloaded another YouTube mp4, also 1920x1080, and see its bit rate is 3.74 Mbit/sec, 23% faster than the bit rate of the earlier HD video mentioned. Presumably, this second video has more camera pans and quicker cuts, versus longer-held and static camera positions, that accounts for the need for a higher bit rate compared to the first video.

I downloaded Handbrake; it seems clean and easy to use, and do I see an option for me to set an average bit rate. What's not apparent (to me anyway) would be some kind of quality range slider from "Faster" to "Higher Quality" where if I tell the software the quality I want, and it tells me the needed bit rate to deliver the quality level I set for each particular video.

Obviously, the video from a motorcycle guy with a GoPro on his helmet, where the entire image changes every frame, would demand a higher bit rate for a given quality level than a talking head video of a guy in front of a static black background. I'm just wanting that video-by-video, bit rate optimization analysis automated. Does something like that exist? I mean does it exist as a 3rd party app, rather than inside the cloistered halls of YouTube, DailyMotion, etc., who are obviously doing it with every video upload.

Thanks again!
 
Last edited:

iluvmacs99

macrumors 6502
Apr 9, 2019
380
180
What you are after is CAE (Content/Context Aware Encoding) and there are many 3rd party businesses that offer this service. I am not aware of any 3rd party app that automates CAE as it is very resource intensive and employs deep learning artificial intelligence to perform scene and content analysis via clustered servers for adaptive bitrate, codec, frame rate and other stuff; probably beyond the means of deployment for most small video editing/publishing companies. Youtube, Netflix, Apple and many major content providers do employ a variation of Content and Context Aware Encoding through their A.I clustered servers.
 

kohlson

macrumors 68020
Apr 23, 2010
2,084
568
I've worked a little bit around the edges of YouTube uploading/downloading, and have uploaded 100's of videos. YouTube is pretty clear on what spec's it expects to get "good quality" across different resolutions. But less obvious to most people, and seemingly infuriating when they discover it, is that YouTube further compresses all content. There are lots of good reasons for this, but one that people often overlook is that YouTube has all sorts of client device types - TVs, PCs, mobile devices - each with their own unique requirements (OS, player, screen resolution, and so on). So not only do they need to save space and bandwidth, they need to accommodate millions of devices on a variety of platforms.