From 6f82641018ee6a63299dafe8a33976d094458e8f Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Tue, 16 Dec 2025 15:39:11 -0500 Subject: [PATCH] Fix snippet duration by using .mp4 container format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- main.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/main.go b/main.go index 640dc26..b1c08be 100644 --- a/main.go +++ b/main.go @@ -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{