From e94c6ad740fc4fb40ca32ea3e1a95b6bd9a1c73b Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Thu, 5 Oct 2023 23:01:39 -0400 Subject: [PATCH] Do not record non-seqential frames --- fgen.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fgen.sh b/fgen.sh index 07507d7..56b162e 100755 --- a/fgen.sh +++ b/fgen.sh @@ -174,6 +174,8 @@ if [ ${trames} -eq 1 ]; then # Will start at frame 2 at first loop iteration f=1 + nf="" + oldnf="" files="" while read l; do @@ -195,9 +197,23 @@ if [ ${trames} -eq 1 ]; then files="${files} -page ${p} ${src}[${f}]" if [ x"${nf}" != x"" ]; then + # Only check expected frame if oldnf is set... + if [ x"${oldnf}" != x"" ]; then + expected_nf=$((${oldnf} + 1)) + + if [ ${expected_nf} -ne ${nf} ]; then + echo "Error: invalid frame sequence: ${nf}" + echo " previous: ${oldnf}" + echo " expected: ${expected_nf}" + files="" + continue + fi + fi + log_dbg "New frame ID: ${nf}" convert -colorspace sRGB -page +0+0 ${dest}/background.png ${files} -background none -layers merge ${dest}/f${nf}.png files="" + oldnf="${nf}" fi done <${layers} fi -- 2.20.1