Piping raw []byte video to ffmpeg - Go

I need a single frame of the video and convert it to a png. This is how someone would do it with ffmpeg.

There is a popular go library that is exactly made for what you search for: https://github.com/bakape/thumbnailer

thumbnailDimensions := thumbnailer.Dims{Width: 320, Height: 130}

thumbnailOptions := thumbnailer.Options{JPEGQuality:100, MaxSourceDims:thumbnailer.Dims{}, ThumbDims:thumbnailDimensions, AcceptedMimeTypes: nil}

sourceData, thumbnail, err := thumbnailer.ProcessBuffer(videoData, thumbnailOptions)

imageBytes := thumbnail.Image.Data

They use ffmpeg under the hood, but removes the abstraction for you.

Tags:

Ffmpeg

Go