go – ffmpeg via pipe: stream 1, offset 0x30: partial file

my videodata is dynamic it can use any exension but its error when i use mp4 extension.

my function:

func (s *service) convertVideo(videoData []byte) ([]byte, error) {
    var buffer bytes.Buffer
    cmd := exec.Command("ffmpeg",
        "-i", "pipe:0",
        "-c:v", "libvpx-vp9",
        "-b:v", "0",
        "-f", "webm",
        "-t", "8",
        "-preset", "ultrafast",
        "pipe:1")
    cmd.Stdin = bytes.NewReader(videoData)
    cmd.Stdout = &buffer
    err := cmd.Run()
    if err != nil {
        return nil, err
    }
    return buffer.Bytes(), nil
}

and got error:

stream 1, offset 0x30: partial file

is it because i use stream pipe? becuase if i use temp file its success, but its not that effective

Read more here: Source link