Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ffmpeg caching #284

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ FROM scratch
COPY .build/linux-amd64/telly ./app
EXPOSE 6077
ENTRYPOINT ["./app"]


2 changes: 1 addition & 1 deletion Dockerfile.ffmpeg
Original file line number Diff line number Diff line change
@@ -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"]
9 changes: 8 additions & 1 deletion routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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")
Expand Down