Template:Linux-RK3399MIPICamera

From FriendlyELEC WiKi
Revision as of 01:28, 16 November 2018 by Yftan (Talk | contribs) (Work with MIPI Camera OV13850 Under Linux)

Jump to: navigation, search

1 Work with MIPI Camera OV13850 Under Linux

Hardware Setting: The present Linux kernel only supports MIPI-CSI1 so a camera module can only be connected to a MIPI-CSI1 port and here is the hardware setting:


FriendlyELEC provides a test script "gst-camera.sh" to test a camera's functions. You can run it in a commandline to test picture taking and video recording. You can install the script by running the following command:

sudo wget http://112.124.9.243:8888/rk3399/gst-camera.sh -O `which gst-camera.sh`

1.1 Options in "gst-camera.sh"

Options Comment
--index or -i Camera's index, it can be either 0 or 1. When two cameras are connected to a board you need to specify 1 to access the second camera.
--mode or -m Camera's resolution. For example if a camera's resolution is 720P 30FPS you can set width=1280, height=720 and framerate=30/1
--action or -a Specify an action, it can be "preview" to preview, "photo" to take a picture or "video" to record video
--output or -o Specify an output file to save a picture when taking a picture or video file when recording video
--verbose or -v If it is specified as "yes" it will output the complete command when "gst-launch-1.0" is called

1.2 Usage of gst-camera.sh

  • Preview
gst-camera.sh --action preview
  • Picture Taking

You can run the following command to take a picture and save it as a "1.jpg" file,

gst-camera.sh --action photo -output 1.jpg
  • Preview and Record

You can run the following command to preview and record video and save your video to a "1.ts" file. Hardware encoding is activated when it is recording video.

gst-camera.sh --action video -output 1.ts


  • Show Complete Command

If you add the "--verbose yes" option it will show a complete gsteamer command.

gst-camera.sh --action video --output 1.ts --verbose yes

Here is the complete gsteamer command you will see:

gst-launch-1.0 rkisp num-buffers=512 io-mode=4 path-iqf=/etc/cam_iq/ov13850.xml \
    ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 \
    ! tee name=t t. ! queue ! kmssink t. ! queue ! mpph264enc \
    ! queue ! h264parse ! mpegtsmux ! filesink location=1.ts