JohnCoates / Aerial

Apple TV Aerial Screensaver for Mac
MIT License
20.76k stars 1.05k forks source link

Feature: 4K Video Support #378

Closed peterrussell closed 5 years ago

peterrussell commented 6 years ago

Looks like we'll finally get high resolution videos as part of the Apple TV 4K. https://9to5mac.com/2017/09/11/tvos-11-4k-apple-tv-screensaver/

Can't wait to get them on my iMac

holgr commented 6 years ago

I wonder if anyone has found/published the new URL(s) to these yet?

quantumgolem commented 6 years ago

Great question. I'm looking for the links for the 4K videos, too.

AddoSolutions commented 6 years ago

The race is on!

JohnCoates commented 6 years ago

I'm looking as well. Seems like they've obfuscated the URLs in tvOS 11

AddoSolutions commented 6 years ago

That just means it's over SSL. Just need to do a MITM attack on a demo ATV and should be clear as day

JohnCoates commented 6 years ago

@AddoSolutions Haha, "Just". Apple tends to use SSL pinning. Hopefully they didn't in this case, but I wouldn't hold my breath on that route.

AddoSolutions commented 6 years ago

Yeah, I was thinking about that in the shower. On the normal device, you can add a SSL authority, and just do it that way. However, in this case, it may be more complicated because I don't think you can do that on Apple TV

JohnCoates commented 6 years ago

Even on regular iOS devices, Apple uses SSL pinning so that even root certs won't fool their critical services. Try opening the App Store on macOS or iOS while running your MITM proxy. You need to disable pinning with https://github.com/nabla-c0d3/ssl-kill-switch2 for example

quantumgolem commented 6 years ago

Can't you find the screensavers in the IPSW file? I can't check as I'm not a developer. That's what 9to5Mac said though (at least for the screensaver they put on YouTube)

kjg commented 6 years ago

The IPSW has a file called Default.mov in the screensaver app that I was able to find. This is probably what 9to5Mac found as well, but it does not include all of the videos, just that one demo. The rest of the videos probably still get streamed from web locations like with tvOS 10.

I wasn’t able to find any URLs in the IPSW that look like they point to a manifest file, but this is my first time looking through an IPSW and I’m not sure how to extract absolutely everything.

Maybe someone else can find it?

JohnCoates commented 6 years ago

Good news! I got the URLs. It wasn't in the IPSW, and the URL was transmitted using SSL pinning. Very hard to get. These 4k videos are really beautiful. Now I just need to figure out how I'm going to play them.

holgr commented 6 years ago

Any chance you can share the URL(s)? :)

finngaida commented 6 years ago

I'd be curious, too!

AddoSolutions commented 6 years ago

Yeah! Thats a total tease :)

msheaver commented 6 years ago

Me three! :)

Wondering how you found them as well!

Michael Sheaver 703-200-3008 msheaver@me.com www.michaelsheaver.com

AddoSolutions commented 6 years ago

Sounds like he used this https://github.com/nabla-c0d3/ssl-kill-switch2

AddoSolutions commented 6 years ago

C'mon, you are killing me!

parsamivehchi commented 6 years ago

Please add the new 4K screensavers. They're amazing.

JohnCoates commented 6 years ago

I'll post the URL here as soon as I release support for 4K. They're using HEVC which doesn't come with system support until High Sierra, so it's taking me a little longer.

As for how I found it: It was very hard, took me a long time to figure out, and requires a long explanation. To put it as simple as I can, I had to put my Apple TV running tvOS 11 through a proxy, but since I couldn't use SSL Kill Switch a lot of the connections were hidden. I had to correlate the request for the videos to the request for the sources URL, then since I couldn't see into that request I had to replicate it on the tvOS simulator, where I used a version of SSL Kill Switch that I modified to support this operation. The right modifications were found by using IDA Pro with Hex-Rays to reverse the simulator binaries resposible for checking the trust chain. Then I forged a request as if it came from the new 4K Apple TV.

