0
votes

I'm using Gstreamer to capture a WebRTC stream to a webm file. I've noticed when using VP8 encoding in an rtp stream, the file produced is not seekable in any players (Chrome or VLC for example). By seekable, I mean that you cannot play the file from an arbitrary point in the stream, it only starts from the very start when played.

I've instead used h264 encoding with rtp and the resulting mp4 file is seekable. Also, removing rtp encoding/decoding produces a seekable output file for VP8.

Here's are test pipelines to produce these results.

# 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


Is there a method of creating a seekable rtp/VP8/matroska recording? Is this a bug in Gstreamer?

I've used both Gstreamer 1.14 and 1.18 on Ubuntu with the same results.

1
The issue here is not the lack of duration information, but the lack of a consistent frame rate. I believe the rtp protocol strips away the framerate information and the muxer can no longer encode it to produce a seekable file.ricosrealm

1 Answers

0
votes

This is an oddity in the webm format which also affects the MediaRecorder API. See here.

In a nutshell you need to update the duration metadata at the beginning of the file when you stop the recording.