Hacker News new | ask | show | jobs
by AltruisticGapHN 1039 days ago
On a sidenote am I imagining things or do videos actually look a tiny bit better in YouTube?

This really has puzzled me. I downloaded a few favourites and watch them on VLC or Infuse on my AppleTV. In the YouTube app I can use the "nerd stats" to confirm I am viewing the exact same video/audio streams...

... it could be my imagination but it seems like YouTube does a really subtle kind of filter that makes the "blocky" compression artifacts smoother. It doesnt ehance edges or anything - my guess is it looks for areas WITHOUT edges where there are sublte shfts of colour, and it makes the blocky artifacts less prominent.

... it's really subtle and I still cant tell if its just my imagination, like my OCD thinking that my downloaded video doesnt look as good and yet, I noticed on YouTube the video feels more vibrant and solid. When I watch my downloaded vid there are these really sublte, but noticable artifacts often in the background , in the shadows and these constant tiny little jitters even on a 1440p video - make the final picture look not as good.

Am I making this up?

Audio wise there is definitely a change as well. YouTube audio is always more or less level for me, while a downloaded video always needs to crank up the volume which is annoying.

I wish players like VLC or Infuse did whatever YouTube does to make videos just more pleasant to look at. I dont think YoUTube changes the colours or does any kind of vibrancy filter though I may be wrong, but it does things to "level" audio so that you have a more consistent experience going from one video/channel to another.

10 comments

I can answer about the audio.

YouTube (and most other streaming sites like Spotify etc) use something called ReplayGain. It's essentially a tag that specifies the calculated average loudness of the video/song/whatever (this number is calculated at upload time).

Upon playback, the official YT client knows to use that tag and adjust its volume level accordingly, but I'd imagine either the tag isn't getting downloaded, or perhaps MKV doesn't support ReplayGain tags natively.

The loudness information is derived from the file in the first place, so a smart enough player can re-derive it and normalize audio on the fly. My player (mpv) does this by calling out to libav. It can handle both live audio and prerecorded audio, using different algorithms for each case. This functionality can be enabled with config flag `af="acompressor=ratio=4,loudnorm"`. I will admit that I copied these options from examples without really knowing what they do or how they do it, but they make things much more pleasant.

It's disgraceful that even major movie studios often do such a bad job with audio mixing that I indiscriminately run everything through a filter. This is not a problem with the files I'm using; I find the same thing in the theater. C'est la vie.

Thanks! I've always compared playing music on YT and playing lossless music in Rhythmbox on Linux and wondered why YT sounds better. Now discovered the ReplayGain toggle in Rhythmbox thanks to your comment.
Interesting. Indeed there is the line in the nerd stats overlay:

    Volume / Normalized 100% / 100% (content loudness -0.2dB)
You got me thinking now. I see there is some kinda ReplayGain postprocessor plugin for yt-dlp, however it's tied to some music downloading. I wish yt-dlp had a builtin option of some sort to process that tag.
That explains why YouTube on my TV is consistently 10 decibels louder than all the streaming services.
Interesting! TIL!
What filter the player uses for scaling (and chroma scaling) affects sharpness. Playing a native resolution stream fullscreen should eliminate differences here for monochrome edges. Depending on OS you might be able to toggle rapidly between two fullscreen apps to test for differences (cf ISO 29170-2, which recommends 5 Hz).

Colour shifts (as in, input != output, not gradients) can come from bad handling of video colour space or monitor profile. Also, shenanigans here can have screenshots looking different from the actual application.

'jitters' might be dropped frames, but then you mention resolution. Since you also mention edges, if you're noticing pixellation in the edges of coloured objects, that would be nearest-neighbour chroma upscaling, which I do remember some player using at some point.

I'm "eyeballing" switching between Infuse and YouTube on an Apple TV 4k 2nd Gen (2021). The Sony TV is 1080p but I've been chosing 1440p now in YouTube as it definitely looks better overall (more details).

The downloaded video is also 1440p, same audio/video streams as far I can tell. So both Infuse and YouTube will do some scaling to the viewport 1440 > 1080p.

This is an example video:

https://www.youtube.com/watch?v=-VE-tgVOZN8&t=3m30s

So the left side is really dark and that's the area where you'd typically see more compression artifacts right? Due to the algorithm thinking there's no detail there. So in YouTube it feels solid. But in Infuse I notice tiny little jitters there and it just distracts and I'm guessing it's those really subtle "grainy" things that take away from the picture feeling really clean and smooth.

