张春 发表于 2025-1-9 21:38:43

buildroot ffmpeg 及 PJSIP安装使用详解


[*]硬件: rk3568平台, 体系: buildroot, 交织编译pjsip,并介绍pjsip录放音常用测试验证命令, 以及ffmpeg音视频频收罗命令。
buildroot pjsip安装

编译

./configure CC=/home/ney/test/sdk419/RK356x/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-gcc CXX=/home/ney/test/sdk419/RK356x/buildroot/output/rockchip_rk3568/host/bin/aarch64-buildroot-linux-gnu-g++--host=arm-linux-gnueabihf--enable-static --prefix=/home/ney/tool/pjproject-2.13.1/tmp --disable-libwebrtc --disable-libyuv--disable-ssl

make dep && make
#链接失败Relocations in generic ELF (EM: 62)
#原因一: 是同一目录编译过x86版本,没有clean干净
#原因二: configure 参数中未配置CXX,部分程序是用CXX编译的。
make clean
rm -rf /pjsip-apps/build/output/ ./pjmedia/build/output/ ./pjlib-util/build/output/ ./pjnath/build/output/ ./pjnath/build/output ./pjlib/build/output


./pjsua-arm-unknown-linux-gnueabihf --capture-dev=0 --playback-dev=0

声卡验证

#放音验证,确认pjsua使用了正常的声卡
./pjsua --play-file file.wav

#指定 录音及放音设备
./pjsua-arm-unknown-linux-gnueabihf --playback-dev=0 --capture-dev=0 --log-level=5 --play-file file.wav



##使用pjsip提供的工具录音, 其使用的是pulse接口库。【 PulseAudio Sound Server】
oot@RK356X:~/pjsip-bin/samples/arm-unknown-linux-gnueabihf# ./recfile file.wav
01:36:50.744         os_core_unix.c !pjlib 2.13.1 for POSIX initialized
01:36:50.794             alsa_dev.cAdded sound device pulse
01:36:50.801             alsa_dev.cAdded sound device default
01:36:50.808             alsa_dev.cAdded sound device sysdefault:CARD=rockchiprk809co
01:36:50.809             alsa_dev.cAdded sound device sysdefault:CARD=ROCKCHIPSPDIF
01:36:50.811             alsa_dev.cAdded sound device sysdefault:CARD=rockchiphdmi
01:36:50.824             alsa_dev.cALSA driver found 5 devices
01:36:50.824             alsa_dev.cALSA initialized
01:36:50.824                  pjlibselect() I/O Queue created (0x33397108)
01:36:50.828         wav_writer.cFile writer 'file.wav' created: samp.rate=44100, bufsize=4KB
01:36:50.828             alsa_dev.copen_capture: Open capture device 'pulse'
01:36:50.837             alsa_dev.cOpened device alsa(pulse) for capture, sample rate=44100, ch=2, bits=16, period size=441 frames, latency=100 ms
01:36:50.838             alsa_dev.c !ca_thread_func(12982): Set thread priority for audio capture thread.
Recodring file.wav..
buildroot ffmpeg常用命令

#使用命令方式采集视频: 指的是从屏幕的左上角(x=100, y=200)的位置,录制分辨率为1024×768的视频
ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 v-out.mp4

#可以使用ALSA同时录制声音
ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 -f alsa -ac 2 -i hw:0 av-out.mkv

#采用命令录制摄像头采集的视频:
ffmpeg -f video4linux2 -s 320*240 -r 10 -i /dev/video9 test.asf
ffmpeg -f video4linux2 -i "/dev/video9" -vcodec libx264 -pix_fmt yuv420p mycamera.h264
ffmpeg -f video4linux2 -s 320*240 -r 10 -i /dev/video9 test.asf -pix_fmt yuv420p

ffmpeg -f video4linux2 -s 320*240 -r 10 -i /dev/video9 test.asf

root@RK356X:/# ffmpeg -f video4linux2 -s 320*240 -r 10 -i /dev/video9 test.asf

Input #0, video4linux2,v4l2, from '/dev/video9':
Duration: N/A, start: 154.045546, bitrate: 3686 kb/s
    Stream #0:0: Video: rawvideo (NV12 / 0x3231564E), nv12, 640x480, 3686 kb/s, 1 fps, 1 tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> msmpeg4v3 (msmpeg4))
Press to stop, [?] for help



arecord & aplay 声卡调测命令

开发板接USB音箱


arecord -D "plughw:3,0" -f S16_LE -r 44100 -d 5 -t wav file.wav
aplay -D "plughw:3,0"file.wav
开发板自带音箱



#开发板自带音箱
arecord -D "plughw:0,0" -f S16_LE -r 44100 -d 5 -t wav file.wav
aplay -D "plughw:0,0"file.wav
aplay -Dplughw:CARD=0 file.wav

##
root@RK356X:~/pjsip-bin/samples/arm-unknown-linux-gnueabihf# aplay -l   
**** List of PLAYBACK Hardware Devices ****
card 0: rockchiprk809co , device 0: fe410000.i2s-rk817-hifi rk817-hifi-0
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: ROCKCHIPSPDIF , device 0: fe460000.spdif-dit-hifi dit-hifi-0
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: rockchiphdmi , device 0: rockchip,hdmi i2s-hifi-0
Subdevices: 1/1
Subdevice #0: subdevice #0
root@RK356X:~/pjsip-bin/samples/arm-unknown-linux-gnueabihf# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
default
    Default ALSA Output (currently PulseAudio Sound Server)
sysdefault:CARD=rockchiprk809co
    rockchip,rk809-codec, fe410000.i2s-rk817-hifi rk817-hifi-0
    Default Audio Device
sysdefault:CARD=ROCKCHIPSPDIF
    ROCKCHIP,SPDIF, fe460000.spdif-dit-hifi dit-hifi-0
    Default Audio Device
sysdefault:CARD=rockchiphdmi
    rockchip,hdmi, rockchip,hdmi i2s-hifi-0
    Default Audio Device

#指定 设备播放音频
root@RK356X:~/pjsip-bin/samples/arm-unknown-linux-gnueabihf# aplay -Dplughw:CARD=rockchiprk809co ../../file.wav
Playing WAVE '../../file.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: buildroot ffmpeg 及 PJSIP安装使用详解