Git Product home page Git Product logo

Comments (25)

StaZhu avatar StaZhu commented on May 23, 2024 1

Yeah, Just tried, working as expected.

As for the bad case where HEVC video encoded by adobe premiere hw encoder, I also submit a Cl to do the fix:

https://chromium-review.googlesource.com/c/chromium/src/+/3956315

Hope it will help you playback any hevc video encoded by any encoder.

from thorium-win.

Alex313031 avatar Alex313031 commented on May 23, 2024

@Delphox Thanks, that is helpful. In fact, I have forced PlatformHEVCDecoderSupport to true in source code, as well as force enabled vaapi for linux, to make hardware acceleration and HEVC work in as many instances as possible, without the user having to be more tech savvy.

I made that change in M104. But what I DID change between M106 and M107 is adding an FFMPEG software decoding patch for HEVC, which didn't seem to do anything on linux, and now you send in this issue, which leads me to believe that not only is it not working, but it is actually breaking HEVC in instances when it would normally play!!

I will revert the patch, make some test builds, and test on my machine. However, I do not have a windows machine with a GPU capable of hardware HEVC decoding, so would you like to be a beta tester for this release? If it works, then I will go ahead and release it. If it doesn't, I might release it but I might not, depending on if I can get more insight into the whole HEVC dilemma across all of Thorium's supported platforms.

from thorium-win.

Delphox avatar Delphox commented on May 23, 2024

Yea sure, I can test it!

from thorium-win.

StaZhu avatar StaZhu commented on May 23, 2024

@Delphox Did you tested on Chrome Canary? And may i ask if chrome canary also have this problem?

from thorium-win.

Delphox avatar Delphox commented on May 23, 2024

@StaZhu Just tested Canary 107.0.5300.0, and HEVC videos play fine when launched with --enable-features=PlatformHEVCDecoderSupport

EDIT: that was actually Dev 107.0.5300.0. Regardless, I tested on Canary 108.0.5305.0, and obtained the same result.

from thorium-win.

StaZhu avatar StaZhu commented on May 23, 2024

This feature will be enable by default since Chrome 107, so if you have any issue, please fire a bug in crbug.com or simply submitting a issue on https://github.com/StaZhu/enable-chromium-hevc-hardware-decoding (I am the developer of this feature, so please feel free to do that if you have any issue). And the patch @Alex313031 uses has nothing to do with the issue i think.

from thorium-win.

StaZhu avatar StaZhu commented on May 23, 2024

@StaZhu Just tested Canary 107.0.5300.0, and HEVC videos play fine when launched with --enable-features=PlatformHEVCDecoderSupport

okey then, maybe alex need to take a look at this. But i promise that patch should work well.

from thorium-win.

Alex313031 avatar Alex313031 commented on May 23, 2024

@StaZhu I used this patch, but it still seems to not play H265 content on linux, or windows.

from thorium-win.

StaZhu avatar StaZhu commented on May 23, 2024

@StaZhu I used this patch, but it still seems to not play H265 content on linux, or windows.

The patch should provide software decode ability, an should works well on linux, mac, and windows, if its not working, then i must be because of some other reason but not the patch itself.

I recently upload a self built chromium 108 to my repo which includes that patch and can works (no linux though) with Hardware decoding simultaneously and provide HW+SW decoding.

You can provide log of chrome://media-internals if you can’t play the video. And perhaps i can help to debug.

from thorium-win.

Delphox avatar Delphox commented on May 23, 2024

Alright I did further testing, including the build from @StaZhu's repo, and turns out the problem is a bit more strange. So turns out Thorium 107 as well as StaZhu's 108 built can play HEVC, as long as its encoded by software (libx265 in this case). If it's generated by hardware-accelelerated encoding (hevc_amf in my case), they don't play on Thorium 107 and as well as StaZhu's custom chrome, but play fine everywhere else (including Thorium 106 and mainline Chrome (launched with the argument to enable HEVC). I'll attach the two examples:

This one plays fine (encoded with libx265):
https://user-images.githubusercontent.com/5883538/190943052-c5cb195f-711a-4851-a5e3-c1b7cf80d06c.mp4

This one doesn't play on Thorium 107/StaZhu's custom 108, but plays on Thorium 106, as well as regular Chrome launched with --enable-features=PlatformHEVCDecoderSupport (encoded with hevc_amf)
https://user-images.githubusercontent.com/5883538/190943082-ec0fd5da-bd0e-4301-a883-80e87a18c5e4.mp4

