-
-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for GIF looping in recorded video output #2891
Conversation
Adds the `loop` option to the `VideoStreamOptions` struct, and adds `loop` as a keyword argument to `VideoStream`, allowing control over the number of times a GIF is looped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty cool!
Is there a way to test that this works in tests? For example, if I try to set loop=2
and load it using ffmpeg, would I get 2x the frames and time?
@@ -58,11 +62,16 @@ struct VideoStreamOptions | |||
if format in ("mp4", "webm") | |||
(compression === nothing) && (compression = 20) | |||
end | |||
|
|||
if format == "gif" | |||
(loop === nothing) && (loop = 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(loop === nothing) && (loop = 0) | |
isnothing(loop) && (loop = 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to maintain consistency with the earlier lines of code by using ===
instead of isnothing
, but if you prefer it this way, happy to switch!
@asinghvi17 Unfortunately I don't think there's an easy way to check based on the number of frames, or length of the video, alone -- it looks like the loop count for animated GIFs is stored somewhere in the header of the file (see https://en.wikipedia.org/wiki/GIF#Animated_GIF) and I'm not sure how to use FFMPEG to look up that number. Maybe it's possible to just look at that byte number (31D) directly? |
Thanks! |
Description
Adds the
loop
option to theVideoStreamOptions
struct, and addsloop
as a keyword argument toVideoStream
, which is passed on to FFMPEG. This allows control over the number of times a GIF is looped for videos produced byrecord
.Type of change
Checklist