aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Fink2026-05-14 23:15:20 +0200
committerDennis Fink2026-05-14 23:15:20 +0200
commit919d3a483e6fe8d2932f20f67a7f877e8c1910d3 (patch)
tree86c9f1caef95c81a73cc2f8c691233bc6f4e53a0
parent7fb7d0844c7e53a922719697b583fd33a1b89970 (diff)
downloadtranscode.sh-919d3a483e6fe8d2932f20f67a7f877e8c1910d3.tar.gz
transcode.sh-919d3a483e6fe8d2932f20f67a7f877e8c1910d3.zip
refactor(probe): read ffprobe fields without sed
Replace three separate `printf | sed` pipelines with a single grouped `read` block fed from the existing ffprobe output. This keeps codec, pixel format, and frame-rate parsing together, avoids extra subprocesses, and makes the field order easier to see at the call site. No runtime behavior is intended to change.
-rwxr-xr-xtranscode.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/transcode.sh b/transcode.sh
index e333200..ea61fda 100755
--- a/transcode.sh
+++ b/transcode.sh
@@ -1251,12 +1251,13 @@ encode_one() {
local input_codec input_pixel_format input_frame_rate input_fps
- input_codec=$(printf '%s\n' "$probe_out" | sed -n '1p')
+ {
+ IFS= read -r input_codec
+ IFS= read -r input_pixel_format
+ IFS= read -r input_frame_rate
+ } <<<"$probe_out"
debug "Input codec:" "$input_codec"
- input_pixel_format=$(printf '%s\n' "$probe_out" | sed -n '2p')
- input_frame_rate=$(printf "%s\n" "$probe_out" | sed -n '3p')
-
if [[ -z "$input_codec" ]]; then
((_REPORT_ENCODING_FAILED++))
append_size_report_row "failed" "$filename" "$(filesize "$input_file")"