MaixSense R329板开箱 - 音频视频测试
作者:互联网
MaixSense 开发板是Sipeed公司基于全志 R329-N4 打造的堪称最小Linux 卡片电脑, 整个套件加上3D打印的外壳,尺寸大约35mm x 55mm。
全志 R329-N4芯片,含有双核 ARM Cortex™-A53@1.5GHz(ARM v8 架构),搭载周易TZ1AIPU(最大支持0.25TOPS@600MHz),芯片内集成两颗HIFI4 DSP@400MHz(32KB L1 I-cache + 32KB L1 D-cache per core,2MB SRAM),可以做音频的预处理和后处理,片上集成SIP 256MB DDR3,减少BOM成本,便于PCB制板。
套件包含一个搭载的高度集成 SOM 核心板,以及一个多功能 IO 扩展底板,可以运行 Linux 系统, 并具备出色的扩展功能,套件包含两个模拟MEMS麦克风(平均灵敏度91dB SPL@1kHz),一个小喇叭,一个摄像头(出厂默认OV9732,最高支持720P@30fps HD,采用USB-C连接器,支持正反插,可分别用作前后摄),1.5寸SPI总线屏幕(接口采用0.5mm 12P FPC,分辨率240*240)。
可以将它用于搭建个人服务器、开发智能语音助手、设计机器人等场景。它通过内置的周易 AIPU 处理器同时支持智能语音和视频图像处理,开发者可以直接在开发板上跑通相关 CV , NLP 等 AI 模型。
1. 烧录配置系统
按照 MaixSense 简介 - Sipeed Wiki 步骤,在Windows 10下,使用Etcher,烧录armbian 系统。
插入烧录好的SD卡,连接USB串口线,作为电源和串口连接。打开串口终端,进行连接:
使用 nmtui 指令,进入可视化的WIFI配置界面, 选择自己的 SSID ,输入连接密码,确认即可。
使用 ifconfig 指令,查看本机的网络参数。
当WIFI配置好后,可以通过WIFI进行新的 PuTTY 连接,速度更快。
使用 armbian-config 指令,设置armbian 的国内 APT源。
选中Personal,选择Mirrors,找到国内的apt源,选清华大学的镜像。
安装Neofetch,
apt install neofetch
运行Neofetch,查看系统基本信息。
使用SFTP在上位机和开发板之间传递文件。
2. 测试摄像头和屏幕
固件里带有ffmpeg,可以采用该命令从摄像头采集100帧视频,并在屏幕上显示:
ffmpeg -i /dev/video0 -vframes 100 -s 240*240 -pix_fmt rgb565le -vf transpose=2,transpose=2 -f fbdev /dev/fb0
屏幕上显示摄像头采集的视频,说明这两个设备工作正常。PuTTY终端显示如下:
root@maixsense:~# ffmpeg -i /dev/video0 -vframes 10 -s 240*240 -pix_fmt rgb565le -vf transpose=2,transpose=2 -f fbdev /dev/fb0
ffmpeg version 4.3.2-0+deb11u2 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr --extra-version=0+deb11u2 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --arch=arm64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 2774.270943, bitrate: 147456 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 147456 kb/s, 10 fps, 10 tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[swscaler @ 0xaaaadac902f0] full chroma interpolation for destination format 'rgb565le' not yet implemented
Output #0, fbdev, to '/dev/fb0':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: rawvideo (RGB[16] / 0x10424752), rgb565le, 240x240, q=2-31, 9216 kb/s, 10 fps, 10 tbn, 10 tbc
Metadata:
encoder : Lavc58.91.100 rawvideo
frame= 10 fps=7.2 q=-0.0 Lsize=N/A time=00:00:01.70 bitrate=N/A speed=1.23x
video:1125kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
root@maixsense:~#
3. 测试麦克风和喇叭
使用 arecord 和 aplay 录制和播放音频。
#使用麦克风录音
arecord test.wav
#使用喇叭播放录音
aplay test.wav
#录制48KHz采样音频
arecord -f dat test48.wav
缺省情况下,录音和播放的声音都很小,需要通过 alsamixer 调整音量。
查看arecord的使用帮助,
root@maixsense:~# arecord
Usage: arecord [OPTION]... [FILE]...
-h, --help help
--version print current version
-l, --list-devices list all soundcards and digital audio devices
-L, --list-pcms list device names
-D, --device=NAME select PCM by name
-q, --quiet quiet mode
-t, --file-type TYPE file type (voc, wav, raw or au)
-c, --channels=# channels
-f, --format=FORMAT sample format (case insensitive)
-r, --rate=# sample rate
-d, --duration=# interrupt after # seconds
-s, --samples=# interrupt after # samples per channel
-M, --mmap mmap stream
-N, --nonblock nonblocking mode
-F, --period-time=# distance between interrupts is # microseconds
-B, --buffer-time=# buffer duration is # microseconds
--period-size=# distance between interrupts is # frames
--buffer-size=# buffer duration is # frames
-A, --avail-min=# min available space for wakeup is # microseconds
-R, --start-delay=# delay for automatic PCM start is # microseconds
(relative to buffer size if <= 0)
-T, --stop-delay=# delay for automatic PCM stop is # microseconds from xrun
-v, --verbose show PCM structure and setup (accumulative)
-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)
-I, --separate-channels one file for each channel
-i, --interactive allow interactive operation from stdin
-m, --chmap=ch1,ch2,.. Give the channel map to override or follow
--disable-resample disable automatic rate resample
--disable-channels disable automatic channel conversions
--disable-format disable automatic format conversions
--disable-softvol disable software volume control (softvol)
--test-position test ring buffer position
--test-coef=# test coefficient for ring buffer position (default 8)
expression for validation is: coef * (buffer_size / 2)
--test-nowait do not wait for ring buffer - eats whole CPU
--max-file-time=# start another output file when the old file has recorded
for this many seconds
--process-id-file write the process ID here
--use-strftime apply the strftime facility to the output file name
--dump-hw-params dump hw_params of the device
--fatal-errors treat all errors as fatal
Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE IEC958_SUBFRAME_LE IEC958_SUBFRAME_BE MU_LAW A_LAW IMA_ADPCM MPEG GSM S20_LE S20_BE U20_LE U20_BE SPECIAL S24_3LE S24_3BE U24_3LE U24_3BE S20_3LE S20_3BE U20_3LE U20_3BE S18_3LE S18_3BE U18_3LE U18_3BE G723_24 G723_24_1B G723_40 G723_40_1B DSD_U8 DSD_U16_LE DSD_U32_LE DSD_U16_BE DSD_U32_BE
Some of these may not be available on selected hardware
The available format shortcuts are:
-f cd (16 bit little endian, 44100, stereo)
-f cdr (16 bit big endian, 44100, stereo)
-f dat (16 bit little endian, 48000, stereo)
4. mplayer播放音视频
mplayer 可以播放 MP3 和 MP4 格式的文件。
固件里没有mplayer,需要自己安装:
root@maixsense:~# apt install mplayer
root@maixsense:~# mplayer gsls.mp3
MPlayer 1.4 (Debian), built with gcc-10 (C) 2000-2019 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing gsls.mp3.
libavformat version 58.45.100 (external)
Audio only file format detected.
Load subtitles in ./
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 44100 Hz, 2 ch, s16le, 64.0 kbit/4.54% (ratio: 8000->176400)
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
AO: [alsa] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A: 152.1 (02:32.1) of 152.0 (02:32.0) 0.8%
Exiting... (End of file)
播放MP3文件正常。
播放MP4报错,回头有空再查查是什么原因。
root@maixsense:~# mplayer record2.mp4
MPlayer 1.4 (Debian), built with gcc-10 (C) 2000-2019 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing record2.mp4.
libavformat version 58.45.100 (external)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xffffac1f8020]moov atom not found
LAVF_header: av_open_input_stream() failed
Exiting... (End of file)
5. 小结
这款板子采用全志的R329芯片,主打音频处理,SIP的DDR3只有256MB,做音频应该够用;做小尺寸的视频处理还行,想做大尺寸、复杂算法,估计就有些捉襟见肘了。
试了一下,板子的麦克风录音效果还好,噪音比较小,录音最大采样率支持到48KHz;喇叭的效果就很一般了,用来做做算法就得了,就不要追求享受了,想要享受的话,可以试试 Xiaomi Sound智能音箱,用的是同一款芯片,据说效果很好。
老徐 2021/9/26
标签:10,enable,MaixSense,--,R329,disable,音频视频,LE,file 来源: https://blog.csdn.net/weixin_43978579/article/details/120415402