From 236afaa331d98755d23a80ba4064aa91e4361fb1 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Thu, 14 May 2026 23:15:53 +0200 Subject: 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. --- transcode.sh | 16 +++++++++------- 1 file 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}" -- cgit v1.3.1