aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtranscode.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/transcode.sh b/transcode.sh
index 20d4684..7f40e3b 100755
--- a/transcode.sh
+++ b/transcode.sh
@@ -1366,18 +1366,26 @@ encode_one() {
# NOTE: This block calls debug() and reads $DEBUG. Both must be defined before
# this point. Do not move this block above the GLOBAL VARIABLES or FUNCTION
# DEFINITIONS sections without adjusting those dependencies.
+#
+# Keep ffmpeg/libav log coloring in sync with transcode.sh's color mode.
+# FFmpeg honors AV_LOG_FORCE_COLOR and AV_LOG_FORCE_NOCOLOR for its own output,
+# so exporting these prevents subprocess logs from using a different color style.
if [[ -n "${NO_COLOR:-}" ]]; then
debug "Colors are disabled via NO_COLOR"
ENABLE_COLOR=0
+ export AV_LOG_FORCE_NOCOLOR=1
elif [[ -n "${FORCE_COLOR:-}" ]]; then
debug "Colors are forced via FORCE_COLOR"
ENABLE_COLOR=1
+ export AV_LOG_FORCE_COLOR=1
elif [[ -t 1 ]]; then
debug "Colors are enabled via interactive terminal"
ENABLE_COLOR=1
+ export AV_LOG_FORCE_COLOR=1
else
debug "Colors are disabled"
ENABLE_COLOR=0
+ export AV_LOG_FORCE_NOCOLOR=1
fi
setup_colors
@@ -1418,11 +1426,15 @@ while [[ $# -gt 0 ]]; do
;;
--color)
ENABLE_COLOR=1
+ # Propagate the explicit color choice to ffmpeg/libav subprocesses.
+ export AV_LOG_FORCE_COLOR=1
setup_colors
shift
;;
--no-color)
ENABLE_COLOR=0
+ # Propagate the explicit color choice to ffmpeg/libav subprocesses.
+ export AV_LOG_FORCE_NOCOLOR=1
setup_colors
shift
;;