project structure refactoring

This commit is contained in:
Artem
2024-11-05 23:47:00 +01:00
parent 1f5a56cc5d
commit c228921237
16 changed files with 51 additions and 47 deletions

View File

@@ -14,7 +14,6 @@ type Config struct {
Port int `yaml:"port"`
UStreamer UStreamer `yaml:"ustreamer"`
Video FFmpeg `yaml:"video"`
Audio []string `yaml:"audio"`
WebRtc WebRtc `yaml:"webrtc"`
Stream Stream `yaml:"stream"`
@@ -23,8 +22,9 @@ type Config struct {
}
type WebRtc struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
Host string `yaml:"host"`
VideoPort int `yaml:"video_port"`
AudioPort int `yaml:"audio_port"`
}
type ExtProcess struct {
@@ -34,6 +34,7 @@ type ExtProcess struct {
type Stream struct {
Source string `yaml:"source"` // mjpeg or h264
}
const (
@@ -89,12 +90,12 @@ func Init() {
},
Video: FFmpeg{
Commands: map[StreamInput]string{
StreamInputVideoAudio: "/usr/bin/arecord -D hw:0,0 -f dat -r 48000 -c 2 --buffer-size=150 | /app/ffmpeg -init_hw_device rkmpp=hw -filter_hw_device hw" +
StreamInputVideoAudio: "/usr/bin/arecord -D hw:0,0 -f dat -r 48000 -c 2 --buffer-size=150 | /app/ffmpeg -re -init_hw_device rkmpp=hw -filter_hw_device hw" +
" -f wav -i pipe:0 -map 0:a -c:a libopus -b:a 48000 -sample_fmt s16 -ssrc 1 -payload_type 111 -f rtp -max_delay 0 -application lowdelay" +
" -f rtp rtp://127.0.0.1:5006?pkt_size=1200" +
" -i /dev/video0 -map 1:v -vf hwupload,scale_rkrga=h=%d:force_original_aspect_ratio=1 -c:v %s_rkmpp -flags +low_delay -b:v %d -framerate %d -g %d" +
" -f rtp rtp://127.0.0.1:5004?pkt_size=1200",
StreamInputVideo: "/app/ffmpeg -hide_banner -loglevel error -init_hw_device rkmpp=hw -filter_hw_device hw" +
StreamInputVideo: "/app/ffmpeg -re -hide_banner -loglevel error -init_hw_device rkmpp=hw -filter_hw_device hw" +
" -i /dev/video0 -vf hwupload,scale_rkrga=h=%d:force_original_aspect_ratio=1 -c:v %s_rkmpp -flags +low_delay -b:v %d -framerate %d -g %d" +
" -f rtp rtp://127.0.0.1:5004?pkt_size=1200",
},
@@ -102,11 +103,12 @@ func Init() {
Bitrate: 6000,
Height: 720,
GOP: 5,
Codec: "h264",
Codec: StreamSourceH264,
},
WebRtc: WebRtc{
Host: "127.0.0.1",
Port: 5004,
Host: "127.0.0.1",
VideoPort: 5004,
AudioPort: 5006,
},
Stream: Stream{
Source: StreamSourceH264,