Unseekable mkv when recording MJPEG from V4L

Daniel Gnoutcheff gnoutchd at softwarefreedom.org
Thu Oct 12 19:13:17 UTC 2017


I have a few USB uvcvideo devices capable of generating MJPEG video. I'd
like to dump video from these devices and, if possible, avoid burning
CPU cycles on transcoding.

If I run this:

  gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg ! \
    matroskamux ! filesink location=camera.mkv

... I get a pipeline that runs, and I can even play back the resulting
file.  However, none of the media players I tried are able to seek
properly.  If I try to seek forward in gst123, it hangs and spins CPU
until I kill -9 it.  VLC hangs for several seconds and squawks:

> [00007eff80000178] clock decoder error: Timestamp conversion failed (delay 300000, buffering 100000, bound 9000000)
> [00007eff80000178] core decoder error: Could not convert timestamp 1060486159

... while mpv just quits with:

> [mkv] no target for seek found
> [mkv] Corrupt file detected. Trying to resync starting from position 36816083...
> (...) V: 00:00:09 / 00:01:36 (10%)
> [mkv] Cluster found at 214146677.
> (...) V: 00:00:09 / 00:01:36 (10%)
>
>
> Exiting... (End of file)

However, if I add a "jpegdec ! jpegenc" to the pipeline:

  gst-launch-1.0 -e v4l2src device=/dev/video1 ! image/jpeg ! \
    jpegdec ! jpegenc ! \
    matroskamux ! filesink location=camera.re-encoded.mkv

... then all of those errors disappear.

I'm quite puzzled.  I thought that "seekability" was a muxer concern, so
I'd think that the JPEG decode-encode cycle would be a (expensive)
no-op.  What's wrong with this pipeline, and what on earth is "jpegdec !
jpegenc" doing to fix it?

I've reproduced this behavior on two uvcvideo devices (my laptop's
camera and an HDMI grabber).  I'm running Debian stretch, with gstreamer
1.10.4, gstreamer-plugins-good 1.10.4, gst123 0.3.3, mpv 0.23.0, and VLC
2.2.6 (all as shipped from Debian).

Thanks,
Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20171012/204c464c/attachment.sig>


More information about the gstreamer-devel mailing list