videostreamer/stream.sh

35 lines
1.2 KiB
Bash
Raw Normal View History

2024-06-24 04:45:43 +03:00
#!/bin/bash
echo "Press CTRL+C to exit"
source config
2025-01-13 03:32:13 +02:00
LOGLEVEL="debug"
LOGLEVEL="repeat+level+info"
2024-06-24 04:45:43 +03:00
while :
do
CURRENTDATE=`date +"%Y-%m-%d %T"`
echo Start at ${CURRENTDATE}
#calf plugins
#input_audio_filter="-af lv2=p=http\\\\://calf.sourceforge.net/plugins/Gate:c=threshold=0.04010706|knee=8|range=0.03148599, lv2=http\\\\://calf.sourceforge.net/plugins/Compressor:c=knee=8|threshold=0.125, lv2=http\\\\://calf.sourceforge.net/plugins/Limiter:c=level_out=0.71697748|limit=0.62763602"
#load normalization
#output_audio_filter="-filter:a loudnorm"
2025-01-13 03:28:43 +02:00
2025-01-13 03:32:13 +02:00
ffmpeg -hide_banner -loglevel ${LOGLEVEL} -threads:v 2 -threads:a 8 -filter_threads 2 \
-thread_queue_size 512 -f v4l2 -framerate 30 -pix_fmt yuv420p -i /dev/video7 \
2025-01-13 03:28:43 +02:00
-thread_queue_size 512 -f alsa -ac 2 -i plughw:CARD=USB ${input_audio_filter} \
-bsf:a aac_adtstoasc -c:a aac -ac 2 -b:a 192k ${output_audio_filter} \
2025-01-13 03:32:13 +02:00
-init_hw_device vaapi=va:/dev/dri/renderD128 -filter_hw_device va \
2025-01-13 03:28:43 +02:00
-vf 'format=nv12,hwupload' \
-c:v h264_vaapi -b:v 6000k -minrate:v 6000k -maxrate:v 6000k -bufsize:v 6000k \
-r:v 30 -g:v 120 -bf:v 3 -refs:v 16 \
2025-01-13 03:28:43 +02:00
-f mpegts ${srt_output}
2024-06-24 04:45:43 +03:00
CURRENTDATE=`date +"%Y-%m-%d %T"`
echo End at ${CURRENTDATE}
sleep 5
done