gst-launch-1.0 v4l2src commands doesn't work

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

gst-launch-1.0 v4l2src commands doesn't work

10,970 Views
yibhan
Contributor III

Hi guys.

I am checking camera preview with gst-launch-1.0. I already checked camera preview with mxc_v4l2_overlay app embeded in rootfs. below is command used:

./mxc_v4l2_overlay.out -iw 720 -ih 576 -ow 640 -oh 480 -m 3 -di /dev/video0 fg

I have checked USB camera and it worked with below command:

 gst-launch-1.0 v4l2src device=/dev/video2 ! 'video/x-raw, width=640,height=480' ! imxv4l2sink

 

but, when i use gst-launch-1.0 for previewing of camera, It doesn't work. below is command used:

1.gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw, format=(string)UYVY,width=640,height=480,framerate=(fraction)30/1' ! autovideosink

2.gst-launch-1.0 v4l2src device=/dev/video0 ! autovideosink

 

Why that error happens? I want to know to fix that error for previewing of camera in application specially for opencv 

* linux ver. 4.14.98-2.0.0

0 Kudos
18 Replies

10,962 Views
joanxie
NXP TechSupport
NXP TechSupport

what board are you talking about?

0 Kudos

10,968 Views
yibhan
Contributor III

For your information,

preview format is 720x625 PAL, progressive.

0 Kudos

10,957 Views
yibhan
Contributor III

Hi guys,

Thank you for answering.

I am using Imx6qp and board is custom board.

0 Kudos

10,938 Views
yibhan
Contributor III

Hi Joanxie,

Do you have any comment for my issue?

0 Kudos

10,933 Views
joanxie
NXP TechSupport
NXP TechSupport

since you use PAL camera, you should video/x-raw, format=(string)UYVY,width=720,height=576, I don't know what you mean  doesn't work, pls share the logfile to check , maybe you can try like 'gst-launch-1.0 videotestsrc ! 'video/x-raw, format=(string)UYVY,width=720,height=576,framerate=25/1' ! imxvideoconvert_ipu !  'video/x-raw, format=RGB16' ! mfw_v4lsink'

0 Kudos

10,931 Views
yibhan
Contributor III

Hi Joanxie,

1. below is logfile when i used "gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=720, height=756, framerate=25/1' ! videoconvert ! imxv4l2sink

: In MVC: mxc_v4l_ioctl 80045626

    case VIDIOC_G_INPUT

Plpeline is live and does not neeIn MVC:mxc_v4l_ioctl PREROLL...

Setting pipeline tIn MVC: mxc_v4l_do_ioctl c0405602 PLAYING...

In MVC:mxc_v4l_ioctl

New clock: GstSystemClock

In MVC: mxc_v4l_do_ioctl c02c563a

    case VIDIOC_CROPCAP

ERROR: from element /GstPipeline: In MVC: mxc_v4l_close

pipeline0/GstV4l2Src:v4l2src0: Inmxc_v4l_close: release resource

internal data stream erro. 

Additi MVC: In mxc_free_frame_buffer

onal debug info:

../../../../gitIn MVC:mxc_free_frames

/libs/gst/base/gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline0/GstV4l2Src:v4l2src0:

streaming stopped, reason not-negotiated (-4)

2. below is command's logfile which you recommanded: 

/# gst-launch-1.0 videotestsrc ! 'video/x-raw, format=(string)UYVY,width=720,height=576,framerate=25/1' ! imxvideoconvert_ipu !  'video/x-raw, format=RGB16' ! mfw_v4lsink

WARNING: errorneous pipeline: no element "mfw_v4lsink"

 

 

 

0 Kudos

10,924 Views
joanxie
NXP TechSupport
NXP TechSupport

refer to the 4.14.98 user guide,

7.3.8 Camera preview
This example displays what the camera sees. It is only available on platforms with a camera.
$GSTL v4l2src ! 'video/x-raw, format=(string)$FORMAT,
width=$WIDTH, height=$HEIGHT, framerate=(fraction)30/1'
! v4l2sink
Camera preview example:
$GSTL v4l2src device=/dev/video1 ! 'video/x-raw,
format=(string)UYVY,width=640,height=480,framerate=(fraction)30/1'
! autovideosink
Parameter comments:

• Get the camera support format and resolution using gst-inspect-1.0 v4l2src.
• Set caps filter according to the camera's supported capabilities if the user needs other format or resolution.
• Ensure that the right caps filter has been set, which also needs to be supported by v4l2sink

 

 

0 Kudos

10,925 Views
joanxie
NXP TechSupport
NXP TechSupport

try to change "mfw_v4lsink" to "imxv4l2sink" in the second command

0 Kudos

10,930 Views
yibhan
Contributor III

Hi Joanxie,

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=720, height=756, framerate=25/1' ! videoconvert ! imxv4l2sink

-> I added "format=(string) UYVY" in above command but, didn't work

 

0 Kudos

10,922 Views
joanxie
NXP TechSupport
NXP TechSupport

this command works for you ?

