Skip to content
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

示例中看不到 使用WebCodecs api 硬解hevc 的例子 感觉设置了硬解 也不起作用。都是wasm软解 #24

Open
gihtubnmjf opened this issue Oct 28, 2024 · 11 comments

Comments

@gihtubnmjf
Copy link

示例中看不到 使用WebCodecs api 硬解hevc 的例子 感觉设置了硬解 也不起作用。都是wasm软解。请问怎么才能看到WebCodecs 硬解的例子

@zhaohappy
Copy link
Owner

你是指播放器 demo 还是直接用 api 写代码

@gihtubnmjf
Copy link
Author

都可以 ,想学习一下如何用WebCodecs api 硬解hevc

@zhaohappy
Copy link
Owner

zhaohappy commented Oct 28, 2024

播放器优先使用硬解,不用设置。api 看这个decode。把 WasmVideoDecoder 换成WebVideoDecoder 传 enableHardwareAcceleration: true 。hevc 硬解需要硬件支持。

@gihtubnmjf
Copy link
Author

你好 还是有点看不懂。WebCodecs api 硬解hevc 可以写个demo页面吗?

@zhaohappy
Copy link
Owner

hardwareDecode 你把它编出来写一个 html 输入一个 hevc 的 flv 文件就解码出来了。

@gihtubnmjf
Copy link
Author

https://ks3-cn-beijing.ksyun.com/ksplayer/h265/outside_demo/v1.1.3/720P2M30fpsh265-wasmtest.flv 解码失败

[src\avcodec\webcodec\VideoDecoder.ts][line 223] [error] decode error, InvalidStateError: Failed to execute 'decode' on 'VideoDecoder': Cannot call 'decode' on a closed codec.
1 decode error

@zhaohappy
Copy link
Owner

你这个码流应该有问题,硬解会失败,只能回退到软解。我转封装成 mp4 用 video 元素播放 chrome 也无法播放。

@gihtubnmjf
Copy link
Author

@zhaohappy
Copy link
Owner

之前改动一个地方出现 bug 了,已经修复

@gihtubnmjf
Copy link
Author

onReceiveFrame(frame) {
// 这里拿到解码出的帧
console.log('receive frame', frame.timestamp)
frame.close()
},
这个函数 我收到了回调 但是 用canvas截图 什么图像都没有显示出来。不知道什么原因?能写个例子示范一下吗?

BF7CB3BC-0CA2-404a-8294-0D59B36D5E2D

@zhaohappy
Copy link
Owner

可以看看这个 videoRender

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants