Fix input read errors by providing ffmpeg with blank stdin - bitreich-tv - Meme TV encoding and streaming HTML git clone git://bitreich.org/bitreich-tv git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/bitreich-tv DIR Log DIR Files DIR Refs DIR Tags DIR LICENSE --- DIR commit 60592b8f08f20a71d6fca1bd3ec1e4baa42667a1 DIR parent 2c603b4a4ac3a953f11aac4157aae322f52a9e80 HTML Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Sun, 16 Aug 2020 20:57:36 +0200 Fix input read errors by providing ffmpeg with blank stdin Diffstat: M brtv-generate-title-slides.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) --- DIR diff --git a/brtv-generate-title-slides.sh b/brtv-generate-title-slides.sh @@ -18,34 +18,35 @@ video_resolution=1280x720 # slide style bgcolor=magenta -fcolor=white +fgcolor=white # show title slides for this duration [s] title_display_time=5 ### CONFIGURATION END +temp="$(mktemp).png" title_slide() { - img="$(basename "${1%.*}".png)" - printf 'title_slide %s -> %s\n' "$1" "$img" convert -size "$video_resolution" "xc:${bgcolor}" \ -pointsize 48 -fill "$fgcolor" \ - -gravity center -draw "text 0,0 '#${img%.*}'" "$img" + -gravity center -draw "text 0,0 '${1}'" "$temp" ffmpeg -y \ + -loglevel error \ -f lavfi \ -i anullsrc=r=48000 \ - -i "$img" \ + -i "$temp" \ -t "${title_display_time}" \ $ffmpeg_codec \ - "$2" && rm "$img" + "$2" < /dev/null + printf '%s\n' "$2" } mkdir -p "$title" -# make title slide for every file in $1/ if they do not already exist -while IFS=' -' read -r line; do - out_path="${title}/$(basename "${f%.*}.${video_ext}")" - [ ! -f "$out_path" ] && title_slide "$f" "$out_path" +# make title slide for every tag in first column of stdin +# (if title slide doesn't already exist) +while read -r tag url; do + out="${title}/${tag#\#}.${video_ext}" + [ ! -f "$out" ] && title_slide "$tag" "$out" done