From 4945ffa46ea1d5339e877de183b25cda5ed4f8e8 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Fri, 6 Oct 2023 23:57:17 -0400 Subject: [PATCH] Fix bug with missing video for last group --- fgen.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/fgen.sh b/fgen.sh index d60da59..9fbd121 100755 --- a/fgen.sh +++ b/fgen.sh @@ -95,6 +95,18 @@ function get_dup_to() echo "${dup}" } +function generate_video() +{ + if which ffmpeg 1> /dev/null 2>&1; then + if [ -f ${dest}/${group}-f1.png ]; then + if [ ${dry_run} -eq 0 ]; then + # Conversion vidéo: + ffmpeg ${FFMPEG_OPTS} -r ${fps} -start_number 1 -i ${dest}/${group}-f%d.png ${dest}/${group}.mp4 + fi + fi + fi +} + print_usage() { echo "${PROG_NAME} -- Générateur de séquence d'images PNG à partir d'un fichier Photoshop (PSD)." @@ -218,14 +230,7 @@ if [ ${trames} -eq 1 ]; then # Only change group if ng is set... if [ x"${ng}" != x"" ]; then - if which ffmpeg 1> /dev/null 2>&1; then - if [ -f ${dest}/${group}-f1.png ]; then - if [ ${dry_run} -eq 0 ]; then - # Conversion vidéo: - ffmpeg ${FFMPEG_OPTS} -r ${fps} -start_number 1 -i ${dest}/${group}-f%d.png ${dest}/${group}.mp4 - fi - fi - fi + generate_video group="${ng}" log_dbg "New group: ${ng}" @@ -286,3 +291,6 @@ if [ ${trames} -eq 1 ]; then fi done <${layers} fi + +# Special case for last group... +generate_video -- 2.20.1