[FFmpeg-user] Converting a video to a set of images from specific frames while cropping each frame differently

Matt Groth mgroth49 at gmail.com
Mon Jun 5 18:04:08 EEST 2023


Thanks for the responses.

The reason I’m eager to do it all in ffmpeg is because I am assuming that it would be most performant to both filter and crop the frames while they are held in memory before writing to any files. I understand that there are many ways I could break this down into multiple steps if I am writing intermediate steps to files. For example, I could just use select in ffmpeg but then do the cropping after with another tool such as imagemagick. However, then there is lots of excessive IO with the filesystem.

If it cannot be done purely within ffmpeg, I wonder if there is any way this can be done with piping? I’m assuming piping a full PNG to another program to crop is faster than writing it to a file and then reading it. Would it boost performance if somehow the PNGs were piped directly into a program like imagemagick? Does anyone know what this command might look like?


> On Jun 5, 2023, at 3:06 AM, MediaMouth <communque at gmail.com> wrote:
> 
> 
> 
>> On Jun 4, 2023, at 23:58, Michael Koch <astroelectronic at t-online.de> wrote:
>> 
>> Am 05.06.2023 um 00:35 schrieb Matt Groth:
>>> 2) Am I facing an XY issue? Is there a more elegant/performant way to apply a separate crop per frame (while excluding some frames altogether) when there are thousands of such frames per video?
>> 
>> The crop filter supports commands. That means you can write all the x and y values in a file and the use sendcmd to send these values to the crop filter.
>> The problem is how to select the frames, because the select filter doesn't support commands. I have no idea for this part.
>> 
>> Michael
> 
> Maybe consider FFmpeg to create the image files, Sips or Imagemagick to do the cropping?
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list