This article discusses about golang wrapper for ffmpeg for extracting frames from video.
FFmpeg is a great software package a media developer should have. The kind of configurability this provides is uncomparable in media domain. Out of vast capabilities, this article discusses how one can extract frames from video.
- The key idea in extracting the frames using ffmpeg involves specifiying the output file name. Here, we need to specify the filename with extendable naming pattern like
%04d. This will extend the naming from
- Next we need to specify the rate at which these frames to be generated. We use video filters available with ffmpeg. The filter we use is
Below is the sample command to extract the frames.
ffmpeg -i <input file> -vf fps=3 <out-dir>/frame%04d.jpg
For using the ffmpeg frame extraction programmatically, we need to write one wrapper. I chose
Go as I want to put this in AWS Lambda Function with extra functionalities. (Will write about that later).
The complete usage is available here.