webrtc - Gstreamer:到 VP8/webm 录制的 RTP 流不会产生可搜索的文件
问题描述
我正在使用 Gstreamer 将 WebRTC 流捕获到 webm 文件。我注意到在 rtp 流中使用 VP8 编码时,生成的文件在任何播放器(例如 Chrome 或 VLC)中都不可搜索。通过可搜索,我的意思是您不能从流中的任意点播放文件,它只能在播放时从一开始就开始。
我改为使用带有 rtp 的 h264 编码,并且生成的 mp4 文件是可搜索的。此外,删除 rtp 编码/解码会为 VP8 生成可搜索的输出文件。
这是产生这些结果的测试管道。
# produces a valid webm file that is not seekable (I need this to be seekable)
gst-launch-1.0 -e \
autovideosrc ! autovideoconvert ! vp8enc ! rtpvp8pay ! rtpvp8depay ! webmmux ! \
filesink location=test.webm
# produces a valid webm file that is seekable
gst-launch-1.0 -e \
autovideosrc ! autovideoconvert ! vp8enc ! webmmux ! \
filesink location=test.webm
# produces a valid mp4 file that is seekable
gst-launch-1.0 -e \
autovideosrc ! autovideoconvert ! x264enc ! rtph264pay ! rtph264depay ! h264parse ! mp4mux ! \
filesink location=test.mp4
有没有一种方法可以创建可搜索的 rtp/VP8/matroska 录音?这是 Gstreamer 中的错误吗?
我在 Ubuntu 上使用了 Gstreamer 1.14 和 1.18,结果相同。
解决方案
这是 webm 格式中的一个奇怪之处,它也会影响 MediaRecorder API。见这里。
简而言之,您需要在停止录制时更新文件开头的持续时间元数据。
推荐阅读
- python - 使用 Elasticsearch DSL Python 的复合 Elasticsearch 聚合
- json - 在 PhpStorm 内置 Web 服务器中打开 JSON 文件
- django - 在正在进行的项目中更改管理主题
- suitecrm - SuiteCRM api v8 没有给出任何响应
- angularjs - AngularJS 与同一浏览器中的两个选项卡进行通信
- python - 通过 SCP 客户端传输的 tar.gz 文件导致文件损坏
- karate - 基于空手道响应值的条件
- javascript - Javascript 过滤非数组 JSON 对象
- github - 有没有办法取消订阅来自 github 企业中特定组织的通知?
- javascript - 在reactjs或纯js中将div标签转换为tbody标签