0

Hi I am using the following docker image:

FROM golang:alpine3.18

With ffmpeg: (probably here I am missing something)

RUN apk add --no-cache ffmpeg

However when trying to execute the following:

cmd := "ffmpeg -i Untitled.mp4 -vf \"fps=5,scale=320:-1:flags=lanczos\" -c:v pam -f image2pipe - | convert -delay 5 - -loop 0 -layers optimize test.gif"
_, err := exec.Command("bash", "-c", cmd).Output()
if err != nil {
    fmt.Println(fmt.Sprintf("Failed to execute command: %s", err))
}

I get this error:

  Failed to execute command: exit status 127
Eran
  • 1,628
  • 16
  • 31
  • Is ffmpeg in your path? – Nick ODell May 18 '23 at 14:49
  • @NickODell currently no , please advise on how to set ffmpeg in my path – Eran May 18 '23 at 15:09
  • https://stackoverflow.com/questions/27093612/in-a-dockerfile-how-to-update-path-environment-variable – Nick ODell May 18 '23 at 15:10
  • Assign os.Stderr (or a *bytes.Buffer) to Cmd.Stderr to see any errors reported by bash. Alternatively, inspect [`err.(*exec.ExitError).Stderr`](https://pkg.go.dev/os/exec#ExitError.Stderr) (which may be incomplete). – Peter May 19 '23 at 08:55

1 Answers1

0

It looks that you are converting the output of ffmpeg into an animated gif with using convert command. You need to install ImageMagic in your containers for this to work.

The convert command is a member of the ImageMagick suite of tools

Add this in your Docker file

RUN apk add --no-cache imagemagick

Reference :

PRATHEESH PC
  • 1,461
  • 1
  • 3
  • 15