Now when I switch back to YouTube and I really look for it, at same time stamp I can notice some artifacts, but it's just not as noticable... so I'm still wondering what is going on. Does YouTube also do some kinda brightness/contrast filter perhaps similar to audio? Due to playing back on a TV maybe?

Without being able to make screenshots it's really hard to tell since the time it takes to switch between the apps you get flashes or brightness/dark and the eyes are affected by it. All I can tell is in YouTube the picture just feels smoother and cleaner overall.

edit:

Another example gives some hitns perhaps

https://www.youtube.com/watch?v=-VE-tgVOZN8&t=6m32s

So now I am checking out the video on my desktop linux with a 1440p monitor, in YoUTube and in VLC player (Ubuntu, AMD GPU).

So interestingly in the background behind Ally to the left on VLC you can clearly see the banding of blue colours, there are lots of squares which are jittering, like the fuzzy grain on a night cam. It's really distracting.

In YouTube (same desktop, via Google Chrome), there is colour banding in the blue background to the left of Ally, but it is not as noticeable because it's like the squares have been averaged and the edge of the bands is smoother. While you can see some tiny shaking there in the colour bands if you look for it, it is not distracting from the overall image.

Hmm.

UPDATE /SOLVED?

Ok after redownloading 1440p 271 stream (VP9) I can confirm the color banding is the "smooth" one I saw in YouTube.

Something's fishy with YouTube I did download the VP9 codec ~3 weeks ago and since then they have changed the streams and the bitrates are lower. There are these new "6xx" streams while the old 1xx/2xx streams appear to have a lower filesize.

But oddly enough the 400 MB filesize I just downloaded has the smoother nicer picture, whereas the 500 MB file I downloaded weeks ago, has the squares/fuzzy/grainy effect. VLC tells me both are VP9 so hmm.

Ah that makes sense - the first video was only uploaded 3 weeks ago. It's known that, on youtube, formats become available in increasing resolution after upload as they finish encoding. Your experience now shows that the higher-res streams are encoded in a rush at first and later replaced with better compressed versions.

.

I've never seen such a long format list in youtube-dl before. Are 6xx new? Apparently,[1] they were introduced together with that 'premium 1080p' this April.

Comparing older 4k videos to your video: this one[2] now has 6xx, and 4xx are gone, and curiously the reported bitrates of all streams have since changed (reencoded?). 137 stayed about the same this time, but 18 dropped from 730k to 493k. For this video[3] 4xx are still available.

.

616 is not the actual premium 1080p as the posters at [4] think, is it? Currently youtube.com chooses 248 when playing [2], but yt-dlp can list and download 614 and 616 without any account cookies.

Rather, 6xx seem to comprise (of) vp9 spanning a medium, high, and sometimes low bitrate in all resolutions. Is yt considering replacing the older formats with these?

I just hope the original 18 and 22 remain for older videos, where any difference in quality also matters the most. When still available, in most cases the H.264 streams with creation_time prior to ~2013 are dramatically clearer than any more recent formats.

[1] https://github.com/yt-dlp/yt-dlp/issues?q=605+604+603+sort%3...

[2] https://github.com/yt-dlp/yt-dlp/issues/1863#issue-106877303...

[3] https://github.com/yt-dlp/yt-dlp/issues/389#issuecomment-103...

[4] https://github.com/yt-dlp/yt-dlp/issues/6770

lets not discuss how often the h264 streams for new videos are higher quality than the vp9

Have you used `mediainfo` to check the codecs, bitrate and encoding settings? Curious what you'd find there...
Hey thanks I didn't know about this tool.

Interestingly since I have the older download from ~3 weeks ago I just ran mediainfo on it, and the new download from today. Then I just switch tabs in terminal so I can easily see what changes.

Old / New

    vp09 / vp09 

    filesize   488 mb   / 391 mb

    OVerall bitrate   3274 kb/s   /  2620 kb/s

    Bits/(Pixel\*Frame)    0.036 / 0.028
I don't see anything else significant.

It seems to me in recent weeks YouTube has changed the streams, added new "high bitrate Premium" streams (edit: WHILE lowering the bitrate on the older existing streams like 137!), and perhaps the one I downloaded earlier, despite being a larger filesize, was not encoded correctly?

The new file despite being 20% smaller (~400 mb instead of 500), has the smoother color banding, and doesn't show the ugly jittery grainy artifacts.

I used to think larger filesize is better but I guess Iḿ going to get the Vp9 from now on...

I have noticed that Youtube often re-encodes videos, replacing the data for a certain stream type/number with a new encode.
Yes that is probably what it was!

I'll remember that even two+ days after the initial upload, there may still be reencoding. I thought this was only few hours after the creator uploads.