"./mxc_v4l2_overlay.out -iw 720 -ih 576 -ow 640 -oh 480 -m 3 -di /dev/video0 fg"

0 Kudos

10,919 Views
yibhan
Contributor III

Hi Joanxie,

1. "./mxc_v4l2_overlay.out -iw 720 -ih 576 -ow 640 -oh 480 -m 3 -di /dev/video0 fg"

-> Yes, It works,

2. "gst-launch-1.0 videotestsrc ! 'video/x-raw, format=(string)UYVY, width=720,height=576,framerate=25/1, interlace-mode=(string)progressive' ! imxv4l2sink"

the above command works, but when change src from videotessrc to v4l2src, it doesn't work.

And, I have checked below command:

3. "gst-device-monitor-1.0" and results are:

(gst-device-monitor-1.0:645): GIn MVC:mxc_v4l_ioctl

Streamer-CRITICAL **: In MVC: mxc_v4l_do_ioctl c02c563a

gst_element_message_full_with_details: assertion 'GST_IS_ELEMENT(element)' failed

In MVC:mxc_v4l_close

mxc_v4l_close: release resource

MVC: In mxc_free_frame_buf

Invalid crop param: crop.w0, crop.h=0

mxc_v4l2_output v4l2_out: filed format:4 not supported yet!

Invalid crop param: crop.w0, crop.h=0

mxc_v4l2_output v4l2_out: filed format:4 not supported yet!

......

 

 

 

0 Kudos

10,911 Views
yibhan
Contributor III

Hi Joanxie,

Do you have any comment for my issue? I still have no idea to solve this issue.

0 Kudos

10,905 Views
yibhan
Contributor III

Hi Joanxie,

I should use gst-launch for camera application, but it still doesn't work.

Can you reproduce my issue on your side?

Do you have any solution to avoid this issue ?

0 Kudos

10,881 Views
joanxie
NXP TechSupport
NXP TechSupport

I only have ov5640 camera, I don't have PAL camera to test for you, I tested on my imx6qp board, I can successfully use the command without any error message

joanxie_0-1600418011694.png

 

0 Kudos

10,878 Views
yibhan
Contributor III

Hi Joanxie,

Thank for your answering. Could you give me favor?

Please let me know "v4l2-ctl --all -d 0" in your side.

My "v4l2-ctl --all -d 0" is :

================================

Video input: 0 (CSI IC MEM: ok)

Video output: 0 (DISP3 BG)

Video Standard = 0x000000ff

                            PAL-B/B1/G/H/I/D/D1/K

Format Video Capture:

                            Width/Height                 : 288/352

                            Pixel Format                  : 'Yu12"

                             Field                               : Any

                             Bytes per Line                : 432

------------------------------------

Format Video Overlay:

                                  Left/Top                       : 0/0

                                  Width/Height               : 160/160

-------------------------------------

Framebuffer Format:

                       capability                                  : Extern Overlay

                       Flags                                         : Overlay Matches Capture/Output Size

                       Width                                         : 0

                       Height                                        : 0

----------------------------------

Crop Capability Video Capture :

                        Bounds                   : Left 0, Top 0, Width 720, Height 625

                        Default                   : Left 0, Top 0, Width 720, Height 625

---------------------

 

0 Kudos

10,855 Views
joanxie
NXP TechSupport
NXP TechSupport

this is mine:

Driver Info:
Driver name : mxc_v4l2
Card type :
Bus info :
Driver version : 0.1.11
Capabilities : 0x05000005
Video Capture
Video Overlay
Read/Write
Streaming
Video input : 0 (CSI IC MEM: ok)
Video output: 0 (DISP3 BG)
Video Standard = 0x00000000

Format Video Capture:
Width/Height : 288/352
Pixel Format : 'YU12'
Field : Any
Bytes per Line : 432
Size Image : 152064
Colorspace : Default
Transfer Function : Default (maps to Rec. 709)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Limited Range)
Format Video Overlay:
Left/Top : 0/0
Width/Height: 160/160
Field : Any
Chroma Key : 0x00000000
Global Alpha: 0x00
Clip Count : 0
Clip Bitmap : No
Framebuffer Format:
Capability : Extern Overlay
Flags : Overlay Matches Capture/Output Size
Width : 0
Height : 0
Pixel Format : ''
Crop Capability Video Capture:
Bounds : Left 0, Top 0, Width 640, Height 480
Default : Left 0, Top 0, Width 640, Height 480
Pixel Aspect: 0/0
Crop: Left 0, Top 0, Width 640, Height 480
Streaming Parameters Video Capture:
Capabilities : timeperframe
Frames per second: 30.000 (30/1)
Read buffers : 0

0 Kudos

10,806 Views
yibhan
Contributor III

Hi Joanxie,

 

Thank you for answering.

Could you please whole command you have tried on captured screen? I couldn't get whole command you did.

The whole command might be cropped.

0 Kudos

10,546 Views
joanxie
NXP TechSupport
NXP TechSupport

 the whole command I use is as your demands, you need the result of using "v4l2-ctl --all -d 0"

0 Kudos