Difference between revisions of "Template:Linux-RK3399MIPICamera"

From FriendlyARM WiKi
Jump to: navigation, search
(Work with MIPI Camera OV13850 Under Linux)
(Work with MIPI Camera OV13850 Under Linux)
Line 37: Line 37:
 
|}
 
|}
  
====gst-camera.sh 使用方法====
+
====Usage of gst-camera.sh====
* '''预览图像'''
+
* '''Preview'''
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
gst-camera.sh --action preview
 
gst-camera.sh --action preview
 
</syntaxhighlight>
 
</syntaxhighlight>
* '''拍照'''
+
* '''Picture Taking'''
用以下命令拍照一张照片,存储为文件 1.jpg:
+
You can run the following command to take a picture and save it as a "1.jpg" file,
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
gst-camera.sh --action photo -output 1.jpg
 
gst-camera.sh --action photo -output 1.jpg
 
</syntaxhighlight>
 
</syntaxhighlight>
* '''录像并预览'''
+
* '''Preview and Record'''
用以下命令启动边预览边录像,存储为视频文件 1.ts,录像时使用了硬件编码:
+
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.
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
gst-camera.sh --action video -output 1.ts
 
gst-camera.sh --action video -output 1.ts
 
</syntaxhighlight>
 
</syntaxhighlight>
 
<br />
 
<br />
* '''显示完整的命令'''
+
* '''Show Complete Command'''
加入 --verbose yes 的参数,会显示最终的 gsteamer 命令,例如:
+
If you add the "--verbose yes" option it will show a complete gsteamer command.
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
gst-camera.sh --action video --output 1.ts --verbose yes
 
gst-camera.sh --action video --output 1.ts --verbose yes
 
</syntaxhighlight>
 
</syntaxhighlight>
你会得到以下完整的 gsteamer 命令,这对你开发会有帮助:
+
Here is the complete gsteamer command you will see:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
gst-launch-1.0 rkisp num-buffers=512 io-mode=4 path-iqf=/etc/cam_iq/ov13850.xml \
 
gst-launch-1.0 rkisp num-buffers=512 io-mode=4 path-iqf=/etc/cam_iq/ov13850.xml \

Revision as of 01:28, 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 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