1

I need to record a video using my usb webcam in my linux based pc. I found gstreamer with h264 encoding for lower the cpu percentage. But i am new to gstreamer so i had errors when running some gstreamer command. So, can any one tell me how to do that and give me proper command for gstreamer using h264 acceleration encoding. Thanks in advance.

Command Used:

gst-launch-1.0 -v v4l2src device=/dev/video1 ! omxh264enc ! qtmux ! filesink location=test.mp4

Setting pipeline to PAUSED ... Pipeline is live and does not need PREROLL ... Setting pipeline to PLAYING ... ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error. Additional debug info: gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: streaming stopped, reason not-negotiated (-4) Execution ended after 0:00:00.000161565 Setting pipeline to PAUSED ... Setting pipeline to READY ... Setting pipeline to NULL ... Freeing pipeline ...

Camera spec:

camera name: 3.0 USB Camera(Gearway Electronics (Dong Guan) Co., Ltd)

pixel_format: YUYV422 (30fps), MJPG (compressed) (60fps)

driver_support: uvcvide0

resolution_format: 640x480 , 1920x1080

Camera details from v4l2:

v4l2-ctl --info -d /dev/video2 --list-formats

Driver Info (not using libv4l2):

Driver name : uvcvideo

Card type     : 3.0 USB Camera

Bus info      : usb-70090000.xusb-1.2

Driver version: 4.9.140

Capabilities  : 0x84200001

    Video Capture

    Streaming

    Extended Pix Format

    Device Capabilities

Device Caps   : 0x04200001

    Video Capture

    Streaming

    Extended Pix Format

ioctl: VIDIOC_ENUM_FMT

Index       : 0

Type        : Video Capture

Pixel Format: 'MJPG' (compressed)

Name        : Motion-JPEG



Index       : 1

Type        : Video Capture

Pixel Format: 'YUYV'

Name        : YUYV 4:2:2
1

I believe you are missing the h264parse element which should go after the encoder, before the muxer.

gst-launch-1.0 -v v4l2src device=/dev/video1 ! omxh264enc ! h264parse ! qtmux ! filesink location=test.mp4

Also, you might need videoconvert element between v4l2src and encoder elements.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.