配置trecorderdemo
trecorderdemo要想正确运行,必须先进行配置,配置文件是recorder.cfg,它位于/etc/目录下。
修改recorder.cfg
;-------------------------------------------------------------------------------
number_of_camera = 2
screen_width = 1024
screen_height = 600
camera_id = 0
;-------------------------------------------------------------------------------
; 3 for cvbs sensor
; 2 for usb sensor
; 1 for raw sensor (need isp)
; 0 for yuv sensor
;-------------------------------------------------------------------------------
camera_type = 3
video_enable = 1
video_width = 720
video_height = 480
video_framerate = 30
video_format = YUV420SP
video_memory = MMAP
video_rotation = 0
video_use_wm = 0
video_wm_pos_x = 0
video_wm_pos_y = 0
;-------------------------------------------------------------------------------
; scale down need isp
;-------------------------------------------------------------------------------
video_scale_down_enable = 0
video_sub_width =
video_sub_height =
video_buf_num = 3
audio_enable = 0
audio_format = PCM
audio_channels = 2
audio_samplerate = 8000
audio_samplebits = 16
audio_bitrate = 128000
display_enable = 1
display_rect_x = 0
display_rect_y = 0
display_rect_width = 720
display_rect_height = 480
;-------------------------------------------------------------------------------
; 0 ZORDER_TOP
; 1 ZORDER_MIDDLE
; 2 ZORDER_BOTTOM
;-------------------------------------------------------------------------------
display_zorder = 0
;-------------------------------------------------------------------------------
; 0 ROTATION_ANGLE_0
; 1 ROTATION_ANGLE_90
; 2 ROTATION_ANGLE_180
; 3 ROTATION_ANGLE_270
;-------------------------------------------------------------------------------
display_rotation = 0
主要修改如下:
8ccee726-9ce2-4eee-8d59-f92e6e69251b-image.png
画红框的参数说明如下:
screen_width = 1024/screen_height = 600,表示显示屏的参数,比如演示时的屏幕分辨率是1024x600。
camera_id = 0,这个参数很重要。务必是0。trecorderdemo程序不是专门为tvin演示编写的,而是为主板可以接的各种camera,例如符合UVC协议的usb camera等。trecorderdemo程序中只能显示两路camera,一路是/dev/video0,另外一路是/dev/video1,在程序中分别对应的是front camera,另外一个对应的是back camera,见下图:
root@TinaLinux:/dev# trecorderdemo --help
****************************************************************************
* This program shows how to test trecorder
****************************************************************************
****************************************************************************
* trecorderdemo 0: front channel recorder test
* trecorderdemo 1: rear channel recorder test
* trecorderdemo 2: front and rear two channel recorder test
* trecorderdemo audio X: audio X recording test(X = 0/1)
***************************************************************************
root@TinaLinux:/dev# trecorderdemo --help
****************************************************************************
* This program shows how to test trecorder
****************************************************************************
****************************************************************************
* trecorderdemo 0: front channel recorder test
* trecorderdemo 1: rear channel recorder test
* trecorderdemo 2: front and rear two channel recorder test
* trecorderdemo audio X: audio X recording test(X = 0/1)
***************************************************************************
root@TinaLinux:/dev# trecorderdemo --help
****************************************************************************
* This program shows how to test trecorder
****************************************************************************
****************************************************************************
* trecorderdemo 0: front channel recorder test
* trecorderdemo 1: rear channel recorder test
* trecorderdemo 2: front and rear two channel recorder test
* trecorderdemo audio X: audio X recording test(X = 0/1)
***************************************************************************
root@TinaLinux:/dev# trecorderdemo --help
****************************************************************************
* This program shows how to test trecorder
****************************************************************************
****************************************************************************
* trecorderdemo 0: front channel recorder test
* trecorderdemo 1: rear channel recorder test
* trecorderdemo 2: front and rear two channel recorder test
* trecorderdemo audio X: audio X recording test(X = 0/1)
***************************************************************************
root@TinaLinux:/dev# trecorderdemo --help
****************************************************************************
* This program shows how to test trecorder
****************************************************************************
****************************************************************************
* trecorderdemo 0: front channel recorder test
* trecorderdemo 1: rear channel recorder test
* trecorderdemo 2: front and rear two channel recorder test
* trecorderdemo audio X: audio X recording test(X = 0/1)
列表camera_type,这个参数是确认摄像头的类型,如果是T113的TVIN接口的摄像头,选择3(cvbs sensor);如果是USB接口的摄像头,选择2(usb sensor);如果是处理器内部带了ISP了,那么一般会使用raw sensor,这个时候选择1。
列表video_width/video_height,这两个参数是明确视频的分辨率,本次测试的摄像头是NTSC格式的,那么它的分辨率是720x480。
列表video_format=YUV420SP,在用camerademo调试摄像头的时候,会给出这个参数。对应的是output_fmt=YUV420;
列表display_rect_width/display_rect_height,这两个参数表示在屏幕上显示时的视频框的大小。我们一般会设置和video_width/video_height一样。
trecorderdemo演示
演示时,务必把摄像头先接好,如果未接摄像头,程序会处于假死状态,因为无法识别到摄像头。执行trecorderdemo前,务必先执行fbinit进行清屏。具体演示步骤如下:
fbinit
trecorderdemo 0
以下截取部分执行日志信息:
root@TinaLinux:/mnt/SDCARD# ./fbinit
fbinit test version:V2.0.20220506
================Usage================
/fbinitmeans:clean /dev/fb0
/fbinit 0 means:clean /dev/fb0
/fbinit 1 means:clean /dev/fb1
/fbinit 2 means:clean /dev/fb2
================usage================
cleanning /dev/fb0 ...
clean /dev/fb0 finish
root@TinaLinux:/mnt/SDCARD# trecorderdemo 0
****************************************************************************
* This program shows how to test trecorder
****************************************************************************
▒_▒h:ii
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>tina_multimedia<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tag : tina3.5
branch: tina-dev
date : Mon Jul 15 19:04:59 2019 +0800
Change-Id: I5f6c8a88d7b387a312b7744797a0d5f8ab07ee7a
-------------------------------------------------------------------------------
[ 126.503419] [tvd] vidioc_s_fmt_vid_cap:1623
[ 126.503419] interface=0
[ 126.503419] system=NTSC
[ 126.503419] format=0
[ 126.503419] output_fmt=YUV420
[ 126.519441] [tvd] vidioc_s_fmt_vid_cap:1627
[ 126.519441] row=1
[ 126.519441] column=1
[ 126.519441] ch[0]=0
[ 126.519441] ch[1]=0
[ 126.519441] ch[2]=0
[ 126.519441] ch[3]=0
[ 126.538190] [tvd] vidioc_s_fmt_vid_cap:1629
[ 126.538190] width=720
[ 126.538190] height=480
[ 126.538190] dev->sel=0
[ 126.551055] [tvd] tvd_cagc_and_3d_config:1481 tvd0 agc auto mode
[ 126.557990] [tvd] tvd_cagc_and_3d_config:1490 tvd0 CAGC enable:0x1
[ 126.567569] [tvd] tvd_cagc_and_3d_config:1517 tvd0 3d enable :0x4f900000
[ 126.596333] [tvd] vidioc_streamon:1712 Out vidioc_streamon:0
[ 126.596367] VE: enable hw clock
[ 126.606308] enable_cedar_hw_clk,563
---------------------------------------------------------------------------------------------
| Preview Status | Preview Size | Audio Status | Water Mark | Recorder Status |
---------------------------------------------------------------------------------------------
front | enable | full | normal | disable | stop |
---------------------------------------------------------------------------------------------
rear | | | | | |
---------------------------------------------------------------------------------------------
RecorderCmd#
屏幕显示如下:
c4a45643-4534-4f6c-804c-6e29850111b1-image.png
trecorderdemo功能强大,它整合了视频预览,录制音视频等功能,目前只实现了预览功能,其他功能待验证。