libcamera_mon 开源代码之树莓派3B+ Bookworm部署
1. 源由
为了利用手头的树莓派硬件,同时,搭建一个Rover FPV验证平台。
前期,在《msposd 开源代码之树莓派3B+ Bookworm部署》中已经基本完成。
但是,无法显示fps/bitrate数据,初步讨论结果:
2. 分析
经过简单的初步分析,我们了解到libcamera-vid
打印日志中,含有或者间接含有相关数据。
例如:
- 帧 #34
- FPS 29.99 Hz
- 数据量 21008 Bytes
计算公式:
B i t r a t e ( b p s ) = ( Sum of buffer sizes (bytes) × 8 ) × fps Bitrate (bps) = ( \text{Sum of buffer sizes (bytes)} \times 8 ) \times \text{fps} Bitrate(bps)=(Sum of buffer sizes (bytes)×8)×fps
B i t r a t e ( b p s ) = ( 21008 (bytes) × 8 ) × 29.99 = 5 , 040 , 239.36 b p s = 5.04 M b p s Bitrate (bps) = ( \text{21008 (bytes)} \times 8 ) \times \text{29.99} = 5,040,239.36 bps = 5.04Mbps Bitrate(bps)=(21008 (bytes)×8)×29.99=5,040,239.36bps=5.04Mbps
Viewfinder frame 34
#34 (29.99 fps) exp 33216.00 ag 8.00 dg 1.00
FileOutput: output buffer 0x7f9d73a000 size 21008
3. 部署
3.1 下载
$ git clone https://github.com/SnapDragonfly/libcamera_mon.git
3.2 编译
$ cd libcamera_mon
$ make
$ tree ./build/
./build/
├── libcamera_mon
├── libcamera_proc.ko
├── libcamera_proc.mod
├── libcamera_proc.mod.c
├── libcamera_proc.mod.o
├── libcamera_proc.o
├── modules.order
└── Module.symvers
1 directory, 8 files
3.3 安装
$ sudo cp ./build/libcamera_mon /usr/local/bin/fpvdrone/
$ sudo cp ./build/libcamera_proc.ko /usr/local/bin/fpvdrone/
$ tree /usr/local/bin/fpvdrone/
/usr/local/bin/fpvdrone/
├── font_ardu_hd.png
├── font_ardu.png
├── font_btfl_hd.png
├── font_btfl.png
├── font_inav_hd.png
├── font_inav.png
├── fpv-drone.sh
├── fpv-update.sh
├── libcamera_mon
├── libcamera_proc.ko
└── msposd
1 directory, 11 files
3.4 配置
$ sudo n