Added the used Opus bitrate to the media pipeline logs

This commit is contained in:
Thorsten Sommer 2026-09-19 19:08:47 +02:00
parent 8049067fb3
commit 341534ab78
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 12 additions and 1 deletions

View File

@ -653,6 +653,14 @@ public sealed class MediaTranscriptionService(
// re-encoding it could only take quality away, never add any.
var opusBitrateBps = settingsManager.ConfigurationData.App.OpusBitrate.GetBitsPerSecond();
// Which quality an upload was produced with is the first question to ask when a transcript
// comes back missing something, so it has to be in the log of the job it belongs to:
logger.LogInformation(
"Normalizing media for operation {OperationId}; re-encoding uses the Opus bitrate {OpusBitrate} ({OpusBitrateBps} bps).",
operation.Id,
settingsManager.ConfigurationData.App.OpusBitrate,
opusBitrateBps);
// The quick POST is intentionally not cancelled: losing its response could orphan a job
// whose ID the client never received. Cancellation is applied immediately after ownership.
var jobId = await rustService.StartMediaJobAsync(mediaPath, normalizedPath, opusBitrateBps, CancellationToken.None);

View File

@ -632,7 +632,10 @@ fn normalize_media(input_path: &FilePath, output_path: &FilePath, max_pass_throu
&& params.sample_rate == Some(OUTPUT_SAMPLE_RATE)
&& channels == 1
&& input_path.metadata().map(|metadata| metadata.len() <= max_pass_through_bytes).unwrap_or(false);
log::info!("media normalization decision: track_id={track_id}, pass_through={pass_through}, codec={detected_codec}, channels={channels}");
// A pass-through never reaches the encoder, so no bitrate is applied to it. Logging the one we
// would have used anyway would send support looking for an encoding which never happened:
let applied_opus_bitrate_bps = (!pass_through).then_some(opus_bitrate_bps);
log::info!("media normalization decision: track_id={track_id}, pass_through={pass_through}, codec={detected_codec}, channels={channels}, opus_bitrate_bps={applied_opus_bitrate_bps:?}");
let partial_path = partial_path(output_path);
if let Some(parent) = partial_path.parent() {