diff --git a/Dockerfile b/Dockerfile index 7284ee9..8206093 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,5 +2,3 @@ FROM scratch COPY .build/linux-amd64/telly ./app EXPOSE 6077 ENTRYPOINT ["./app"] - - diff --git a/Dockerfile.ffmpeg b/Dockerfile.ffmpeg index ec62afe..a679075 100644 --- a/Dockerfile.ffmpeg +++ b/Dockerfile.ffmpeg @@ -1,4 +1,4 @@ FROM jrottenberg/ffmpeg:4.0-alpine -COPY --from=tellytv/telly:dev /app /app +COPY .build/linux-amd64/telly ./app EXPOSE 6077 ENTRYPOINT ["/app"] diff --git a/routes.go b/routes.go index aaef5dd..6e6140a 100644 --- a/routes.go +++ b/routes.go @@ -185,9 +185,16 @@ func stream(lineup *lineup) gin.HandlerFunc { log.Infof("Serving channel number %d", channelID) + args := []string{ + "-i", channelURI, "-codec", "copy", "-f", "mpegts", "pipe:1", + } + useFFMpeg := viper.IsSet("iptv.ffmpeg") if useFFMpeg { useFFMpeg = viper.GetBool("iptv.ffmpeg") + if viper.IsSet("iptv.ffmpegcachesize") { + args = append(args, "-rtbufsize", viper.GetString("iptv.ffmpegcachesize")) + } } if !useFFMpeg { @@ -198,7 +205,7 @@ func stream(lineup *lineup) gin.HandlerFunc { log.Infoln("Remuxing stream with ffmpeg") - run := exec.Command("ffmpeg", "-i", channelURI, "-codec", "copy", "-f", "mpegts", "pipe:1") + run := exec.Command("ffmpeg", args...) ffmpegout, err := run.StdoutPipe() if err != nil { log.WithError(err).Errorln("StdoutPipe Error")