If you have any questions or want more details feel free to DM me https://twitter.com/johncoatesdev

spitfire commented 6 years ago

https://sylvan.apple.com/Aerials/2x/entries.json

SuperDOS commented 6 years ago

any idea how to play them?

===================== Video =====================
Id                          : 1
Format                      : HEVC
Format info                 : High Efficiency Video Coding
Formatprofile               : Main 10@L5@High
Codec Id                    : dvh1
Duration (ms)               : 3mn 41s
Bit rate                    : 8 297 Kbps
Width                       : 3 840 pixels
Height                      : 2 160 pixels
Display aspect ratio        : 16:9
Frame rate mode             : Constant
Frame rate                  : 29.970 (30000/1001) fps
Color space                 : YUV
Chroma subsampling          : 4:2:0
Bit depth                   : 10 bits
Compression mode            : Lossy
Bits/(Pixel*Frame)          : 0.033
Stream size                 : 219 MB (100%)
Title                       : Core Media Video
Encoded date                : UTC 2017-07-23 19:18:01
Tagged date                 : UTC 2017-07-23 19:18:02
Color range                 : Limited
Color primaries             : BT.2020
Transfer characteristics    : SMPTE ST 2084
Matrix coefficients         : BT.2020 non-constant
Mastering display color pri : R: x=0.680000 y=0.320000, G: x=0.265000 y=0.690000, B: x=0.150000 y=0.060000, White point: x=0.312700 y=0.329000
Mastering display luminance : min: 0.0050 cd/m2, max: 4000.0000 cd/m2
Maximum Content Light Level : 10000 cd/m2
Maximum Frame-Average Light : 111 cd/m2
alistairmcmillan commented 6 years ago

@SuperDOS If you mean as part of the screensaver then all you need to do is be a little patient and let @JohnCoates work his magic. :)

If you mean outwith the screensaver then you can download them and they play in VLC fine.

SuperDOS commented 6 years ago

@alistairmcmillan tried VLC but won't show anything, Potplayer just displays artifacts.

spitfire commented 6 years ago

@SuperDOS even Safari/QuickTime player fail to open them on High Sierra. VLC displays just a few colored blocks. Haven't tried https://nightlies.videolan.org/build/macosx-intel/ yet

alistairmcmillan commented 6 years ago

@SuperDOS @spitfire Try the SDR versions they work fine in VLC right now. For everything else I'm afraid you'll need a little patience. :)

JohnCoates commented 6 years ago

There's no way to play the HDR files currently. I opened up an issue with VLC, https://trac.videolan.org/vlc/ticket/18813

I'll be adding support for the SDR files by using VLC

AddoSolutions commented 6 years ago

