前提条件
要使用 gst-launch-1.0 和 GStreamer 插件,必须在设备上安装 QIM SDK (meta-qcom-qim-product-sdk)。有关 QIM SDK 的编译和安装信息,请参见 Qualcomm Linux 编译指南。
在 SSH 终端中运行以下命令:
mount -o rw,remount /
export XDG_RUNTIME_DIR=/dev/socket/weston
export WAYLAND_DISPLAY=wayland-1
单摄像头流启动
# 开启第一个接口的摄像头,分辨率1280x720,帧率30,显示到屏幕
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 ! 'video/x-raw(memory:GBM),format=NV12,width=1280,height=720,framerate=30/1' ! waylandsink
# 开启第二个接口的摄像头,分辨率1920x1080,帧率30,全屏显示
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=1 ! 'video/x-raw(memory:GBM),format=NV12,width=1920,height=1080,framerate=30/1' ! waylandsink fullscreen=true
视频编码
-
在设备终端运行以下命令:
gst-launch-1.0 -e qtiqmmfsrc name=camsrc camera=0 ! video/x-raw(memory:GBM),format=NV12,width=1280,height=720,framerate=30/1,compression=ubwc,interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc capture-io-mode=5 output-io-mode=5 extra-controls="controls,video_bitrate=6000000,video_bitrate_mode=0;" ! h264parse ! mp4mux ! filesink location=/opt/mux_avc.mp4此命令以 720p@30 FPS 配置启动摄像头,并在 h264 视频编码后将其另存为视频文件。如果 gst pipeline 状态更改为 "PLAYING",则表示摄像头正在运行。
要停止摄像头,按 CTRL+C。
-
/opt/mux_avc.mp4 在设备上生成。通过在主机 PC 上运行以下 scp 命令,可以从设备中提取录制的内容:
$ scp -r root@[ip-addr]:/opt/mux_avc.mp4 .
视频编码和快照
-
在设备终端运行以下命令:
gst-pipeline-app -e qtiqmmfsrc name=camsrc camera=0 ! video/x-raw(memory:GBM),format=NV12,width=1280,height=720,framerate=30/1,compression=ubwc,interlace-mode=progressive,colorimetry=bt601 ! v4l2h264enc capture-io-mode=5 output-io-mode=5 extra-controls="controls,video_bitrate=6000000,video_bitrate_mode=0;" ! h264parse ! mp4mux ! filesink location=/opt/mux_avc.mp4 camsrc.image_1 ! "image/jpeg,width=1280,height=720,framerate=30/1" ! multifilesink location=/opt/frame%d.jpg async=false sync=true -
按下 Enter。此命令将打印以下菜单并等待用户输入。
##################################### MENU ##################################### ============================== Pipeline Controls ============================== (0) NULL : Set the pipeline into NULL state (1) READY : Set the pipeline into READY state (2) PAUSED : Set the pipeline into PAUSED state (3) PLAYING : Set the pipeline into PLAYING state ==================================== Other ==================================== (p) Plugin Mode : Choose a plugin which to control (q) Quit : Exit the application Choose an option: -
使用以下菜单步骤在录制视频时拍摄快照。
(1) ready -> (3) Playing -> (p)Plugin Mode : Select (8)camerasrc ->(36) capture-image -> (1): still – Snapshot ->(1) Snapshot count ('guint' value for arg1) -
若要停止摄像头,按 Enter,按 b(返回),然后按 q(退出)。录制的视频文件和快照保存在 /opt/ 中。通过在主机 PC 上运行以下 scp 命令,可以从设备中提取录制的内容:
$ scp -r root@[ip-addr]:/opt/<file name> .
双摄像头拼接显示
# 2个摄像头分辨率均为1280x720,帧率30,拼接到一起显示
gst-launch-1.0 -e qtivcomposer name=mixer sink_0::position="<0, 0>" sink_0::dimensions="<640, 360>" sink_1::position="<640, 0>" sink_1::dimensions="<640, 360>" mixer. ! queue ! waylandsink enable-last-sample=false fullscreen=true qtiqmmfsrc name=camsrc_0 camera=0 ! video/x-raw(memory:GBM), format=NV12, width=1280, height=720, framerate=30/1, compression=ubwc ! mixer. qtiqmmfsrc name=camsrc_1 camera=1 ! video/x-raw(memory:GBM), format=NV12, width=1280, height=720, framerate=30/1, compression=ubwc ! mixer.
534

被折叠的 条评论
为什么被折叠?



