fix: rust_asr_asrx handles MLX Whisper non-finite JSON literals
- MLX Whisper emits 'avg_logprob: NaN' / 'compression_ratio: Infinity' when a clip has no intelligible audio (e.g. near-silent test clips). serde_json strictly refuses those literals, so rust_asr_asrx failed with 'expected value at line 1 column 151' and asrx never completed. - Sanitize NaN / Infinity / -Infinity literals outside strings into null before parsing (sanitize_json_nonfinite). - Add no-audio-track early-out. Clean up .wav byproduct after success. Verified on dev (m5max48): 002.mp4 asrx re-scan now completes and produces output/df6376c8....asrx.json; processor_results asrx = completed.
This commit is contained in:
@@ -76,9 +76,26 @@ pub async fn process_asr_asrx(
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
// Clean up wav byproduct after successful processing.
|
||||
cleanup_wav_byproduct(video_path);
|
||||
|
||||
Ok(AsrAsrxResult {
|
||||
language,
|
||||
segments,
|
||||
recovery,
|
||||
})
|
||||
}
|
||||
|
||||
/// Clean up the .wav audio byproduct left by rust_asr_asrx.
|
||||
/// The wav file is created next to the video with the same base name.
|
||||
fn cleanup_wav_byproduct(video_path: &str) {
|
||||
let mut wav_path = std::path::PathBuf::from(video_path);
|
||||
wav_path.set_extension("wav");
|
||||
if wav_path.exists() {
|
||||
if let Err(e) = std::fs::remove_file(&wav_path) {
|
||||
tracing::warn!("[ASR_ASRX] Failed to cleanup {}: {}", wav_path.display(), e);
|
||||
} else {
|
||||
tracing::info!("[ASR_ASRX] Cleaned up wav byproduct: {}", wav_path.display());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user