From 17d20e538773f088601f3ab615ba797c00e24a88 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Sat, 7 Oct 2023 22:36:34 -0400 Subject: [PATCH] Improve video input frames detection Will also work with frames with leading zeros in their name. --- fgen.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fgen.sh b/fgen.sh index 6cc7db6..f2c961f 100755 --- a/fgen.sh +++ b/fgen.sh @@ -130,13 +130,19 @@ function insert_empty_frames() function generate_video() { + local png_files + if which ffmpeg 1> /dev/null 2>&1; then - if [ -f ${dest}/${group}-f1.png ]; then + set +e + png_files=$(ls ${dest}/${group}-f*.png 2> /dev/null) + set -e + + if [ x"${png_files}" != x"" ]; then log_dbg "generate_video start" if [ ${dry_run} -eq 1 ]; then touch ${dest}/${group}.mp4 else - ffmpeg ${FFMPEG_OPTS} -r ${fps} -start_number 1 -i ${dest}/${group}-f%d.png ${dest}/${group}.mp4 + ffmpeg ${FFMPEG_OPTS} -r ${fps} -pattern_type glob -i "${dest}/${group}-f*.png" ${dest}/${group}.mp4 fi log_dbg "generate_video: end" -- 2.20.1