Yeah, I am able to open the SDR files just fine in VLC. Will be interesting to see how that affects performance (if my CPU is gonna be at 100% from this on my 2x 4k monitors :P I have 2x 1070s but I kind of doubt VLC is GPU accelerated.

JohnCoates commented 6 years ago

Great point on CPU usage. I'm contemplating supporting conversion to h264, but it takes a really long time to convert each video

AddoSolutions commented 6 years ago

So, weird thought, but is anyone using High Sierra? You'd think that apple would add support for the HDR videos (considering iPhones are HDR, and shoot HDR video, etc.) I would have to imagine that QuickTime has been updated to support it??

microbug commented 6 years ago

You'd think so, but I'm on the High Sierra Public GM and the HDR versions won't work with QuickTime or VLC. The SDR 4k ones are fine.

microbug commented 6 years ago

On my 4 core / 8 thread i7, VLC stutters and is almost unusable with the 4k SDR, QuickTime is around 20% CPU and is fine.

JohnCoates commented 6 years ago

Thanks for the heads up @microbug. I'll definitely add in conversion as an option, and default to Quicktime if on High Sierra.

albinekb commented 6 years ago

Just release a 2.0 that only supports high sierra and up, the others can use the old one 👍 IMHO. No need to clutter the code, just use Apples APIs to play the videos, they will def be most optimized of them all.

SuperDOS commented 6 years ago

Uploaded the SDR versions to Youtube (doesn't support HDR) and let them do the conversion :) . downloaded the converted MP4 version and it runs much smoother in VLC without HW decoding.

Kiran-B commented 6 years ago

I believe HDR video makes sense only if the display supports HDR. Software cannot compensate for the lack of HDR support in the display right? Also will 4K be useful if screensaver is being rendered on a 1080p display? Either ways, hope there will be an option to pick one of the 4 options Apple appears to provide(1080p SDR/1080p HDR/4K SDR/4K HDR). Do let me know if this needs to be put as a separate Enhancement request.

microbug commented 6 years ago

Indeed, most displays (including the built-in displays on all current iDevice and Mac products IIRC) don't support HDR so there's no point in using the HDR videos on them. The 4k screensaver might be crisper on a 1080p display than the original 1080p one, it depends how heavily the original was compressed. Someone could do a comparison between the two? Regardless, you'd probably want 1080p on a 1080p display when away from power as downscaling 4k will drain battery faster than playing 1080p.

microbug commented 6 years ago

@SuperDOS I wouldn't be that keen on using videos that have gone through YouTube. Their heavy compression turns nice videos to garbage. I'd be happy to do some higher-quality transcodes to x264 if needed, I have a spare machine to do it on.

peterrussell commented 6 years ago

The recent iMac (last 2015) screens have wide-colour-gamut displays (DCI P3). I think this is part of what is improved in HDR. Presumably an HDR video would look better on a wide-colour-gamut display than an SDR video would?

spitfire commented 6 years ago

I think transcoding and re-hosting videos breaks the law, there must be a way to use the existing files.

SuperDOS commented 6 years ago

@microbug I though so as well but was quite suprised how the converted 4k versions turned out from youtube. I use this videos as screen saver for kodi on my 4k philips and looks great.

===================== Video =====================
Id                          : 1
Format                      : AVC
Format info                 : Advanced Video Codec
Formatprofile               : High@L5.1
Formatsettings, CABAC       : No
Formatsettings, ReFrames    : 2 frames
Codec Id                    : avc1
Codec info                  : Advanced Video Coding
Duration (ms)               : 8mn 0s
Bit rate                    : 10.9 Mbps
Width                       : 3 840 pixels
Height                      : 2 160 pixels
Display aspect ratio        : 16:9
Frame rate mode             : Constant
Frame rate                  : 29.970 (30000/1001) fps
Color space                 : YUV
Chroma subsampling          : 4:2:0
Bit depth                   : 8 bits
Scan type                   : Progressive
Bits/(Pixel*Frame)          : 0.044
Stream size                 : 624 MB (100%)
Encoded date                : UTC 2017-09-19 06:35:07
Tagged date                 : UTC 2017-09-19 06:35:07
Color range                 : Limited
Color primaries             : BT.709
Transfer characteristics    : BT.709
Matrix coefficients         : BT.709
warpedgeoid commented 6 years ago

As @spitfire said, re-hosting the videos is likely going to violate the law in many jurisdictions; I know it will in the United States. All transcoding, if that is the route that is chosen, will have to be done on local hardware.

Honestly, I think you should support 4K/HDR on High Sierra only, using Apple's built-in playback support. Hardware decoding is an absolute requirement when you start getting to 4K and higher resolutions. All of this talk about transcoding videos is making this way more complicated than it needs to be.

huebs commented 6 years ago

I've been trying to look into @peterrussell's theory that HDR encoded video will look better on the WCG (P3) displays in the iMac and MacBook Pro.

This overview of HDR states:

Furthermore, in HDR TV standards, a given television has to also manage what’s called P3 color, or at least 90% of it. P3 refers to the P3 part of the total color spectrum, which is quite a bit larger than the older Rec.709 color spectrum used in previous 4K TV models.

All of the above amounts to what is also called the “Wide Color Gamut” ideal among 4K TV makers, which means wider coverage of color spectrum and much smoother gradation between all possible shades in that covered spectrum space. It’s an extended part of developing highly realistic display quality and high quality HDR.

Also, this CNET article says:

As I mentioned before, HDR and WCG often appear together, so most HDR material is also in WCG. Almost all 4K Blu-ray discs have wide color gamut. The same goes for HDR streams from places like Nextflix, Amazon and Vudu. To get an idea where you can get WCG content, check out Where can I get HDR TV shows and movies?

So... I think that means yes? I'm still not sure.

Follow up question: does anyone know if you hook up a LG 32UD99-W, will it fully display HDR encoded video?

I recently purchased a TCL 55P607 specifically because The Wirecutter said it was the best HDR display you can get for under a grand. Will my 2016 MacBook Pro be capable of sending it the same HDR content the new Apple TV can?

warpedgeoid commented 6 years ago

@huebs IIRC, true HDR requires 10+ bits per channel. Anything less and you just spread the finite colors across the wider gamut. If your display supports both 30-bit color and a wide gamut, then it should benefit at least somewhat from HDR videos.

maiwenn commented 6 years ago

For those who are wondering, we are able to play "url-4K-HDR" video files found here with QuickTime in High Sierra by changing the fourCC (video codec identifier) dvh1 to hvc1.

vi -b -c "%s/dvh1/hvc1/g" -c "wq" /path/to/video/file

habovh commented 6 years ago

Quality and comparison screenshots

For those who don't want to download pretty ugly (and quite big) HDR videos.

So here's a 2 comparison full screen screenshots between the (almost) same frame on both HDR and SDR video. Both files read by QuickTime on macOS High Sierra, HDR file converted using @maiwennleclercq's technique.

These are JPGs at maximum quality just to reduce file size to upload on GitHub, they were not modified and come straight from the screen capture PNG file

The screenshots actually look like the video in QuickTime

SDR

dub_aerial_4k_sdr

HDR

dub_aerial_4k_hdr

Comprehensive review

Viewed on the latest 2017 15" MacBook Pro, it seems like the HDR video is looking like an ungraded video. It mainly lacks contrast & saturation, in a very noticeable way. Whereas the SDR file just looks gorgeous and richer.

This might be due to the fact that QuickTime does not read the HDR file properly. The fact you have to change from dhv1 to hvc1 might be the reason the file doesn't get read properly, especially regarding contrast data, I'm not sure. It might as well be the fact the display is not HDR, not sure either.

TL;DR

HDR file won't get you any better image than SDR. On the contrary, as long as we do not have a proper way of playing HDR files, they will look ugly on your Mac.

Download the SDR.

maiwenn commented 6 years ago

@habovh Thank you for pointing that out.

spitfire commented 6 years ago

@habovh @maiwennleclercq probably some decoder issue, hope that changes in the future, but for now SDR looks better..

JohnCoates commented 6 years ago

@maiwennleclercq thanks for the technique to play HDR @habovh I appreciate the screenshot comparison

Just wanted to give everyone a heads up. I'm currently working on the update. Sorry it's taking longer than it should, work has kept me very busy. I'm updating from Swift 3 -> Swift 4 and cleaning up the codebase. A great designer has reached out and is working with me to give Aerial a bit of a facelift also. More details soon.

abhayap commented 6 years ago

That’s sounds great @johncoates. Patiently waiting for the update!

sebastienbarre commented 6 years ago

Thanks for the findings. I've downloaded one of these 4K HDR from the entries.json file to feed it to my LG OLED C7, which can play some of the 4K HDR I've thrown at it, but I believe they need to be in a mp4/mkv container (and HEVC 4096x2160@60P MP@L5.1, Main10 Profile@L5.1 50Mbps). If there is a video format magician here who could give me a hint as to how best convert from one container to another without losing too much quality, I'd be grateful (neither VLC or Handbrake did help). Thanks.