feat: ASR output frame numbers + rename start/end to start_time/end_time
- Python: asr_processor.py detects FPS from CUT/ffprobe (no fallback), outputs start_frame/end_frame - Rust: All AsrSegment structs use start_time/end_time with #[serde(alias)] for backward compat - store_asr_chunks: prefers ASR output frames, falls back to time-based conversion - Added backward compatibility test for old JSON format (start/end) Breaking change: ffprobe/CUT FPS failure now aborts instead of using default 24fps
This commit is contained in:
@@ -755,8 +755,11 @@ impl ProcessorPool {
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, segment)| {
|
||||
let start_frame = (segment.start * fps).round() as i64;
|
||||
let end_frame = (segment.end * fps).round() as i64;
|
||||
// Prefer ASR output frames, fallback to time-based conversion
|
||||
let start_frame = segment.start_frame
|
||||
.unwrap_or_else(|| (segment.start_time * fps).round() as i64);
|
||||
let end_frame = segment.end_frame
|
||||
.unwrap_or_else(|| (segment.end_time * fps).round() as i64);
|
||||
let data = serde_json::json!({
|
||||
"text": segment.text,
|
||||
"text_normalized": segment.text.to_lowercase(),
|
||||
@@ -767,8 +770,8 @@ impl ProcessorPool {
|
||||
i as i64,
|
||||
start_frame,
|
||||
end_frame,
|
||||
segment.start,
|
||||
segment.end,
|
||||
segment.start_time,
|
||||
segment.end_time,
|
||||
data,
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user