chrome://media-internals doesn't seem to show anything interesting.

Both files were encoded on ffmpeg defaults for each respective encoder (libx265 and hevc_amf). But the same result happens if I encode from Adobe Premiere software and hardware encode (first works and second doesn't).

from thorium-win.

StaZhu avatar StaZhu commented on May 23, 2024

Okey, I can reproduce this on the custom build version of chromium 108, and not able to reproduce on chrome canary 108.

So clearly it has something to do with the ffmpegdemuxer (chrome canary extract hevc config by itself, chromium uses that ffmpeg patch, and may change the logic for ffmpegdemuxer ).

I will take some time to debug on this though. thanks for the report.

from thorium-win.

StaZhu avatar StaZhu commented on May 23, 2024
From 95944c0a2996f5e4181e0a4fcb4771f78eef9265 Mon Sep 17 00:00:00 2001
From: Sta Zhu <[email protected]>
Date: Mon, 19 Sep 2022 14:13:26 +0800
Subject: [PATCH] Remove color space check

---
 media/base/supported_types.cc | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/media/base/supported_types.cc b/media/base/supported_types.cc
index 0f7e6d7a31c2b..e80cea93ceaef 100644
--- a/media/base/supported_types.cc
+++ b/media/base/supported_types.cc
@@ -201,9 +201,6 @@ bool IsAudioCodecProprietary(AudioCodec codec) {
 #endif  // !BUILDFLAG(USE_PROPRIETARY_CODECS)
 
 bool IsHevcProfileSupported(const VideoType& type) {
   // Remove the color space check
-  if (!IsColorSpaceSupported(type.color_space))
-    return false;
-
 #if BUILDFLAG(ENABLE_PLATFORM_HEVC)
   return true;
 #else
-- 
2.36.1.windows.1

@Alex313031 Apply this patch will fix the issue.

from thorium-win.

StaZhu avatar StaZhu commented on May 23, 2024
[{"alpha mode":"is_opaque","codec":"hevc","coded size":"1920x1080","color space":{"matrix":"BT709","primaries":"INVALID","range":"LIMITED","transfer":"BT709"},"encryption scheme":"Unencrypted","has extra data":true,"hdr metadata":"unset","natural size":"1920x1080","orientation":"0Β°","profile":"hevc main","visible rect":"0,0 1920x1080"}]

It turns out that ffmpeg demuxer thinks the primaries is "INVALID" (i dont know why, ffmpeg should not return such result), but chrome indeed check if the primaries is invalid or not which causes the issue. The reason why regular chrome works is because regular version of chrome doesn't include ffmpeg h265 parser and decoder, so the color space is actually extract by chrome itself, so this is the root cause.

The check is too strict, so simply remove it will works, i will update my patch today as well.

from thorium-win.

StaZhu avatar StaZhu commented on May 23, 2024

@Alex313031 Try the new patch for chromium 108, just update the logic.

Patch1: https://github.com/StaZhu/enable-chromium-hevc-hardware-decoding/blob/main/remove-main-main10-profile-limit.patch

Patch2: https://github.com/StaZhu/enable-chromium-hevc-hardware-decoding/blob/main/add-hevc-ffmpeg-decoder-parser.patch

from thorium-win.

Alex313031 avatar Alex313031 commented on May 23, 2024

@midzer Looks like our x265 problems may be solved lol. I was wondering why it wasnt working for me, since I did not change anything in @StaZhu patches. Thanks for your work. I will try soon with the next M108 thorium release.

from thorium-win.

StaZhu avatar StaZhu commented on May 23, 2024

@midzer Looks like our x265 problems may be solved lol. I was wondering why it wasnt working for me, since I did not change anything in @StaZhu patches. Thanks for your work. I will try soon with the next M108 thorium release.

That perhaps because you enable the hw decoder for linux, and that hw decoder failed to decode and finally causing the ffmpeg sw decoder not able to fallback. you can try to disable hw decoder by changing enable_hevc_parser_and_hw_decoder to false. and let ffmpeg sw decoder take over the decoding job.

from thorium-win.

Delphox avatar Delphox commented on May 23, 2024

So Alex just released Thorium 108, and I'm happy to report that videos encoded with ffmpeg's hevc_amf HW encoder now play! Thank you for the fix!

However, another realization is that HEVC videos encoded with Adobe Premiere's HW still don't play, and upon testing, they don't play on Chrome Dev 107 either, so I think they never worked on Chrome to begin with. But now that the other HEVCs work it was easier to isolate this.

@StaZhu Here's a video attachment for the same sample video but rendered on Adobe Premiere HW HEVC encoder:

Big_Buck_Bunny_1080_10s_1MB_2.mp4

Btw they work on Edge with h265ify but considering Edge routes them through an entirely API I don't think that's helpful.

from thorium-win.

StaZhu avatar StaZhu commented on May 23, 2024

So Alex just released Thorium 108, and I'm happy to report that videos encoded with ffmpeg's hevc_amf HW encoder now play! Thank you for the fix!

However, another realization is that HEVC videos encoded with Adobe Premiere's HW still don't play, and upon testing, they don't play on Chrome Dev 107 either, so I think they never worked on Chrome to begin with. But now that the other HEVCs work it was easier to isolate this.

@StaZhu Here's a video attachment for the same sample video but rendered on Adobe Premiere HW HEVC encoder:

Big_Buck_Bunny_1080_10s_1MB_2.mp4

Btw they work on Edge with h265ify but considering Edge routes them through an entirely API I don't think that's helpful.

Sure, let me figure out what happens with the adobe HEVC video, I will let you know when i fix the bug, thanks for your feedback.

from thorium-win.

StaZhu avatar StaZhu commented on May 23, 2024

@Delphox It turns out that the adobe encoder write color_primaries = 0 (0 means invalid) to SPS and official Chrome will reject to support an invalid color primaries. so if the encoder write color_primaries >= 0, then it will be okey to pass the color primaries detection. This logic not only applied for HEVC, but also for AV1, and VP9, so i don't think I can submit a CL to persuade chrome media team allow an invalid value, maybe ask adobe why they write that color_primaries = 0 is more reasonable, since if a encoder doesn't know the primaries of a video, they should simply write color_primaries = 1 (1 means unspecfied)(or perhaps your original video also has this value equals 0, so you should check if it is like what i said).

20220923-114425

but Thorium 108 should have already not detect colorspace now if alex apply my patch correctly, and you should be able to play the adobe video on thorium 108, are you sure you can't play the adobe video on Thorium 108?

from thorium-win.

Delphox avatar Delphox commented on May 23, 2024

I see, thanks for checking. Yea I guess Adobe's HEVC HW encoder is just kinda broken then, I'll keep that in mind.

And yea I'm sure, I tested on the AXV2 release from a few hours ago which is the one I use but I assume the mainline one will have the same result. So I guess we wait for Alex here, to make sure he applied it or just reverted to old behavior for now as the patch is very recent.

from thorium-win.

Alex313031 avatar Alex313031 commented on May 23, 2024

@StaZhu Hey I appreciate you coming on to this an helping! How did you hear of this issue, like how did you become aware of thorium?

from thorium-win.

StaZhu avatar StaZhu commented on May 23, 2024

@StaZhu Hey I appreciate you coming on to this an helping! How did you hear of this issue, like how did you become aware of thorium?

Yeah~ I usually simply search PlatformHEVCDecoderSupport once a week in case anyone has a feedback on this feature, then fix it, thats it!

from thorium-win.

Alex313031 avatar Alex313031 commented on May 23, 2024

@StaZhu @Delphox Latest Linux and Windows versions now play HEVC content with software decoding or hardware decoding.

https://github.com/Alex313031/Thorium-Win/releases/tag/M109.0.5362.0

from thorium-win.

Delphox avatar Delphox commented on May 23, 2024

Small update regarding the Adobe Premiere case, I recently upgraded to Premiere 2022 (I previously had 2020) and now HEVC videos encoded by HW are good, even run on Thorium 107. Still a good idea to have them play for older rendered videos and other edge cases, but at least Adobe fixed it.

from thorium-win.

Delphox avatar Delphox commented on May 23, 2024

As for the bad case where HEVC video encoded by adobe premiere hw encoder, I also submit a Cl to do the fix:

https://chromium-review.googlesource.com/c/chromium/src/+/3956315

Hope it will help you playback any hevc video encoded by any encoder.

Just tested 109 chrome Dev and the bad videos from old premiere play out of the box thanks to your merged fix! So now since both upstream Chrome and Thorium (the relevant repo here) play any HEVC video regardless of encoder it's time to close this issue. Thank you again @StaZhu for getting this fixed not only in Thorium but in Chromium as a whole! 😁

from thorium-win.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.