Move to alpine edge for ffmpeg 6
This commit is contained in:
parent
bf3bd35fdb
commit
3d3d93b687
|
@ -5,13 +5,14 @@ RUN go mod download -x
|
|||
COPY cmd ./cmd/
|
||||
RUN go install ./...
|
||||
|
||||
FROM alpine AS runtime
|
||||
FROM alpine:edge AS runtime
|
||||
WORKDIR /target
|
||||
COPY web web
|
||||
COPY --from=build /go/bin/ .
|
||||
|
||||
FROM alpine
|
||||
RUN apk --no-cache add ffmpeg ffprobe
|
||||
# Alpine edge has ffmpeg 6 with jpeg rotation bugfix
|
||||
FROM alpine:edge
|
||||
RUN apk --no-cache add ffmpeg
|
||||
COPY --from=runtime /target /
|
||||
WORKDIR /web
|
||||
ENTRYPOINT ["/webfs"]
|
||||
|
|
|
@ -61,7 +61,8 @@ func (h *Handler) makeThumbnail(reqPath, thumbnailPath string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
isVideo := ffdata.Format.DurationSeconds > 0.0
|
||||
isVideo := ffdata.Format.DurationSeconds > 1.0
|
||||
skipSeconds := ffdata.Format.StartTimeSeconds + (ffdata.Format.DurationSeconds * 0.25)
|
||||
|
||||
// Build up ffmpeg invocation
|
||||
// XXX: some day soon you will want CommandContext
|
||||
|
@ -70,19 +71,20 @@ func (h *Handler) makeThumbnail(reqPath, thumbnailPath string) error {
|
|||
cmd.Stderr = os.Stderr
|
||||
|
||||
if isVideo {
|
||||
skipSeconds := ffdata.Format.StartTimeSeconds + (ffdata.Format.DurationSeconds * 0.25)
|
||||
cmd.Args = append(cmd.Args,
|
||||
"-ss", fmt.Sprintf("%f", skipSeconds),
|
||||
"-i", srcPath,
|
||||
"-frames:v", "5",
|
||||
"-filter:v", h.filterVideo+",fps=2",
|
||||
"-loop", "0",
|
||||
"-map_metadata", "0",
|
||||
thumbnailPath,
|
||||
)
|
||||
} else {
|
||||
cmd.Args = append(cmd.Args,
|
||||
"-i", srcPath,
|
||||
"-filter:v", h.filterVideo,
|
||||
"-map_metadata", "0",
|
||||
thumbnailPath,
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue