Fix snippet duration by using .mp4 container format

Changes snippet generation to always output .mp4 files instead of preserving source extension. This fixes duration accuracy issues caused by container/codec mismatch (e.g., h264 video in .wmv container). MP4 is the proper container for h264-encoded video and ensures FFmpeg respects the -t duration parameter correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2025-12-16 15:39:11 -05:00
parent f62b64b0d5
commit 6f82641018

16
main.go
View File

@ -5211,12 +5211,8 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
return
}
src := state.source
// Use same extension as source file since we're using stream copy
ext := filepath.Ext(src.Path)
if ext == "" {
ext = ".mp4"
}
outName := fmt.Sprintf("%s-snippet-%d%s", strings.TrimSuffix(src.DisplayName, filepath.Ext(src.DisplayName)), time.Now().Unix(), ext)
// Always use .mp4 for snippets since we're re-encoding to h264
outName := fmt.Sprintf("%s-snippet-%d.mp4", strings.TrimSuffix(src.DisplayName, filepath.Ext(src.DisplayName)), time.Now().Unix())
outPath := filepath.Join(filepath.Dir(src.Path), outName)
job := &queue.Job{
@ -5259,12 +5255,8 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
continue
}
// Use same extension as source file since we're using stream copy
ext := filepath.Ext(src.Path)
if ext == "" {
ext = ".mp4"
}
outName := fmt.Sprintf("%s-snippet-%d%s", strings.TrimSuffix(src.DisplayName, filepath.Ext(src.DisplayName)), timestamp, ext)
// Always use .mp4 for snippets since we're re-encoding to h264
outName := fmt.Sprintf("%s-snippet-%d.mp4", strings.TrimSuffix(src.DisplayName, filepath.Ext(src.DisplayName)), timestamp)
outPath := filepath.Join(filepath.Dir(src.Path), outName)
job := &queue.Job{