Question: -g missing from -map
vaage opened this issue · comments
Why in the code below is -map '[8out]....
the only one with out a -g
value? All other ffmpeg commands in the file, following a similar structure, have a -g
value for each -map
entry.
...
# If the input is 4k then encode with 4k encoding settings
elif [ "${res}" == "2160" ] || [ "${roundedfps}" == "25" ]
then
ffmpeg \
-hide_banner \
-queue_size 4294967296 \
-f decklink \
-i "$device" \
-filter_complex \
"[0:v]format=yuv420p,split=8[1][2][3][4][5][6][7][8]; \
[1]hwupload_cuda,scale_npp=-1:288:interp_algo=super,hwdownload[1out]; \
[2]hwupload_cuda,scale_npp=-1:360:interp_algo=super,hwdownload[2out]; \
[3]hwupload_cuda,scale_npp=-1:432:interp_algo=super,hwdownload[3out]; \
[4]hwupload_cuda,scale_npp=-1:540:interp_algo=super,hwdownload[4out]; \
[5]hwupload_cuda,scale_npp=-1:720:interp_algo=super[5out]; \
[6]hwupload_cuda,scale_npp=-1:1080:interp_algo=super[6out]; \
[7]hwupload_cuda,scale_npp=-1:1440:interp_algo=super[7out]; \
[8]null[8out]" \
-map '[1out]' -c:v:0 ${x264enc} -g 50 -b:v:0 400k \
-map '[2out]' -c:v:1 ${x264enc} -g 50 -b:v:1 800k \
-map '[3out]' -c:v:2 ${x264enc} -g 50 -b:v:2 1100k \
-map '[4out]' -c:v:3 ${x264enc} -g 50 -b:v:3 2200k \
-map '[5out]' -c:v:4 ${nvenc} -g 50 -b:v:4 3300k \
-map '[6out]' -c:v:5 ${nvenc} -g 50 -b:v:5 6000k \
-map '[7out]' -c:v:6 ${nvenc} -g 50 -b:v:6 12000k \
-map '[8out]' -c:v:7 ${nvenc} -b:v:7 20000k \
-c:a:0 aac -b:a 128k -map 0:a \
${hlsargs} \
-var_stream_map "a:0,agroup:teh_audio \
v:0,agroup:teh_audio \
v:1,agroup:teh_audio \
v:2,agroup:teh_audio \
v:3,agroup:teh_audio \
v:4,agroup:teh_audio \
v:5,agroup:teh_audio \
v:6,agroup:teh_audio \
v:7,agroup:teh_audio" \
http://${1}/${vid}_%v.m3u8 >/dev/null 2>~/streamline/logs/encode.log &
...
Since most of these ffmpeg commands follow the same structure, could I suggest that it be converted to a function so that small issues like this can be avoided? Something like:
descriptive_name() {
local what_ever_g_really_means=${1}
// other params....
ffmpeg -hide_banner ...
}
Doing something like this will make it easier for new readers to understand what all is happening since the high-level descriptions will give us a better idea of "what is happening" without needing to understand the "how it's happpening".