Change mp4 to mov
parent
a203bc8f26
commit
c57fb1ca56
|
@ -191,9 +191,9 @@ func (m *Manager) ServeHTTP(w http.ResponseWriter, r *http.Request, chunk string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stream full video
|
// Stream full video
|
||||||
mp4Sfx := ".mp4"
|
movSfx := ".mov"
|
||||||
if strings.HasSuffix(chunk, mp4Sfx) {
|
if strings.HasSuffix(chunk, movSfx) {
|
||||||
quality := strings.TrimSuffix(chunk, mp4Sfx)
|
quality := strings.TrimSuffix(chunk, movSfx)
|
||||||
if stream, ok := m.streams[quality]; ok {
|
if stream, ok := m.streams[quality]; ok {
|
||||||
return stream.ServeFullVideo(w)
|
return stream.ServeFullVideo(w)
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,9 +189,9 @@ func (s *Stream) ServeFullVideo(w http.ResponseWriter) error {
|
||||||
args = []string{"-loglevel", "warning", "-i", s.m.path, "-c", "copy"}
|
args = []string{"-loglevel", "warning", "-i", s.m.path, "-c", "copy"}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output mp4
|
// Output mov
|
||||||
args = append(args, []string{
|
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...)
|
coder := exec.Command(s.c.ffmpeg, args...)
|
||||||
|
@ -217,8 +217,8 @@ func (s *Stream) ServeFullVideo(w http.ResponseWriter) error {
|
||||||
defer cmdStdOut.Close()
|
defer cmdStdOut.Close()
|
||||||
stdoutReader := bufio.NewReader(cmdStdOut)
|
stdoutReader := bufio.NewReader(cmdStdOut)
|
||||||
|
|
||||||
// Write mp4 header
|
// Write mov headers
|
||||||
w.Header().Set("Content-Type", "video/mp4")
|
w.Header().Set("Content-Type", "video/quicktime")
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
flusher, ok := w.(http.Flusher)
|
flusher, ok := w.(http.Flusher)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Reference in New Issue