add audio support, trying to manage MSD device

This commit is contained in:
Artem
2024-11-03 11:44:40 +01:00
parent 68ba48a3a2
commit 1b60f43df1
22 changed files with 1059 additions and 263 deletions

View File

@@ -13,6 +13,18 @@ import (
// vp8
//ffmpeg -re -i /dev/video0 -c:v libvpx -crf 10 -b:v 3M -deadline 1 -g 10 -error-resilient 1 -auto-alt-ref 1 -an -f rtp rtp://127.0.0.1:5004?pkt_size=1200
/*
arecord -D hw:0,0 -f cd -r 44100 -c 2 | /app/ffmpeg -re -init_hw_device rkmpp=hw -filter_hw_device hw \
-f wav -thread_queue_size 4096 -i pipe:0 -f v4l2 -i /dev/video0 \
-vf hwupload,scale_rkrga=h=720:force_original_aspect_ratio=1 \
-c:v h264_rkmpp -flags +low_delay -b:v 6000000 -framerate 60 -g 10 \
-map 0:a -c:a aac -b:a 128k -ar 44100 -ac 2 -f rtp rtp://127.0.0.1:5006?pkt_size=1200 \
-map 1:v -f rtp rtp://127.0.0.1:5004?pkt_size=1200
arecord -D hw:0,0 -f cd -r 44100 -c 2 | /app/ffmpeg -re -f wav -i pipe:0 -c:a aac -b:a 128k -ar 44100 -ac 2 -f rtp rtp://127.0.0.1:5006?pkt_size=1200
*/
// https://jsfiddle.net/z7ms3u5r/
var ffmpeg *FFmpeg
@@ -40,10 +52,28 @@ func (f *FFmpeg) SetFPS(fps int) {
f.ChangeArgs(f.FormatArgs())
}
func (f *FFmpeg) SetResolution(height int) {
f.Height = height
if f.Height <= 0 {
f.Height = 1080
}
f.ChangeArgs(f.FormatArgs())
}
func (f *FFmpeg) SetGOP(gop int) {
f.GOP = gop
if f.GOP < 0 {
f.GOP = 0
}
f.ChangeArgs(f.FormatArgs())
}
func InitFFmpeg(path string, args []string) *FFmpeg {
ffmpeg = &FFmpeg{
ExtProcess: Init(path, args),
FFmpeg: config.Get().FFmpeg,
FFmpeg: config.Get().Video,
}
return ffmpeg
}