Add record_max_nf()
[fgen.git] / fgen.sh
diff --git a/fgen.sh b/fgen.sh
index b1bd4e2..5ffb9d7 100755 (executable)
--- a/fgen.sh
+++ b/fgen.sh
@@ -160,6 +160,13 @@ function insert_empty_frames()
     done
 }
 
+function record_max_nf()
+{
+    if [ ${nf} -gt ${max_nf} ]; then
+        max_nf="${nf}"
+    fi
+}
+
 function generate_video()
 {
     local png_files
@@ -290,6 +297,7 @@ if [ ${trames} -eq 1 ]; then
     convert -size ${size} xc:none ${dest}/background.png
 
     nf=""
+    max_nf="0"
     oldnf=""
     files=""
     group="default"
@@ -355,6 +363,7 @@ if [ ${trames} -eq 1 ]; then
             fi
 
             log_dbg "New frame ID: ${nf}"
+            record_max_nf
 
             fname=$(get_frame_name ${nf})