Showing 1 changed files with 14 additions and 2 deletions
+14 -2
garmin_varia_transcode.sh
@@ -601,6 +601,11 @@ restore_metadata_with_exiftool() {
601 601
     fi
602 602
   fi
603 603
 
604
+  if [[ "$STOP_AFTER_CURRENT" == true && "$INTERRUPT_COUNT" -gt 0 ]]; then
605
+    log_msg "INFO" "Metadata restore interrupted by user while stopping: $output_file"
606
+    return 1
607
+  fi
608
+
604 609
   log_msg "ERROR" "Failed to restore metadata with exiftool: $output_file"
605 610
   return 1
606 611
 }
@@ -1200,9 +1205,16 @@ process_video_file() {
1200 1205
         return 4
1201 1206
       fi
1202 1207
       ERRORS=$((ERRORS + 1))
1203
-      DESTINATION_FAILURES=$((DESTINATION_FAILURES + 1))
1208
+      if destination_cannot_accept_file "$input_file" "$out_dir" ""; then
1209
+        DESTINATION_FAILURES=$((DESTINATION_FAILURES + 1))
1210
+        cleanup_repacked_input "$repacked_input_file"
1211
+        return 3
1212
+      fi
1213
+      # Validation failed but destination is healthy: the source or encoder produced
1214
+      # a corrupt/truncated output. Treat as source error so --keep-going can skip it.
1215
+      log_msg "ERROR" "Encode produced invalid output (source may be corrupt): $input_file"
1204 1216
       cleanup_repacked_input "$repacked_input_file"
1205
-      return 3
1217
+      return 2
1206 1218
     fi
1207 1219
   fi
1208 1220