Part Number: TMDXEVM8148
Tool/software: Linux
Hi,
I'm capturing video from component input on Kit EVM DM8148. I have some problems, could anyone help me for a second ?
I have replaced the content of script /etc/init.d/load-hd-firmware.sh with content of script load-hd-v4l2-firmware.sh. I have found /dev/video0,1,2,3,4,5,6 in linux.
/etc/init.d/matrix-gui-e stop
/etc/init.d/pvr-init stop
1. Using gstreamer
My camera output is 720p60. I run this pipeline
gst-launch v4l2src device=/dev/video0 always-copy=false queue-size=8 ! 'video/x-raw-yuv,format=(fourcc)NV12,width=1280,height=720,framerate=(fraction)60/1' ! omxbufferalloc numBuffers=8 ! gstperf ! omx_scaler ! v4l2sink device=/dev/video1
Here is output:
Setting pipeline to PAUSED ...
** (gst-launch-0.10:1448): CRITICAL **: gst_v4l2sink_sync_rotation: assertion `v4l2_ioctl (fd, VIDIOC_S_CTRL, &control) >= 0' failed
** (gst-launch-0.10:1448): CRITICAL **: gst_v4l2sink_sync_rotation: assertion `v4l2_ioctl (fd, VIDIOC_S_CTRL, &control) >= 0' failed
** (gst-launch-0.10:1448): CRITICAL **: gst_v4l2sink_sync_flip: assertion `v4l2_ioctl (fd, VIDIOC_S_CTRL, &control) >= 0' failed
Mode set is 720P60
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2574): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 40502700 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
!!!!!!!!!unreference all the remaining buffers!!!!!!!!!Setting pipeline to NULL ...
Freeing pipeline ...
Here is debug log: https://drive.google.com/open?id=0B1sYeYUmGy08X2hWSEdnRzFzb1k
In general, I can't use any pipeline which contains v4l2src.
2. Run saloopback and saLoopBackFbdev example
Capture and display are fine.
3. I am developing an application to capture from component input using V4L2 API.
I modify saloopback example to capture NV12 from input and write raw frame data into file.
I want to use format NV12 because I will encode frame data using omx_h264enc.
Here is code to set format
capt.fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_NV12; capt.fmt.fmt.pix.bytesperline = capt.fmt.fmt.pix.width * 3/2; capt.fmt.fmt.pix.sizeimage = capt.fmt.fmt.pix.bytesperline * capt.fmt.fmt.pix.height; printFormat("Capture before VIDIOC_S_FMT", &capt.fmt); ioctl(capt.fd, VIDIOC_S_FMT, &capt.fmt); // get format again and print it capt.fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ioctl(capt.fd, VIDIOC_G_FMT, &capt.fmt); printFormat("Capture after VIDIOC_G_FMT", &capt.fmt);
With width = 1280, height = 720, capt.fmt.fmt.pix.sizeimage = 1280*1.5 * 720 = 1382400 (bytes). However, when I get format again, capt.fmt.fmt.pix.sizeimage = 2073600 (bytes)
Capture before VIDIOC_S_FMT Format:
=============================================================
fmt.type = 1
fmt.width = 1280
fmt.height = 720
fmt.pixelformat = NV12
fmt.bytesperline = 1920
fmt.sizeimage = 1382400
=============================================================
=============================================================
Capture after VIDIOC_G_FMT Format:
=============================================================
fmt.type = 1
fmt.width = 1280
fmt.height = 720
fmt.pixelformat = NV12
fmt.bytesperline = 1920
fmt.sizeimage = 2073600
=============================================================
I copy raw file into my PC and use ffplay to display
ffplay -v info -f rawvideo -pixel_format nv12 -video_size 1280x720 raw.nv12
Frame data is wrong. Here is image: https://drive.google.com/open?id=0B1sYeYUmGy08X2IycVRuMWw2eU0
If I set format V4L2_PIX_FMT_YUYV, raw frame data is valid and I can play it.
Could anyone confirm something for me ?
+ With NV12 frame (1280x720), fmt.sizeimage = 1382400 bytes or 2073600 bytes
+ If fmt.sizeimage = 2073600, I think there are some padding bytes between Y and UV.
Could anyone help me about this format ? Of course, I have about it, but frame size must be width * height * 1.5.
Many thanks !