So the smaller filesize also is not necessarily a sign of lower quality. In this case it's because it gets a quick first encoding like zip with fast compression, and then it gets reencoded presumably by something much more CPU intensive.

That said from 500mb to 400mb is a bit dodgy but what do I know maybe VP9 is that good.

A single youtube video has a couple of available video, audio and combined streams. It might be your browser picks a different stream to what youtube-dl (or its fork) takes by default.

I'm not sure what the defaults currently are for youtube-dl and its forks, but for a long time it defaulted to the best combined stream. However the best distinct audio and video streams are higher quality.

Players like VLC do much better and let you make your own arbitrary adjustments via GLSL :)

In particular, I like the anime4k shader pack, which is ML-based but runs in real time in mpv (and I think VLC as well). While it is tuned for anime (as is obvious from the name), it has decent denoise and deblur which often make YT content more watchable and a restore step that does a really good job with compression artifacts but is a bit too tuned for anime so may not always work, or even make things worse. See https://github.com/bloc97/Anime4K/releases

Maybe the video pipeline in the browser is different compared to the one VLC uses? Can you do a simple HTML document with a <video> element referencing your local file to compare?
If anyone's still reading this or anyone cares here is what I found out:

- the issue I was experiencing is with a lower quality encoding vp9 stream - from a video that was recently uploaded (explained below)

- though I didn't trust smaller filesize VP9 streams initially, they look in fact noticably better - the picture is smoother, cleaner, the artifacts of compression are less visible. Where AAC can have jittery/glittery distracting dots moving in the background in areas where you have subtle gradients (eg. a plain wall) - Vp9 has none of these, those areas look smoother and cleaner and it gives an overall nicer looking picture without compromising the detail as far I can tell

- Opus audio stream appears to have less of the ReplayGain issue, I'm not sure - but since I downloaded Opus instead of the 140 m4a stream I notice I dont need to adjust the volume compared to viewing same video in YouTube - and since the codec is newer anyway and the filesize is relatively the same or a tad smaller - also it is in 48k not 44k, I am going to download Opus from here on

- a very confusing thing is it appears ; for a recent upload ; you can have an initial VP9 stream of say 500mb which is in fact no better than the AAC and havs the grainy artifacts - and the vp9 stream gets replaced weeks later by one significantly smaller like 400mb vs 500 mb !! and looks way better . whic hsuggst there was a first pass with low quality encoding, replaced by a higher quality encoding later - therefore my assumption that larger filesize is better was wrong

Doesn't youtube ultimately use the browser's video player now that flash is no more?

In addition to what the other poster said about checking if you're downloading the exact same codec etc as you're watching, you could try playing the downloaded video with the browser and see what it looks like.

Most websites use JS to tell the player what to do, so the JS decides what streams to play based on asking the browser what it supports.
macOS has an AI video upscaling algorithm that was introduced in version 12
Any more info on this? I can't find anything via Google or on the Monterey features page.
I don't understand your reply.

Why don't you just take a screenshot at the exact same timestamp? It's that easy and would have taken you less time than writing this up.

I'm watching with AppleTV, comparing Infuse with YouTube. So I can only "eyeball" it. Wish AppleTV let me do screenshots it would be fun!
I don't know what Infuse is but I could screen record Apple TV from the web browser just fine back when I had that subscription. Otherwise, try a VM
I think he means he's watching YouTube on an appletv device.
> On a sidenote am I imagining things or do videos actually look a tiny bit better in YouTube?

I'm not [ADVERTISEMENT] sure, because my YouTube viewing [ADVERTISEMENT] experience nowadays is so [ADVERTISEMENT] [ADVERTISEMENT] frequently interrupted with ads that it [ADVERTISEMENT] breaks my focus. #pleaselikeandsubscribeandclickonthenotificationbell

Get sponsor block and ad block extensions or a client with it built in and never think about this again
I block on PC, but on phone and TV I'm stuck with their damn ads.
Or you know, pay for a subscription.
I can't, even if I want to. Premium is not sold in my country. So, more creative solutions are called for.
Youtube without Premium is unbearable for me. I rather pay a few € than submit my family to the advertising terror, and even the creators get more (6x, any yt creator here that can chime in?) revenue from a Premium view.

Imagine we could have Internet Premium and never see ads again.

I am glad to pay 7 € for YouTube Premium Lite.

For a while I didn´t consider the "full" Premium because I was always shown the 17 € version - which is for family.

Now suddenly I'm being shown there is a 12 € option which is for single person.

Still for someone like me who doesnt care about music or movies, I'll stick to the Lite version.