Capture encode usecase for CSI camera ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Capture encode usecase for CSI camera ?

ssshukla26
Hi, I am accessing a OV5640 camera sensor with my custom hardware using CSI interface. I am not able to run a capture encode usecase. This camera is v4l2 compliant and has v4l2 compliant driver also. The camera sensor outputs frames in UYVY format and I am doing things as follows.

#Verify the sensors availability
media-ctl -d /dev/media1 -p

#Setting up camera
media-ctl -d /dev/media1 -l '"msm_csiphy1":1->"msm_csid1":0[1],"msm_csid1":1->"msm_ispif":0[1]'

media-ctl -d /dev/media1 -V '"ov5640_sec 1-003c":0[fmt:UYVY2X8/1920x1080],"msm_csiphy1":0[fmt:UYVY2X8/1920x1080],"msm_csid1":0[fmt:UYVY2X8/1920x1080]'

#Image capture
gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! 'video/x-raw,format=UYVY,width=1920,height=1080,framerate=30/1' ! jpegenc ! filesink location=image.jpg

#Raw video capture
gst-launch-1.0 -e v4l2src device=/dev/video0 ! video/x-raw,format=UYVY,width=1920,height=1080,framerate=30/1 ! filesink location=final.yuv

#Encode video (using yuv file of uyvy format)
gst-launch-1.0 -v filesrc location=final.yuv blocksize=3110400 ! videoparse format=uyvy width=1920 height=1080 framerate=30/1 ! videoconvert ! video/x-raw,format=I420,width=1920,height=1080,framerate=30/1 ! x264enc ! mp4mux ! filesink location=final.mp4

#Convert YUV to I420
gst-launch-1.0 -v filesrc location=final.yuv blocksize=3110400 ! videoparse format=uyvy width=1920 height=1080 framerate=30/1 ! videoconvert ! video/x-raw,format=I420,width=1920,height=1080,framerate=30/1 ! filesink location=final_i420.yuv

#Encode video (using yuv file of i420 format)
gst-launch-1.0 -v filesrc location=final_i420.yuv blocksize=3110400 ! videoparse width=1920 height=1080 framerate=30/1 ! x264enc ! mp4mux ! filesink location=final.mp4

#Capture - Encode Usecase
gst-launch-1.0 -e v4l2src device=/dev/video0 ! video/x-raw,format=UYVY,width=1920,height=1080,framerate=30/1 ! videoparse format=uyvy width=1920 height=1080 framerate=30/1 ! videoconvert ! video/x-raw,format=I420,width=1920,height=1080,framerate=30/1 ! x264enc ! mp4mux ! filesink location=final.mp4

I am not getting any result in the last "Capture - Encode Usecase" command line. What am doing wrong ? Please help.
Regards, Sunny.
Reply | Threaded
Open this post in threaded view
|

Re: Capture encode usecase for CSI camera ?

ssshukla26
Sorry my bad, the x264enc is not working on my custom hardware, it worked on my Desktop without any problem. So I used avenc_flv for encoding as follows.

#Capture - Encode Usecase
-Failed
gst-launch-1.0 -e v4l2src device=/dev/video0 ! video/x-raw,format=UYVY,width=1920,height=1080,framerate=30/1 ! videoparse format=uyvy width=1920 height=1080 framerate=30/1 ! videoconvert ! video/x-raw,format=I420,width=1920,height=1080,framerate=30/1 ! x264enc ! mp4mux ! filesink location=final.mp4

-Passed (with frame rate issue)
gst-launch-1.0 -e v4l2src device=/dev/video0 ! video/x-raw,format=UYVY,width=1920,height=1080,framerate=30/1 ! videoparse format=uyvy width=1920 height=1080 framerate=30/1 ! videoconvert ! video/x-raw,format=I420,width=1920,height=1080,framerate=30/1 ! avenc_flv ! flvmux ! filesink location=final.flv

But am facing frame rate issue while using avenc_flv, i am expecting 30fps but the output file generated is running like someone is fast forwarding the video.

I didn't understand why x264enc is not working ? Is there any problem with my command line ? Please help.

Regards, Sunny.