-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Videos: Improve detection of HEVC support for Google Chrome #3275
Comments
I thought transcoding was not done 'on the fly.' From what I can tell, videos are transcoded to AVC when they are played for the first time or when running the command. |
@lks-nbg It's interesting that it depends on the "User Agent Switcher" for you, as this frontend code should dynamically detect HEVC support: photoprism/frontend/src/common/caniuse.js Lines 45 to 47 in cad0eca
I also can't find the code you referenced in the photo model anymore? |
Did you check if the transcoding was caused by the bitrate limitation or if maybe the AVC version was streamed after all and the transcoding was simply not needed the second time (since it was cached)? |
@lastzero: you are right. I tested several videos but apparently they were all cached... Embarrassing, sorry about that. I checked with the media tab in chrome inspector and in both cases h.264 is used, even though chrome should support h.265. According to this blog the issue is within the canPlayType method. Chromium does not accept incomplete/ambiguous codec ids for HEVC (like 'hvc1'). The Codec string must have info about codec level/profile, as described in ISO/IEC FDIS 14496-15 section E.3, for example "hev1.1.6.L93.B0" (source) Therefore the current "canUseHevc" code will always return false on Chromium based browsers.
The solution mentioned in the blog was to specify the codec in the canUseHevc method to something like 'hvc1.2.4.L153.B0'. |
Signed-off-by: Michael Mayer <michael@photoprism.app>
I have changed the detection as suggested. An updated preview build will be available soon. As always, any help with testing is much appreciated! |
I'm having the same issue - HEVC videos play in Chrome but not within PhotoPrism UI. Would be happy to help test the change. How do I pull a preview build and test? I run as a docker container in Linux |
You can also test on our demo, by the way. It's based on the preview build. |
Confirmed the fix works, thanks @lastzero. I see the new check in browser dev tools - Chrome plays HEVC files now. Server log shows video: '....mp4' is HVC1 compressed and requires no transcoding, average bitrate 40.3 MBit/s |
Describe what problem this solves and why this would be valuable to many users
Last year Google added native support for HEVC/H.265 videos to Chrome 107 (https://chromestatus.com/feature/5186511939567616). Therefore transcoding is not necessary and can be skipped (like in #2379 for Safari) which improves playback performance and the amount of work done by the server.
Describe the solution you'd like
I used "User-Agent Switcher for Chrome" to test the functionality. By spoofing Safari as user-agent in Chrome, the playback performance improved significantly. So I assume the only changes required to implement this, are to adapt PR #2379 and skip transcoding for Chrome.
Describe alternatives you've considered
Additional context
List of supported browsers / version: https://caniuse.com/hevc
The text was updated successfully, but these errors were encountered: