-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
萌新提问关于直播中视频avc codec发生变化的问题 #355
Comments
logcat (flv.js & |
media-internals
flv.js - log
|
第4个虚拟flv的时候,视频流发生了变化。 |
@xqq 情况和我说的可能有点不同,因为我把测试的结果混淆了,我测试过从main -> high或者从high -> main都会有问题。 |
codec变化后,音视频播放同时卡住似乎是在1.4.0引入的,具体是这次提交:MP4Remuxer: Not process if only one sample existed to avoid guessing … 对比:把 _remuxAudio、_reduxVideo 方法的这段判断去掉,就可以正常播放。(得研究下为什么加这段判断,去掉会有什么问题。) if (!samples || samples.length === 0) {
return;
} |
老铁给力,后来我也发现似乎和这附近的代码有些关系。不过非web开发,看不懂怎么改。 |
@alphonsetai 找到具体原因了,当codec发生变化时,flv.js 会生成新的 init segment,然后 append 到 mse里。 因为 mp4-remuxer 中 _videoStashedLastSample、_audioStashedLastSample 的存在,导致这个切换过程大概率会失败,因为新的 init segment 已经 append 到mse里,但是 旧的 video sample 或audio sample 还在缓存里。 此时会出现『用新的codec 去解 新的 sample』,因此会失败。 |
一年多了,兄弟还记得这个事情定位,点个赞啊。因为我自己是非web开发人员,当时再看media-internals的日志时,对比了hls.js的情况,确实没看到ffmpeg re-init。但又无法确认,确实不晓得该不该说。兄弟厉害,加个联系方式,以后多多交流啊 |
试了下,可以做如下改动: @alphonsetai 更优雅合理的处理,静候 @xqq 大佬发版 😄 |
过阵子有空了再改 |
if (samples.length === 1 && !force) {
// If [sample count in current batch] === 1 && (force != true)
// Ignore and keep in demuxer's queue
return;
} commit中貌似应该是这段新增导致的 |
@alphonsetai 可以试试这个PR: #551 ,我这边验证了下不同的场景,没有复现之前的问题。 |
感谢兄弟的定位,帮助很大,不过我这边由于换工作的关系,暂时没有再跟这个问题了。由于分工原因,我对前端了解少的离奇,看了一下兄弟修改代码,似乎符合当时定位和后续大家讨论的认知范围。待后续我造一个环境,我再看看。 |
@xqq 大佬最近有空改下吗?😄 |
您好,这一块修改的内容,可以提供下相关代码给参考下吗?对音视频一点都不懂,不知道该如何改起 |
直播过程中(音视频都有),一开始时用h264 main的编码进行直播。其中在不断流的情况下切换为h264 high,并发送新的avc confg和视频数据,时间戳写入正常。
通过调试发现推送数据给source buffer时,总是updating,导致音视频数据同时不播放。遇到这样的情况下,该如何查。
web开发萌新。
The text was updated successfully, but these errors were encountered: