webassembly环境搭建、编译h265解码器、js调用
一、安裝docker環(huán)境
1.1、安裝docker源
cd /etc/yum.repos.d/
wget -o /etc/yum.repos.d/docker-ce.repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
1.2、修改源為阿里云
編輯替換https://download.docker.com 為http://mirrors.aliyun.com/docker-ce
vi docker-ce.repo
:%s#https://download.docker.com#http://mirrors.aliyun.com/docker-ce#g
yum clean all & yum makecache
1.3、安裝docker
yum install docker-ce
二、安裝emscripten鏡像
2.1、官方鏡像:
https://hub.docker.com/r/emscripten/emsdk
2.2、安裝鏡像
docker pull emscripten/emsdk
2.3、查看鏡像
docker images
2.4、后臺(tái)啟動(dòng)鏡像
docker run -itd emscripten/emsdk
2.5、查看運(yùn)行容器
docker ps -a
2.6、容器與服務(wù)器間文件拷貝
docker cp '服務(wù)器文件路徑' 容器ID(ps命令獲取):容器內(nèi)路徑
docker cp 容器ID(ps命令獲取):容器內(nèi)路徑 '服務(wù)器文件路徑'
2.7、進(jìn)入容器
docker attach 容器ID(ps命令獲取)
2.8、退出容器
exit
2.9、刪除運(yùn)行的容器
docker rm -f 容器ID(ps命令獲取)
鏡像不會(huì)被刪除
三、編譯wasm插件
3.1、解碼器開(kāi)源實(shí)現(xiàn)
https://github.com/goldvideo/decoder_wasm
3.2、編譯過(guò)程
下載ffmpeg源碼
https://codeload.github.com/FFmpeg/FFmpeg/zip/refs/tags/n4.4
decoder_wasm和ffmpeg置于同一級(jí)文件夾,執(zhí)行腳本build_decoder_265.sh
3.3、生成文件
如下libffmpeg_265.wasm文件和libffmpeg_265.js文件配套使用
4.4、js調(diào)用方法
4.5、yuv渲染
可用webgl或canvers2d,參考開(kāi)源項(xiàng)目
https://github.com/p4prasoon/YUV-Webgl-Video-Player
四、參考:
https://github.com/goldvideo/decoder_wasm
https://github.com/p4prasoon/YUV-Webgl-Video-Player
https://blog.csdn.net/csdn_fd/article/details/113702190
https://blog.csdn.net/kkae8643150/article/details/104942108?utm_medium=distribute.pc_aggpage_search_result.none-task-blog-2~aggregatepage~first_rank_v2~rank_aggregation-3-104942108.pc_agg_rank_aggregation&utm_term=docker%E6%90%AD%E5%BB%BAffmpeg&spm=1000.2123.3001.4430
https://www.runoob.com/docker/docker-container-usage.html
總結(jié)
以上是生活随笔為你收集整理的webassembly环境搭建、编译h265解码器、js调用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: BZOJ2525: [Poi2011]D
- 下一篇: [css] 当页面采用rem布局时,如