diff options
| author | Dennis Fink | 2026-05-22 18:53:04 +0200 |
|---|---|---|
| committer | Dennis Fink | 2026-05-22 18:53:04 +0200 |
| commit | dad27b5f2ce5fb5b907bf3c552164d032d5048fd (patch) | |
| tree | da6f5535bc165ecff18b7127cd7121daa9edd7c7 | |
| parent | d6cd8260465c4f1c92713e0b17df1e219fb5a2fd (diff) | |
| download | transcode.sh-dad27b5f2ce5fb5b907bf3c552164d032d5048fd.tar.gz transcode.sh-dad27b5f2ce5fb5b907bf3c552164d032d5048fd.zip | |
refactor(encoding): reuse metadata logging
Extract encode_one metadata output into a helper so dry-run and real
encoding paths print the same stream information.
Use the shared helper before running ffmpeg as well as during dry runs,
making verbose output consistent without duplicating the metadata field
list.
| -rwxr-xr-x | transcode.sh | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/transcode.sh b/transcode.sh index b3ced55..b7d19ae 100755 --- a/transcode.sh +++ b/transcode.sh @@ -1084,6 +1084,18 @@ replace_original() { # ENCODING ############################################################################### +# Print metadata collected earlier in encode_one(). +# Intentionally reads encode_one() locals via Bash dynamic scoping. +encode_one_print_metadata() { + verbose "Video stream:" "$VIDEO_STREAM" + verbose "Input codec:" "$input_codec" + verbose "Input pixel format:" "$input_pixel_format" + verbose "Output pixel format:" "$output_pixel_format" + verbose "Input frame rate:" "$input_frame_rate" + verbose "Input FPS:" "$input_fps" + verbose "Output GOP size:" "$output_gop_size" +} + # Encode a single media file according to PRESET_NAME. # # Arguments: @@ -1313,13 +1325,7 @@ encode_one() { if [[ $DRY_RUN -eq 1 ]]; then msg "DRY RUN:" "Would encode with preset $PRESET_NAME" - verbose "Video stream:" "$VIDEO_STREAM" - verbose "Input codec:" "$input_codec" - verbose "Input pixel format:" "$input_pixel_format" - verbose "Output pixel format:" "$output_pixel_format" - verbose "Input frame rate:" "$input_frame_rate" - verbose "Input FPS:" "$input_fps" - verbose "Output GOP size:" "$output_gop_size" + encode_one_print_metadata verbose "Command:" "${encode_cmd[*]}" return $EXIT_OK fi @@ -1329,6 +1335,7 @@ encode_one() { # --------------------------------------------------------------------------- msg "Encoding:" "$input_file" + encode_one_print_metadata if nice -n "$NICE_VALUE" "${encode_cmd[@]}"; then # Integrity verification: confirm the encoded output is a valid, playable |
