While working with one of our i.MX53 customers on a video streaming application, we had reason to test the camera interface, video encoding, and streaming on i.MX6. Our customer brought us a couple of command lines that worked well on his laptop:
Laptop server command-lineOn the server side, the pipeline reads from the camera (v4l2src), uses jpegenc and then routes it to a TCP server on port 5000:
~/$ gst-launch v4l2src device=/dev/video0 \ ! videoscale \ ! video/x-raw-yuv,width=640,height=480 \ ! ffmpegcolorspace \ ! jpegenc \ ! tcpserversink host=127.0.0.1 port=5000
Laptop client command-lineOn the client side, the tcpclientsrc reads from the network port, decodes using jpegdec and sends the output to the display (autovideosink):
~/$ gst-launch tcpclientsrc host=127.0.0.1 port=5000 ! jpegdec ! autovideosinkI just finished participating in a training session by Timesys for distributor FAEs, where they gave a primer on gstreamer and its’ use on SABRE Lite.
Amply armed, I was able to take this information and translate it into a fully accelerated pipeline on the SABRE Lite:
i.MX6 server command-line
# gst-launch mfw_v4lsrc capture-width=1280 capture-height=720 capture-mode=4 \ ! vpuenc codec=12 \ ! tcpserversink host=127.0.0.1 port=5000Note the use of the two Freescale-provided elements:
- mfw_v4lsrc – Video For Linux source provided by Freescale for camera input, and
- vpuenc – Freescale-provided VPU-accelerated encoder
To examine the parameters for gstreamer elements, use the gst-inspect utility:
# gst-inspect mfw_v4lsrc MFW_GST_V4LSRC_PLUGIN 2.0.8 build on Aug 15 2012 14:09:19. Factory Details: Long name: v4l2 based camera src Class: Src/Video Description: Capture videos by using csi camera Author(s): Multimedia Team Rank: primary (256) Plugin Details: Name: v4lsrc.imx Description: v4l2-based csi camera video src Filename: /usr/lib/gstreamer-0.10/libmfw_gst_v4lsrc.so Version: 2.0.8 License: LGPL Source module: gst-fsl-plugins Binary package: Freescle Gstreamer Multimedia Plugins Origin URL: http://www.freescale.com ... Element Properties: ... capture-mode : set the capture mode of camera, please check the bsp release notes to decide which value can be applied, for example ov5460: ov5640_mode_VGA_640_480 = 0, ov5640_mode_QVGA_320_240 = 1, ov5640_mode_NTSC_720_480 = 2, ov5640_mode_PAL_720_576 = 3, ov5640_mode_720P_1280_720 = 4, ov5640_mode_1080P_1920_1080 = 5I hope this miniature example helps kick-start your efforts to build real-world applications using i.MX6 and gstreamer. Contact us, or your local distributor FAE, or Timesys for details of how you can see this in action.