11/8/2022 0 Comments Ffmpeg gif second per frame![]() ![]() Let me know if there’s anything I can explain in more detail, but don’t ask me for help installing things, just google it! Then, ok, I copy pasted the rest of it, but I’m happy enough with what this produces that I’ll stop asking questions □ This uses our .MOV as an input but has a second -i flag to use palette.png as a 2nd input. filter_complex “fps=15,scale=400:-1:flags=lanczos paletteuse” sixthtry.gif So that generates palette.png which we can use in our 2nd line in terminal (by the way, the backslash at the end of the line is if you run out of space and need to keep typing, hit backslash and return and you can keep going on a new line before hitting return to complete the command.) ffmpeg -ss 2.6 -t 1.3 -i MVI_7035.MOV -i palette.png But the flags describe what algorithm to use, more info in that blog. You should recognize what -ss, -t, and -i do here, -vf is a way to invoke filters on our video. We have to generate a custom color palette so we don’t waste space storing colors we don’t use (the gif file format is limited to 256 colors): ffmpeg -ss 2.6 -t 1.3 -i MVI_7035.MOV -vf fps=15,scale=320:-1:flags=lanczos,palettegen palette.png Learned a lot from this blog about the color palette algorithms.įound a relatively simple example on stackoverflow. Ffmpeg gif second per frame how to#Let’s find out how to make it look more like a video… This has been pretty simple, but I know I’ve seen better looking gifs. If you have a longer video and want to define the starting position in hours, minutes, seconds, you can use “hh:mm:ss” format, like “00:00:03” instead of “3” ffmpeg -t 3 -ss 0.5 -i MVI_6663.MOV -r “15” fourthtry.gif ![]() Oh yeah, and your seconds can be decimals. I’ve got another one to convert that has kind of a long input video, so I’m going to specify a time to start the gif as well as the duration. As an added benefit, the file is now 2 megabytes instead of 8 megabytes. t is used before the -i input, -r is used after the input, so it affects the output.) ffmpeg -t 2 -i MVI_6654.MOV -r “15” thirdtry.gif Thanks to the -r flag, we can choose a frame rate for the output (note that these options do different things based on their order. So it loops! kinda slow tho, maybe we can drop every other frame? A-ha. ffmpeg -t 2 -i MVI_6654.MOV secondtry.gif But I bet I can make it loop nicely by just using the first few seconds, so we use the duration flag, -t and specify the duration in seconds. the filename at the end defines the conversion and creates the new file, resulting in: We’re calling the ffmpeg program and telling it that MVI_6654.MOV is our input file with the -i flag. After getting FFMPEG installed, let’s try it out on a MOV downloaded from my google photos account: ffmpeg -i MVI_6654.MOV firsttry.gif ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |