ffmpeg-effect: support images by converting them to video first - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 7f21c3fc6cece6371154259e3ecf4d1def0ac1df DIR parent 67da7afdc7b272b136032f637f425e6546b1844e HTML Author: Josuah Demangeon <me@josuah.net> Date: Wed, 1 Sep 2021 15:08:40 +0200 ffmpeg-effect: support images by converting them to video first Signed-off-by: Annna Robert-Houdin <annna@bitreich.org> Diffstat: M ffmpeg-effect | 10 ++++++++++ 1 file changed, 10 insertions(+), 0 deletions(-) --- DIR diff --git a/ffmpeg-effect b/ffmpeg-effect @@ -3,6 +3,7 @@ # requirements: ffmpeg, ffprobe. ffmpeg_common="${FFMPEG_EFFECT_COMMON:-ffmpeg -n -loglevel error}" +ffprobe_common="${FFMPEG_EFFECT_FFPROBE:-ffprobe -v error -of default=noprint_wrappers=1:nokey=1}" mediadir="${FFMPEG_EFFECT_MEDIA_DIR:-/home/annna/bin/modules/filter-media}" repeats=5 @@ -62,6 +63,15 @@ mix_audio_video() { } process_filter() { + # extend duration if less than a second or image + dur="$($ffprobe_common -show_entries format=duration "$2")" + if test "$dur" = "N/A" || test "${dur%.*}" -lt 1; then + tmp=/tmp/ffmpeg-effect.$$.mkv + trap 'rm -f "$tmp"' EXIT INT TERM HUP + $ffmpeg_common -loop 1 -to 10 -i "$2" "$tmp" + set -- $1 "$tmp" $3 + fi + case "$1" in banjo) replace_audio "${mediadir}/banjo.mp3" "$2" "$3";;