


I don't have a CLI for that so just copy-paste it manually. One more thing before we can encode the video: the data for the last frame needs to be present in the concat file twice for some reason. We saved the concat file to where the input files are located because otherwise FFmpeg won't accept it.

filenames.txt frametimes.txt > folder/concatfile.txt Ls -quoting-style=shell folder/ >filenames.txt & sed -i -e 's/^/file /' filenames.txtĬombine your frame-time file and filenames file to a concat file that FFmpeg accepts: Print a list of your input files (frames) located in folder/ and modify the list to be the format FFmpeg's concat filter requires: Sed 's/pkt_duration_time=/duration /g' frametimes.txt >frametimes.txt Modify the line to the format that FFmpeg's concat filter requires: Print pkt_duration_time line and save it into a file:įfprobe -show_frames input.gif | grep pkt_duration_time= >frames.txt If you think you could script this, please do so, test it, and then post it as a new answer. I tried to do more of the process as one-liners but it always turned into a non-functional, undebuggable mess. Thanks to Gyan for pointing me in the right direction.

It took me quite a while of Googling and trial-and-error but I finally figured out how to actually do this. Is there a way to do this with FFmpeg or maybe a combination of FFprobe and FFmpeg? I ran the GIF through ffprobe -show_frames and it would seem that the information I need is pkt_duration_time which shows the duration the frame is displayed. So just generating a video with a set frame rate isn't going to work as that would break the flow of the animation I need a way import the frame duration data from the original GIF file and encode the extracted, modified frames into a video using that data. The GIF format allows individual frames to be displayed for an artificial amount of time and this specific GIF animation makes use that feature, with most frames being displayed for 125 milliseconds but some remaining on the screen for as long as 3000 milliseconds. I have a set of images that I extracted from a GIF animation for the purpose of enhancement (which I have done), but now that it's time to convert the still images into a video (I'm going to use webm for higher quality output) I've run into a problem.
