Difference between revisions of "Template:Linux-RK3399MIPICamera"

From FriendlyELEC WiKi
Jump to: navigation, search
(Linux下使用MIPI摄像头OV13850)
(Work with MIPI Camera OV13850 Under Linux)
Line 21: Line 21:
 
sudo wget http://112.124.9.243:8888/rk3399/gst-camera.sh -O `which gst-camera.sh`
 
sudo wget http://112.124.9.243:8888/rk3399/gst-camera.sh -O `which gst-camera.sh`
 
</syntaxhighlight>
 
</syntaxhighlight>
====gst-camera.sh 参数说明====
+
====Options in "gst-camera.sh"====
 
::{| class="wikitable"
 
::{| class="wikitable"
 
|-
 
|-
|参数 || 功能
+
|Options || Comment
 
|-
 
|-
|  --index或-i || 选择要使用的摄像头的序号,可选值为0和1,当同时连接两个摄像头时,指定为1表示要操作第二个摄像头
+
|  --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或-m || 指定摄像头的分辨率,比如720P 30FPS 则使用参数为 width=1280,height=720,framerate=30/1
+
|  --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或-a || 指定命令要执行的动作,可选参数为: preview、photo和video,分别对应预览、拍照和录像
+
|  --action or -a || Specify an action, it can be "preview" to preview, "photo" to take a picture or "video" to record video
 
|-
 
|-
|  --output或-o || 指定输出的文件名,用于拍照和录像时指定输出文件名
+
|  --output or -o || Specify an output file to save a picture when taking a picture or video file when recording video
 
|-
 
|-
|  --verbose或-v || 指定为yes时,会输出调用gst-launch-1.0命令的完整命令行
+
|  --verbose or -v || If it is specified as "yes" it will output the complete command when "gst-launch-1.0" is called
 
|}
 
|}
  

Revision as of 01:20, 16 November 2018

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