diff options
| author | Dennis Fink | 2026-05-14 23:15:20 +0200 |
|---|---|---|
| committer | Dennis Fink | 2026-05-14 23:15:20 +0200 |
| commit | 919d3a483e6fe8d2932f20f67a7f877e8c1910d3 (patch) | |
| tree | 86c9f1caef95c81a73cc2f8c691233bc6f4e53a0 | |
| parent | 7fb7d0844c7e53a922719697b583fd33a1b89970 (diff) | |
| download | transcode.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-x | transcode.sh | 9 |
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")" |
