This commit is contained in:
douzeb 2023-03-08 05:30:17 +01:00
parent b132c922f2
commit 206a7c3593

View file

@ -41,55 +41,57 @@ echo Will stream to $URL
echo and save a copy of the data file : echo and save a copy of the data file :
echo $FILENAME echo $FILENAME
# A la ligne xx, utiliser cette ligne pour avoir un son de test généré par ffmpeg : # A la ligne xx, utiliser ces lignes pour avoir un son de test généré par ffmpeg :
# -f lavfi -i aevalsrc="(1-min(1\,mod(floor(5*t)\,50)))*0.1*sin(8*PI*(360-2.5/2)*t)+0.1*sin(2*PI*(360-2.5/2)*t)|(1-min(1\,mod(floor(5*t)\,50)))*0.1*sin(8*PI*(360+2.5/2)*t)+0.1*sin(2*PI*(360+2.5/2)*t):sample_rate=48000" \ # -f lavfi -i aevalsrc="(1-min(1\,mod(floor(5*t)\,50)))*0.1*sin(8*PI*(360-2.5/2)*t)+0.1*sin(2*PI*(360-2.5/2)*t)|(1-min(1\,mod(floor(5*t)\,50)))*0.1*sin(8*PI*(360+2.5/2)*t)+0.1*sin(2*PI*(360+2.5/2)*t):sample_rate=48000" \
# -ar 48000 \
# -channel_layout stereo \
# -c:a aac -b:a ${ABITRATE}k \
# A la ligne xx, utiliser cette ligne pour avoir le son de la caméra : # A la ligne xx, utiliser ces lignes pour avoir le son de la caméra :
#-f alsa -ac 2 -i hw:CARD=CAMERA,DEV=${V4LDEVICE} \ # -f alsa -ac 2 -i hw:CARD=CAMERA,DEV=${V4LDEVICE} \
# -c:a copy \
# A la ligne xx, utiliser cette ligne pour avoir le son d'une web radio :
#-f ogg -ac 2 -i http://91.121.159.124:8000/eko-des-garrigues-96k.ogg \
# A la ligne xx, utiliser ces lignes pour avoir le son d'une web radio :
# -f aac -ac 2 -i http://91.121.159.124:8000/eko-des-garrigues-48k.aac \
# -c:a copy \
ffmpeg \ ffmpeg \
-loglevel level \ -loglevel level \
-y \ -y \
-f v4l2 -framerate 30 -video_size ${REPLAY_RESOLUTION} -input_format mjpeg -i /dev/video${V4LDEVICE} \ -f v4l2 -framerate 30 -video_size ${REPLAY_RESOLUTION} -input_format mjpeg -i /dev/video${V4LDEVICE} \
-f ogg -ac 2 -i http://91.121.159.124:8000/eko-des-garrigues-96k.ogg \ -f aac -ac 2 -i http://91.121.159.124:8000/eko-des-garrigues-48k.aac \
-channel_layout stereo \ -c:a copy \
-ar 48000 \ -filter_complex "[0:v]drawtext='font=DejaVuSansMono:text=%{pts}: fontcolor=white: fontsize=h/24: box=1: boxcolor=black@0.43: boxborderw=5: x=mod(floor(t/10+1)\,2)*mod(t*(w-text_w)/10\,w-text_w)+mod(floor(t/10)\,2)*(w-text_w-mod(t*(w-text_w)/10\,w-text_w)): y=text_h/2', drawtext='font=DejaVuSansMono:text=%{localtime}: fontcolor=white: fontsize=h/20: box=1: boxcolor=black@0.43: boxborderw=5: x=text_h: y=h-3*text_h/2', split=2[out1][out2]" \
-filter_complex "[1:a]volume=-10dB;[0:v]drawtext='font=DejaVuSansMono:text=%{pts}: fontcolor=white: fontsize=h/12: box=1: boxcolor=black@0.43: boxborderw=5: x=mod(floor(t/10+1)\,2)*mod(t*(w-text_w)/10\,w-text_w)+mod(floor(t/10)\,2)*(w-text_w-mod(t*(w-text_w)/10\,w-text_w)): y=text_h/2', drawtext='font=DejaVuSansMono:text=%{localtime}: fontcolor=white: fontsize=h/20: box=1: boxcolor=black@0.43: boxborderw=5: x=text_h: y=h-3*text_h/2', split=2[out1][out2]" \ -flags +global_header -preset superfast \
-c:a aac -b:a ${ABITRATE}k \ -map '[out1]' -pix_fmt yuv420p -s ${LIVE_RESOLUTION} -c:v libx264 -b:v ${LIVE_AVBR}k -maxrate:v ${LIVE_MVBR}k -g:v ${KEYFRAMEINTERVAL} \
-flags +global_header \ -keyint_min:v ${KEYFRAMEINTERVAL} -r:v ${FPS} -x264-params:v scenecut=0:open_gop=0 -bufsize:v 4096k -profile:v high \
-map '[out1]' -s ${LIVE_RESOLUTION} -c:v libx264 -b:v ${LIVE_AVBR}k -maxrate:v ${LIVE_MVBR}k -g:v ${KEYFRAMEINTERVAL} \ -map 1:a \
-keyint_min:v ${KEYFRAMEINTERVAL} -r:v ${FPS} -x264-params:v scenecut=0:open_gop=0 -bufsize:v 1280k -profile:v high \ -f flv ${URL} \
-map 1:a -pix_fmt yuv420p -f flv ${URL} \ -map '[out2]' -pix_fmt yuv420p -s ${REPLAY_RESOLUTION} -c:v libx264 -b:v ${LIVE_AVBR}k -maxrate:v ${LIVE_MVBR}k -g:v ${KEYFRAMEINTERVAL} \
-map '[out2]' -s ${REPLAY_RESOLUTION} -c:v libx264 -b:v ${REPLAY_AVBR}k -maxrate:v ${REPLAY_MVBR}k -g:v ${KEYFRAMEINTERVAL} \ -keyint_min:v ${KEYFRAMEINTERVAL} -r:v ${FPS} -x264-params:v scenecut=0:open_gop=0 -bufsize:v 8192k -profile:v high \
-keyint_min:v ${KEYFRAMEINTERVAL} -r:v ${FPS} -x264-params:v scenecut=0:open_gop=0 -bufsize:v 3072k -profile:v high \ -map 1:a \
-map 1:a -pix_fmt yuv420p -f matroska \ -f matroska -f segment -segment_time 10:00 -reset_timestamps 1 -strftime 1 "${FILENAME}_%Y-%m-%d_%H-%M-%S.mkv"
-f segment -segment_time 10:00 -reset_timestamps 1 \
-strftime 1 "${FILENAME}_%Y-%m-%d_%H-%M-%S.mkv"
# Notes # Notes
# Commande ffmpeg utilisée par own_cast # Commande ffmpeg utilisée par own_cast
echo /usr/bin/ffmpeg -hide_banner -loglevel warning \ #/usr/bin/ffmpeg -hide_banner -loglevel warning \
-fflags +genpts \ #-fflags +genpts \
-i pipe:0 -map v:0 \ #-i pipe:0 -map v:0 \
-c:v:0 libx264 -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 48 -keyint_min:v:0 48 -r:v:0 24 \ #-c:v:0 libx264 -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 48 -keyint_min:v:0 48 -r:v:0 24 \
-x264-params:v:0 scenecut=0:open_gop=0 -bufsize:v:0 1088k -profile:v:0 high \ #-x264-params:v:0 scenecut=0:open_gop=0 -bufsize:v:0 1088k -profile:v:0 high \
-map a:0? -c:a:0 copy \ #-map a:0? -c:a:0 copy \
-preset superfast \ #-preset superfast \
-var_stream_map v:0,a:0 \ #-var_stream_map v:0,a:0 \
-f hls -hls_time 2 -hls_list_size 15 -hls_flags program_date_time+independent_segments+omit_endlist \ #-f hls -hls_time 2 -hls_list_size 15 -hls_flags program_date_time+independent_segments+omit_endlist \
-segment_format_options mpegts_flags=mpegts_copyts=1 \ #-segment_format_options mpegts_flags=mpegts_copyts=1 \
-tune zerolatency \ #-tune zerolatency \
-pix_fmt yuv420p \ #-pix_fmt yuv420p \
-sc_threshold 0 \ #-sc_threshold 0 \
-master_pl_name stream.m3u8 \ #-master_pl_name stream.m3u8 \
-hls_segment_filename http://127.0.0.1:45627/%v/stream--KmjKxb4g-%d.ts \ #-hls_segment_filename http://127.0.0.1:45627/%v/stream--KmjKxb4g-%d.ts \
-max_muxing_queue_size 400 \ #-max_muxing_queue_size 400 \
-method PUT http://127.0.0.1:45627/%v/stream.m3u8 #-method PUT http://127.0.0.1:45627/%v/stream.m3u8