Showing results for 
Show  only  | Search instead for 
Did you mean: 
Registered: ‎10-31-2019

How to send raw image with NV12 format to Gstreamer pipeline in order to do encode with VCU ?


I am trying to implement following scenerio :

1- Receive image from camera with UYVY format.

2- Convert UYVY format to NV12 format with using xfopencv.

3- Encode resulting raw frame with VCU.


For simulating this purpose, I decode jpg file and convert its frame format to UYVY. Also I use just a simple file instead of VCU.

In implementation,

I instantiate VideoCapture and VideoWriter classes with the following statements: 



	cv::VideoCapture cap{"filesrc location=/home/xilinx/10_Years_Compiling_blue_1280x720.jpg ! "
			"jpegdec ! "
			"videoconvert ! "
			"video/x-raw, format=RGB ! "
			"videoconvert ! "
			"video/x-raw, format=UYVY ! "
			"appsink ",






	cv::VideoWriter writer2 { "appsrc caps=video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! filesink location=/home/xilinx/out.nv12 ",
			30.0, // fps
			cv::Size{WIDTH, HEIGHT},




I received frame from "cap" then convert received frame's format to NV12 with using xfopencv's uyvy2nv12 function.

Then I inserted resulting frame to "writer2".

After all, the resulting "out.nv12" has 0 bytes.

Because of this, I started to search for gstreamer log and here is the log :




0:00:00.274078610 17751   0x7f80004b30 DEBUG                 appsrc gstappsrc.c:1344:gst_app_src_set_caps:<appsrc0> setting caps to video/x-raw, format=(string)NV12, width=(int)1280, height=(int)720, framerate=(fraction)30/1
0:00:00.274530460 17751   0x7f80004b30 DEBUG                 appsrc gstappsrc.c:688:gst_app_src_internal_get_caps:<appsrc0> caps: (NULL)
0:00:00.274609500 17751   0x7f80004b30 DEBUG                 appsrc gstappsrc.c:688:gst_app_src_internal_get_caps:<appsrc0> caps: (NULL)
0:00:00.274756320 17751   0x7f80004b30 DEBUG                 appsrc gstappsrc.c:1344:gst_app_src_set_caps:<appsrc0> setting caps to video/x-raw, format=(string)BGR, width=(int)1280, height=(int)1080, framerate=(fraction)30/1
0:00:00.274801790 17751   0x7f80004b30 DEBUG                 appsrc gstappsrc.c:1509:gst_app_src_set_stream_type:<appsrc0> setting stream_type of 0
0:00:00.274838510 17751   0x7f80004b30 DEBUG                 appsrc gstappsrc.c:1401:gst_app_src_set_size:<appsrc0> setting size of -1
0:00:00.275134400 17751   0x7f80004b30 DEBUG                 appsrc gstappsrc.c:865:gst_app_src_start:<appsrc0> starting
0:00:00.275552640 17751     0x2ec93630 DEBUG                 appsrc gstappsrc.c:688:gst_app_src_internal_get_caps:<appsrc0> caps: (NULL)
elapsed time 11193384
Minimum error in intensity = 255.000000 (0, 0)
									Maximum error in intensity = 0.000000 (0, 0)
									Percentage of pixels above error threshold = nan
0:00:01.911439960 17751   0x7f80004b30 DEBUG                 appsrc gstappsrc.c:2053:gst_app_src_end_of_stream:<appsrc0> sending EOS
0:00:01.911512310 17751     0x2ec93630 DEBUG                 appsrc gstappsrc.c:1296:gst_app_src_create:<appsrc0> we are EOS
0:00:01.912121830 17751   0x7f80004b30 DEBUG                 appsrc gstappsrc.c:835:gst_app_src_unlock:<appsrc0> unlock start
0:00:01.912198790 17751   0x7f80004b30 DEBUG                 appsrc gstappsrc.c:850:gst_app_src_unlock_stop:<appsrc0> unlock stop
0:00:01.912236240 17751   0x7f80004b30 DEBUG                 appsrc gstappsrc.c:885:gst_app_src_stop:<appsrc0> stopping




What I understand from this log is, gstreamer override explicitly defined appsrc caps in runtime. 

Why the gstreamer override explicity defined caps ? How can I disable this behaviour ?

I am totally new in this area, so If you know any other method to achieve the main purpose, please let me know...


Thanks for your time.


Tags (2)
0 Kudos
0 Replies