videostreamer/stream.sh

34 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
echo "Press CTRL+C to exit"
source config
LOGLEVEL="debug"
LOGLEVEL="repeat+level+info"
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"
ffmpeg -hide_banner -loglevel ${LOGLEVEL} -threads:v 2 -threads:a 8 -filter_threads 2 \
-thread_queue_size 512 -f v4l2 -s 1920x1080 -framerate 60 -pix_fmt yuv420p -i /dev/video7 \
-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 128k ${output_audio_filter} \
-init_hw_device vaapi=va:/dev/dri/renderD128 -filter_hw_device va \
-vf 'format=nv12,hwupload' \
-c:v h264_vaapi -b:v 6000k -minrate:v 6000k -maxrate:v 6000k -bufsize:v 6000k \
-r:v 60 -g:v 120 -bf:v 3 -refs:v 16 \
-f mpegts ${srt_output}
CURRENTDATE=`date +"%Y-%m-%d %T"`
echo End at ${CURRENTDATE}
sleep 5
done