Template:Linux-RK3399MIPICamera

From FriendlyELEC WiKi
Revision as of 01:20, 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 gst-camera.sh 使用方法

  • 预览图像
gst-camera.sh --action preview
  • 拍照

用以下命令拍照一张照片,存储为文件 1.jpg:

gst-camera.sh --action photo -output 1.jpg
  • 录像并预览

用以下命令启动边预览边录像,存储为视频文件 1.ts,录像时使用了硬件编码:

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


  • 显示完整的命令

加入 --verbose yes 的参数,会显示最终的 gsteamer 命令,例如:

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

你会得到以下完整的 gsteamer 命令,这对你开发会有帮助:

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