1

I have an issue with v4l2 not reading the camera feed correctly. Or more probably gstreamer not initiating the v4l2 ctl correctly.

Infra:

Banana Pi M2+ OV5640 Camera

modprobe ov5640
modprobe vfe_v4l2

My problem: Camera works fine with motion but I can't get it to work with gstreamer.

This is my manually compiled gstreamer:

$ gst-launch-1.0 -v v4l2src ! "image/jpeg,width=160,height=120,framerate=30/1" ! rtpjpegpay ! udpsink host=192.168.1.2 port=5001
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3064): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.003571242
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...






ben@bananapim2plus:~/src/gst-plugins-good/tests/examples/v4l2$ ./v4l2src-renegotiate
Setting resolution to '320x240'
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:src: Device '/dev/video0' failed during initialization
Additional debug info:
gstv4l2object.c(3785): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/GstV4l2Src:src:
Call to S_FMT failed for YUYV @ 320x240: Operation not permitted
ben@bananapim2plus:~/src/gst-plugins-good/tests/examples/v4l2$ ./camctrl
ERROR: from element /GstPipeline:camera/GstV4l2Src:v4l2src0: Device '/dev/video0' failed during initialization
Additional debug info:
gstv4l2object.c(3785): gst_v4l2_object_set_format_full (): /GstPipeline:camera/GstV4l2Src:v4l2src0:
Call to S_FMT failed for YUYV @ 640x480: Operation not permitted

I can hear the camera "click"

gst
  • 1,251
  • 1
  • 14
  • 32
stKKd
  • 444
  • 1
  • 5
  • 11
  • 1
    Does `v4l2-ctl --list-formats-ext` list the format you are trying to set? You need to set one that is supported by the camera. – Florian Zwoch Nov 01 '18 at 20:25
  • @FlorianZwoch: Let's try with format index UYVY which is supported according to output of your command `gst-launch-1.0 -v v4l2src ! video/x-raw, format=UYVY , framerate=10/1, width=1280, height=720 ! filesink location=raw.yuv` Launches, I let it run for a few minutes, CTRL-C -> filesize is 0 bytes – stKKd Nov 02 '18 at 03:27
  • 1
    As Florian mentioned, seems like your camera does not allow you to capture in the format or resolution you want to set. Try capturing in the raw RGB format. – gst Nov 02 '18 at 14:18
  • @vk_gst Here are my formats: https://pastebin.com/rGERQ9Ns I tried to combine some with video/x-raw-yuv or video/x-raw-rgb without success – stKKd Nov 02 '18 at 19:58
  • Using cap-v4l2 (from avafinger) I could determine and take snapshots up to 2592x1936 pixels. Used pixel format is: 1: [0x32315559] 'YU12' (planar YUV 420) – stKKd Nov 02 '18 at 22:22

1 Answers1

1

Thanks guys, I managed to have it working!

video/x-raw,format=I420

Viewer side (Windows):

gst-launch-1.0 -v udpsrc port=5001 caps = "application/x-rtp\,\ media\=\(string\)video\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)MP4V-ES\,\ profile-level-id\=\(string\)1\,\ config\=\(string\)000001b001000001b58913000001000000012000c48d8800cd3204709443000001b24c61766335362e312e30\,\ payload\=\(int\)96\,\ ssrc\=\(uint\)2873740600\,\ timestamp-offset\=\(uint\)391825150\,\ seqnum-offset\=\(uint\)2980" ! rtpmp4vdepay ! avdec_mpeg4 ! autovideosink

Camera side (Banana):

/usr/bin/gst-launch-1.0 -v v4l2src ! video/x-raw,format=I420,width=800,height=600,framerate=15/1 ! avenc_mpeg4 ! rtpmp4vpay config-interval=3 ! udpsink host=192.168.1.2 port=5001
stKKd
  • 444
  • 1
  • 5
  • 11