Live data from Hacker News

Netflix is now doing per-shot encoding for UHD content

netflixtechblog.com

101–110 of 200 posts

Re: Netflix is now doing per-shot encoding for UHD content

#101

Earlier quoted context omitted.

> It's really too bad that they haven't rolled this out for 1080p too Maybe they will? But it matters most for 4K performance, so that's where they started? > encoders (x264, x265, etc) already have their own rate control algorithms But they simply operate on a stream without taking future frames into account. This does a first entire pass on the film holistically to determine where keyframes should go and settings p…

Existing encoders have suported this for ages using multipass. In the first pass of multipass encoding, the input data from the source clip is analyzed and stored in a log file. In the second pass, the collected data from the first pass is used to achieve the best encoding quality. In video encoding, two-pass encoding is usually controlled by the average bitrate setting or by the bitrate range setting (minimal and ma…

My point is that if Netflix thinks they can do better, it would be great to see their code contributed to the public, since they're using an open source program to do all their encodes.

Also, you're making a slight mistake. About a decade ago (?), x264 was changed so that even 2-pass mode is really just using CRF under the hood. It's not "achieving the best quality", it's just figuring out what quantizers you need to hit your average bitrate target exactly. Some more information about that here: https://trac.ffmpeg.org/wiki/Encode/H.264

> normal 1-pass CBR encoding

You may be confusing constant bitrate (which no one should ever use) with CRF (constant rate factor), which varies the bitrate from frame to frame and scene to scene, without having to do a 2 pass encode.

Re: Netflix is now doing per-shot encoding for UHD content

#102

That’s great. I’d love to see how they fare on this glitter which seems to destroy all compressors: https://m.youtube.com/watch?feature=youtu.be&v=MG_Lyg74UlU&t... (I saw a similar problem with a famous monarch butterfly footage that I don’t have time to chase down)

Wow, that really was awful. Does this sort of thing require kind of like a specific optimisation to fix, or is there a general technique that would fix this and other stuff?

there isn't necessarily a fix. all compression algorithms expand the size of the data on most inputs in order to make certain inputs with sufficiently regular patterns a lot smaller. it just so happens that most of the images/video/audio/text/etc people are interested in is fairly regular. with a lossy compression algorithm that is required to hit a certain compression ratio to keep the bitrate under some threshold, the only way to be able to guarantee that it is hit on uncompressible input is to introduce regularity/remove randomness, and in the case of video the easiest and least visually distorting way to do so is to pixelate it. this particular video is basically random noise which is incompressible by definition, which is why the result is so bad. if it was 1080p going in and the output size is required to be reduced by 16x, reducing the resolution to 480x270 is about as good you can do.

Re: Netflix is now doing per-shot encoding for UHD content

#103

Looks amazing and while I would like to enjoy such quality and am willing to pay for the premium plan (in fact I do already), I still can't watch the 4K content even in a world where I accept DRM modules in my browser, because some DRM plugins seem to be more equal than others.

Meanwhile, pirates get the content DRM free and they don't pay a cent for it. Yet another instance where DRM hurts the consumer more than the pirates.

Re: Netflix is now doing per-shot encoding for UHD content

#104

That seems like a pretty impressive achievement! Question for anyone here: What do you use to play 4K/HDR? I have an Apple TV 4K, which can do 4K Dolby Vision playback and looks ok, but the Apple TV tends to have some jittering when streaming certain shows (very noticeable in panning shots of animation). The sound quality is also noticeably worse on my set with it (it doesn’t seem to be able to do direct pass through…

I was using FireTV Cube and recently switched to latest Shield. Both of them were playing content fine till I went playing with receiver settings and discovered that I didn't have HDR enabled on this HDMI port. After enabling I started to have a lot of jitter and blank outs (though while it worked - picture was better then before).

Solution was to buy "premium" HDMI cables that are rated for 4K HDR

Re: Netflix is now doing per-shot encoding for UHD content

#105

Earlier quoted context omitted.

In case you are using Google/Cloudflare DNS try switching back to Comcast's DNS servers so you get directed to a Netflix Open Connect box within their network.

> switching back to Comcast's DNS servers A scary thought (they highjack NXDOMAIN, MiTM http to "bring you important messages", etc)

That's when you set up dnsmasq or something similar and use your favorite dns server for most of the sites but a specific one for sites that will work better with it.

Re: Netflix is now doing per-shot encoding for UHD content

#106
post #82

Looks amazing and while I would like to enjoy such quality and am willing to pay for the premium plan (in fact I do already), I still can't watch the 4K content even in a world where I accept DRM modules in my browser, because some DRM plugins seem to be more equal than others.

I am shocked at how many people watch Netflix in their browser. I have multiple different ways (AppleTV, Xbox, TV Smart App) to watch Netflix on my tv, and at least 2 of them support 4k.

It's not too surprising. Media players (chromecast, appletv, etc.) seem pointless if you already have a laptop and you're not too into movies/tv. Not everyone owns a game console, either because they don't game or they play on PC. Finally, some people (especially hn users) think that smart tvs are a privacy/security nightmare, so use them as dumb tvs.

Re: Netflix is now doing per-shot encoding for UHD content

#107
post #88

It's really too bad that they haven't rolled this out for 1080p too. Their 1080p video quality is god-awful compared to Amazon. They may even have made it worse: from the "ladder" comparisons, it looks like they jump to higher resolutions at lower average bitrates now, so if you're stuck at 1080p you're going to be getting worse quality after these changes than before. Also, something that's kind of weird about all t…

> They may even have made it worse: from the "ladder" comparisons, it looks like they jump to higher resolutions at lower average bitrates now, so if you're stuck at 1080p you're going to be getting worse quality after these changes than before.

No they have not made it worse. 1080p encoded at lower bitrate can look better than 720p at a higher bitrate. Or vice versa. Even to the trained eye. It depends on the scene dynamics.* In the ladders they posted (called a RD chart) we can clearly see they have made a better selection of the resolution to encode at a given target bitrate increase the video quality. They have posted the BD rates for this stuff, the gains are substantial (30% or more visual quality at the same bitrate).

> Also, something that's kind of weird about all this is that encoders (x264, x265, etc) already have their own rate control algorithms that decide on a frame or scene basis how many bits to use. Netflix taking an approach like this is equivalent to claiming that they're capable of doing a better job than these codecs in an automated way - so why not just contribute the code needed to achieve these improvements back to the projects they're using?

Because they've built a split and stitch encoder on top of the codecs. That means the code is built around x264, not into it.

> Last, it's very weird to select individual frames from an encode and not a selection of frames. The comparisons purport to show that the lower bitrate encode is better than the higher bitrate encode, but in fact (if I understand how they're using rate control correctly) what they are showing is a single frame in the lower bitrate encode that uses more bits than the same frame in the higher bitrate encode. So it's arguably not a fair comparison. And even with that, depending on how sensitive you are to artifacts, some of the "optimized ladder" encodes still look worse.

This is extremely true.

* High action scenes tend to benefit from lower resolution with more bits spent on inter compression while slower scenes benefit from tighter intra compression.

Re: Netflix is now doing per-shot encoding for UHD content

#108
post #49

Earlier quoted context omitted.

And this is why I still get discs by mail. No dropouts, no unexplained drops in resolution, and it has a deeper catalog.

Scratched discs.

You'd be surprised just how resilient optical media can be. Damage to the metallic substrate is usually a bigger problem than most scratches

Plus, with optical media you can easily make bitperfect copies!

Re: Netflix is now doing per-shot encoding for UHD content

#109

Earlier quoted context omitted.

Do we still need an Intel Kaby Lake or later CPU for 4K DRM decoding? (And Windows... forgot about that.) If so, Netflix is on the wrong side of the CPU war with AMD ascending.

The arguments Netflix made for this highly model-specific DRM never made sense to me. There are 4K rips of pretty much every Netflix show available for download on various bays related to piracy. So why bother locking your paying customers out of 4K content? What's the upside? Also: I'm reasonably convinced that NetFlix is violating the law, at least in Australia, by advertising that their content is 4K and then arbi…

>Also: I'm reasonably convinced that NetFlix is violating the law, at least in Australia, by advertising that their content is 4K and then arbitrarily blocking access to the 4K streams. This is called "bait & switch", and the fines are eyewatering, even for large corporations.

Nah, they have their asses covered. I went to the website and tried to sign up, and at the first mention of 4k (when you're choosing a plan), there's a disclaimer of:

>HD and Ultra HD availability subject to your Internet service and device capabilities. Not all content available in HD or Ultra HD. See Terms of Use for more details.

If you go to the terms of use, it says:

>4.7. The quality of the display of the Netflix content may vary from device to device, and may be affected by a variety of factors, such as your location, the bandwidth available through and/or speed of your Internet connection. HD, Ultra HD and HDR availability is subject to your Internet service and device capabilities

Re: Netflix is now doing per-shot encoding for UHD content

#110
post #88

It's really too bad that they haven't rolled this out for 1080p too. Their 1080p video quality is god-awful compared to Amazon. They may even have made it worse: from the "ladder" comparisons, it looks like they jump to higher resolutions at lower average bitrates now, so if you're stuck at 1080p you're going to be getting worse quality after these changes than before. Also, something that's kind of weird about all t…

> They may even have made it worse: from the "ladder" comparisons, it looks like they jump to higher resolutions at lower average bitrates now, so if you're stuck at 1080p you're going to be getting worse quality after these changes than before. No they have not made it worse. 1080p encoded at lower bitrate can look better than 720p at a higher bitrate. Or vice versa. Even to the trained eye. It depends on the scene…

> No they have not made it worse. 1080p encoded at lower bitrate can look better than 720p at a higher bitrate. Or vice versa. Even to the trained eye. It depends on the scene dynamics.*

Well, of course that's correct. Take 1080p encoded at 100 Mbps and 720 encoded at 300 Mbps, I guarantee you that 1080p wins every time. :-)

> In the ladders they posted (called a RD chart) we can clearly see they have made a better selection of the resolution to encode at a given target bitrate increase the video quality.

I understand how an RD chart works, but I disagree with your conclusions. Reread my original post carefully - my point is that if you're stuck with 1080p as the maximum resolution, than the quality you can get with the revised ladder is strictly worse, because Netflix will want to jump up to UHD resolutions, but your device won't support it. (And even assuming that the UHD will be better based on this chart is kind of a leap, because it depends on what artifacts you're most sensitive to. Objective metrics ≠ subjective experience. In several of their comparisons, I prefer the lower res version because the new one is simply too artifacted.)

> Because they've built a split and stitch encoder on top of the codecs. That means the code is built around x264, not into it.

I understand the technical difference, but I'm still not convinced. Fundamentally what you get at the end of the day is a single continuous h.264 stream. The quantizer is chosen based on some rate control algorithm, and IPB frame choices are made by another algorithm. Netflix's improvement amounts to having a better rate control, that understands scene differences and uses lower quantizers on more complex scenes. There's fundamentally no reason why you couldn't add such a rate control algorithm to x264. It might require using a 2-pass mode, but it could be done.

Post reply on HN