summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Fink2026-05-14 23:15:53 +0200
committerDennis Fink2026-05-14 23:15:53 +0200
commit236afaa331d98755d23a80ba4064aa91e4361fb1 (patch)
treea084a4460d0b65e1275b99c37a63a7f4543ad64b
parent919d3a483e6fe8d2932f20f67a7f877e8c1910d3 (diff)
downloadtranscode.sh-236afaa331d98755d23a80ba4064aa91e4361fb1.tar.gz
transcode.sh-236afaa331d98755d23a80ba4064aa91e4361fb1.zip
refactor(encode): skip excluded codecs before format checks
Move the skip-codec check directly after codec detection, before validating pixel format and frame rate. This lets files with excluded codecs return early without requiring additional probe fields that are irrelevant when the file will not be encoded.
-rwxr-xr-xtranscode.sh16
1 files changed, 9 insertions, 7 deletions
diff --git a/transcode.sh b/transcode.sh
index ea61fda..c222dc0 100755
--- a/transcode.sh
+++ b/transcode.sh
@@ -1264,12 +1264,21 @@ encode_one() {
error "Could not determine input video codec:" "$input_file"
return $EXIT_RUNTIME_FAILURE
fi
+
+ if [[ -v SKIP_CODECS["$input_codec"] ]]; then
+ ((_REPORT_SKIPPED_CODEC++))
+ append_size_report_row "skipped_codec" "$filename" "$(filesize "$input_file")"
+ msg "Skipping (codec excluded):" "$input_codec"
+ return $EXIT_OK
+ fi
+
if [[ -z "$input_pixel_format" ]]; then
((_REPORT_ENCODING_FAILED++))
append_size_report_row "failed" "$filename" "$(filesize "$input_file")"
error "Could not determine input pixel format:" "$input_file"
return $EXIT_RUNTIME_FAILURE
fi
+
if [[ -z "$input_frame_rate" ]]; then
((_REPORT_ENCODING_FAILED++))
append_size_report_row "failed" "$filename" "$(filesize "$input_file")"
@@ -1277,13 +1286,6 @@ encode_one() {
return $EXIT_RUNTIME_FAILURE
fi
- if [[ -v SKIP_CODECS["$input_codec"] ]]; then
- ((_REPORT_SKIPPED_CODEC++))
- append_size_report_row "skipped_codec" "$filename" "$(filesize "$input_file")"
- msg "Skipping (codec excluded):" "$input_codec"
- return $EXIT_OK
- fi
-
# Some files report "yuvj*" formats (full-range JPEG-style). For encoding
# purposes we normalize to the equivalent "yuv*" formats.
input_pixel_format="${input_pixel_format/yuvj/yuv}"