-
-
Notifications
You must be signed in to change notification settings - Fork 546
Description
Add a new tool to overlay or replace an audio track in a video file. This complements existing features like video trim/rotate/merge, audio trim/merge, and audio extraction from video, enabling users to customize video audio without external software. All processing remains client-side for privacy.
Rationale
Users often need to dub videos with new audio (e.g., music, voiceover) or fix audio issues. Given OmniTools' focus on lightweight, browser-based media editing, this fits seamlessly and enhances the video/audio suite.
Implementation Suggestion
Create a new tool under src/tools/video (similar to VideoTrimmer or VideoReverser), using the existing FFmpeg.wasm integration (assuming it's used for trim/merge/extract, as common in client-side media processing with @ffmpeg/ffmpeg).
- UI: Inputs for video file and audio file; options for "replace existing audio" (default) or "mix/add as secondary track"; output format selector.
- Logic: Load files via File API; use FFmpeg commands:
- Replace:
ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 output.mp4 - Mix/Add:
ffmpeg -i video.mp4 -i audio.mp3 -filter_complex "[0:a][1:a]amix=inputs=2:duration=shortest" -c:v copy output.mp4(for mixing) or-map 0 -map 1:a -c copy(add track).
- Replace:
- Reuse shared utils for file handling/progress (e.g., from merge tools).
- Test: Ensure compatibility with common formats; handle duration mismatches by trimming longer audio.
This should be lightweight (~similar complexity to audio merge), leveraging existing libs without new dependencies.