Why can I stream h264 encoded video from webcam to BOTH display and file, but NOT raw video?

Hjalmar Turesson hturesson at gmail.com
Wed Mar 25 05:06:33 PDT 2015


Hi,

I want to stream raw video from a Logitech C920 webcam and while *both*
displaying and saving the video to file using GStreamer 1.0.

This works if I stream h264 encoded video from the camera (the camera
provides hardware encoded h264), but it fails if I stream raw video from
the camera. However, if I only display, or only save to file, streaming raw
video works.

Why does it work with a h264 video stream but not with a raw video stream?

h264 encoded video stream from camera to BOTH display and file (WORKS):

gst-launch-1.0 -v v4l2src device=/dev/video0 ! \
 video/x-h264,width=640,height=480,framerate=15/1 ! \
 tee name=t t. ! queue ! h264parse ! avdec_h264 ! \
 xvimagesink sync=false t. ! queue ! h264parse ! \
 matroskamux ! filesink location='h264_dual.mkv' sync=false

raw video stream from camera to ONLY display (WORKS):
gst-launch-1.0 -v v4l2src device=/dev/video0 ! \
 video/x-raw,format=YUY2,width=640,height=480,framerate=15/1 ! \
 xvimagesink sync=false

raw video stream from camera to ONLY file (WORKS):
gst-launch-1.0 -v v4l2src device=/dev/video0 ! \
 video/x-raw,format=YUY2,width=640,height=480,framerate=15/1 ! \
 videoconvert ! x264enc ! matroskamux ! \
 filesink location='raw_single.mkv' sync=false

raw video stream from camera to BOTH display and file (FAILS):
gst-launch-1.0 -v v4l2src device=/dev/video0 ! \
 video/x-raw,format=YUY2,width=640,height=480,framerate=15/1 ! \
 tee name=t t. ! queue ! xvimagesink sync=false t. ! \
 queue ! videoconvert ! x264enc ! h264parse ! matroskamux ! \
 filesink location='raw_dual.mkv' sync=false

The last command (raw video to both display and file) fails without any
warnings or errors. The gst-launch terminal output is exactly the same as
when only writing to file. The xvimage window appears and displays an image
from the camera, but the image does not change (i.e. it is frozen). A zero
bytes file ('raw_dual.mkv') appears too. I tried first using the Python
bindings and debug threshold set to 4, but only once or twice (randomly)
did I see something that could be an error message (pausing after
gst_pad_push() = unknown).

Does anyone understand what I am doing wrong, or what I should do to figure
out what is wrong?


Best regards,

Hjalmar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150325/b922c0a5/attachment.html>


More information about the gstreamer-devel mailing list