WasmVideoPlayer icon indicating copy to clipboard operation
WasmVideoPlayer copied to clipboard

增加hls支持,播放ts视频文件。Uncaught RuntimeError: function signature mismatch

Open SakumotoJune opened this issue 5 years ago • 10 comments

背景:在原来的基础上增加了对hls的支持,重编了ffmpeg后,播放h264的ts文件。显示报错信息: 008acf7e-976:136 Uncaught RuntimeError: function signature mismatch at wasm-function[976]:0xbe99e at wasm-function[37]:0x2507 at wasm-function[617]:0x8a618 at wasm-function[2269]:0x1b46d3 at Object.Module._openDecoder (http://127.0.0.1:8989/libffmpeg.js:1:87431) at Decoder.openDecoder (http://127.0.0.1:8989/decoder.js:48:22) at Decoder.processReq (http://127.0.0.1:8989/decoder.js:167:18) at self.onmessage (http://127.0.0.1:8989/decoder.js:251:18)

报错前走到了[Core][DT] avformat_open_input success.

重编ffmpeg文件: emconfigure ./configure --cc="emcc" --cxx="em++" --ar="emar" --ranlib="emranlib" --prefix=$(pwd)/../WasmVideoPlayer/dist --enable-cross-compile --target-os=none
--arch=x86_32 --cpu=generic --enable-gpl --enable-version3 --disable-avdevice --disable-swresample --disable-postproc --disable-avfilter
--disable-programs --disable-logging --disable-everything
--enable-avformat --enable-decoder=hevc --enable-decoder=h264 --enable-decoder=aac
--disable-ffplay --disable-ffprobe --disable-ffserver --disable-asm --disable-doc --disable-devices --disable-network --disable-hwaccels
--disable-parsers --disable-bsfs --disable-debug --disable-indevs --disable-outdevs
--enable-protocol=file --enable-demuxer=mov --enable-demuxer=flv --enable-demuxer=hls --enable-demuxer=mpegts --enable-demuxer=acc --enable-demuxer=h264 --enable-demuxer=hevc

SakumotoJune avatar Apr 28 '20 07:04 SakumotoJune

是不是js和加载的wasm不匹配,禁用浏览器缓存试试,同时都加点打印看看是你编译的版本吗?

CodyXie avatar Apr 28 '20 23:04 CodyXie

是不是js和加载的wasm不匹配,禁用浏览器缓存试试,同时都加点打印看看是你编译的版本吗?

我在decode.c那里加了一条打印,确实使用的是我编译的版本。如果使用原来不支持hls的版本,在前一步就会失败。现在是avformat_open_input success输出之后报的错。

SakumotoJune avatar Apr 29 '20 05:04 SakumotoJune

尝试如果注释了decdode.c的avformat_find_stream_info方法不会报错,但是打开audio decode失败。

SakumotoJune avatar Apr 29 '20 06:04 SakumotoJune

是不是js和加载的wasm不匹配,禁用浏览器缓存试试,同时都加点打印看看是你编译的版本吗?

我在decode.c那里加了一条打印,确实使用的是我编译的版本。如果使用原来不支持hls的版本,在前一步就会失败。现在是avformat_open_input success输出之后报的错。

emcc多加些debug,代码多加些log

-g4 -s ASSERTIONS=2 -s SAFE_HEAP=1 -s STACK_OVERFLOW_CHECK=1 \ --source-map-base http://你的IP:端口

CodyXie avatar May 04 '20 12:05 CodyXie

尝试如果注释了decdode.c的avformat_find_stream_info方法不会报错,但是打开audio decode失败。

看到你播放的是TS,decoder要开mpeg1video,可以先用C代码确认可以解码,再来调试比较快

CodyXie avatar May 04 '20 12:05 CodyXie

尝试如果注释了decdode.c的avformat_find_stream_info方法不会报错,但是打开audio decode失败。

看到你播放的是TS,decoder要开mpeg1video,可以先用C代码确认可以解码,再来调试比较快

现在有个问题,播放时有明显的卡顿,音频质量很差。想知道具体看哪里的参数设置?

SakumotoJune avatar May 08 '20 09:05 SakumotoJune

请问这个问题解决了吗?

yyzhen avatar May 22 '20 02:05 yyzhen

请问这个问题解决了吗?

我的问题是在编译ffmpeg库的时候,添加对ts的支持,漏了 --enable-demuxer=mpegts,加上之后就可以了

SakumotoJune avatar Jun 22 '20 09:06 SakumotoJune

请问这个问题解决了吗?

我的问题是在编译ffmpeg库的时候,添加对ts的支持,漏了 --enable-demuxer=mpegts,加上之后就可以了

我编译开启了--enable-demuxer=mpegts,但是直接播放ts文件还是报该错误,请问你当时还做了哪些改动呢?感谢

guoguicheng avatar Mar 10 '21 09:03 guoguicheng

题主能不能上传源码支持HLS的,给大家白票一下!

ShengMingZh avatar Mar 29 '23 00:03 ShengMingZh