Skip to content

Commit

Permalink
Switch livepeer_ffmpeg into the system ffmpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
leszko committed Jan 13, 2025
1 parent be0d07d commit c61ee5c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 51 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,6 @@ endif
livepeer:
GO111MODULE=on CGO_ENABLED=1 CC="$(cc)" CGO_CFLAGS="$(cgo_cflags)" CGO_LDFLAGS="$(cgo_ldflags) ${CGO_LDFLAGS}" go build -o $(GO_BUILD_DIR) -tags "$(BUILD_TAGS)" -ldflags="$(ldflags)" cmd/livepeer/*.go

livepeer_ffmpeg:
GO111MODULE=on CGO_ENABLED=1 CC="$(cc)" CGO_CFLAGS="$(cgo_cflags)" CGO_LDFLAGS="$(cgo_ldflags) ${CGO_LDFLAGS}" go build -o $(GO_BUILD_DIR) -ldflags="$(ldflags)" -ldflags="$(ldflags)" cmd/livepeer_ffmpeg/*.go

livepeer_cli:
GO111MODULE=on CGO_ENABLED=1 CC="$(cc)" CGO_CFLAGS="$(cgo_cflags)" CGO_LDFLAGS="$(cgo_ldflags) ${CGO_LDFLAGS}" go build -o $(GO_BUILD_DIR) -tags "$(BUILD_TAGS)" -ldflags="$(ldflags)" cmd/livepeer_cli/*.go

Expand Down
33 changes: 0 additions & 33 deletions cmd/livepeer_ffmpeg/livepeer_ffmpeg.go

This file was deleted.

2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ COPY --from=build /usr/bin/grpc_health_probe /usr/local/bin/grpc_health_probe
COPY --from=build /src/tasmodel.pb /tasmodel.pb
COPY --from=build /usr/share/misc/pci.ids /usr/share/misc/pci.ids

RUN apt update && apt install net-tools lsof -y
RUN apt update && apt install -yqq ffmpeg

ENTRYPOINT ["/usr/local/bin/livepeer"]
18 changes: 11 additions & 7 deletions media/rtmp2segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,18 @@ func (ms *MediaSegmenter) RunSegmentation(ctx context.Context, in string, segmen
clog.Errorf(ctx, "Stopping segmentation, input stream does not exist. in=%s err=%s", in, err)
break
}
cmd := exec.Command("/usr/local/bin/livepeer_ffmpeg", in, outFilePattern, "segment")
_, err = cmd.CombinedOutput()
cmd := exec.Command("ffmpeg",
"-i", in,
"-c:a", "copy",
"-c:v", "copy",
"-f", "segment",
outFilePattern,
)
output, err := cmd.CombinedOutput()
if err != nil {
clog.Errorf(ctx, "Failed to run segmentation process. in=%s err=%s", in, err)
}
err = cmd.Wait()
if err != nil {
clog.Errorf(ctx, "Failed to run segmentation process. in=%s err=%s", in, err)
clog.Errorf(ctx, "Error sending RTMP out process: %v", err)
clog.Infof(ctx, "Process output: %s", output)
return
}
clog.Infof(ctx, "Done with segmentation process")
retryCount++
Expand Down
14 changes: 7 additions & 7 deletions server/ai_live_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,20 @@ func startTrickleSubscribe(ctx context.Context, url *url.URL, params aiRequestPa
break
}

in := "pipe:0"
out := params.liveParams.outputRTMPURL
cmd := exec.Command("/usr/local/bin/livepeer_ffmpeg", in, out, "flv")
cmd := exec.Command("ffmpeg",
"-i", "pipe:0",
"-c:a", "copy",
"-c:v", "copy",
"-f", "flv",
params.liveParams.outputRTMPURL,
)
cmd.Stdin = r
output, err := cmd.CombinedOutput()
if err != nil {
clog.Errorf(ctx, "Error sending RTMP out process: %v", err)
clog.Infof(ctx, "Process output: %s", output)
return
}
err = cmd.Wait()
if err != nil {
clog.Infof(ctx, "Error sending RTMP out: %s", err)
}
time.Sleep(5 * time.Second)
}
}()
Expand Down

0 comments on commit c61ee5c

Please sign in to comment.