From c57fb1ca56d800808fb8e2b7f7bddd3961892dd5 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Tue, 29 Nov 2022 14:16:27 -0800 Subject: [PATCH] Change mp4 to mov --- manager.go | 6 +++--- stream.go | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/manager.go b/manager.go index f1ca9dbe..390158ec 100644 --- a/manager.go +++ b/manager.go @@ -191,9 +191,9 @@ func (m *Manager) ServeHTTP(w http.ResponseWriter, r *http.Request, chunk string } // Stream full video - mp4Sfx := ".mp4" - if strings.HasSuffix(chunk, mp4Sfx) { - quality := strings.TrimSuffix(chunk, mp4Sfx) + movSfx := ".mov" + if strings.HasSuffix(chunk, movSfx) { + quality := strings.TrimSuffix(chunk, movSfx) if stream, ok := m.streams[quality]; ok { return stream.ServeFullVideo(w) } diff --git a/stream.go b/stream.go index 367b3967..6540fd5c 100644 --- a/stream.go +++ b/stream.go @@ -189,9 +189,9 @@ func (s *Stream) ServeFullVideo(w http.ResponseWriter) error { args = []string{"-loglevel", "warning", "-i", s.m.path, "-c", "copy"} } - // Output mp4 + // Output mov args = append(args, []string{ - "-movflags", "frag_keyframe+empty_moov+faststart", "-f", "mp4", "pipe:1", + "-movflags", "frag_keyframe+empty_moov+faststart", "-f", "mov", "pipe:1", }...) coder := exec.Command(s.c.ffmpeg, args...) @@ -217,8 +217,8 @@ func (s *Stream) ServeFullVideo(w http.ResponseWriter) error { defer cmdStdOut.Close() stdoutReader := bufio.NewReader(cmdStdOut) - // Write mp4 header - w.Header().Set("Content-Type", "video/mp4") + // Write mov headers + w.Header().Set("Content-Type", "video/quicktime") w.WriteHeader(http.StatusOK) flusher, ok := w.(http.Flusher) if !ok {