Skip to content

Commit 319d9e3

Browse files
Copilotkangjoseph90
andcommitted
fix(audio): use accurate ffmpeg seek for boosted segment extraction
Co-authored-by: kangjoseph90 <83045825+kangjoseph90@users.noreply.github.com> Agent-Logs-Url: https://github.com/kangjoseph90/PictureBookBuilder/sessions/c0419757-b60a-4510-a922-ef258200e32c
1 parent 2d2200c commit 319d9e3

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/ui/audio_mixer.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,17 +405,19 @@ def _prepare_boosted_audio(self, clip: ScheduledClip) -> Optional[str]:
405405
fd, temp_path = tempfile.mkstemp(suffix=".wav")
406406
os.close(fd)
407407

408-
# Use FFmpeg to extract segment and apply volume
408+
# Use FFmpeg to extract segment and apply volume.
409+
# Keep -ss AFTER -i for accurate seek on compressed/VBR sources.
410+
# (Input seeking can be fast but imprecise and may shift clip start.)
411+
# -i: input file
409412
# -ss: start time
410413
# -t: duration
411-
# -i: input file
412414
# -filter:a "volume=X"
413415
# -y: overwrite
414416
cmd = [
415417
'ffmpeg',
418+
'-i', clip.source_path,
416419
'-ss', str(clip.source_offset),
417420
'-t', str(clip.duration),
418-
'-i', clip.source_path,
419421
'-filter:a', f'volume={clip.volume}',
420422
'-y',
421423
temp_path

0 commit comments

Comments
 (0)