-
Notifications
You must be signed in to change notification settings - Fork 107
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
Convert go_router assets to gif #232
Conversation
bin/generate.dart
Outdated
@@ -301,7 +302,10 @@ class DiagramGenerator { | |||
// Almost lossless quality (can't use lossless '0' because Safari | |||
// doesn't support it). | |||
'-crf', '1', | |||
'-c:v', 'libx264', // encode to mp4 H.264 | |||
if (metadata.videoFormat == VideoFormat.mp4) |
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.
When I convert video to GIF, it helps a lot to generate a palette file first so that the palette for the GIF is optimal.
I do this by:
ffmpeg -i "$input" -vf "fps=$fps,scale=$width:-1:flags=lanczos,palettegen" "$palette"
Which generates a temporary palette file in $palette
.
Then I supply this to the actual creation of the video:
ffmpeg -i "$input" -i "$palette" -filter_complex "fps=$fps,scale=$width:-1:flags=lanczos[x];[x][1:v]paletteuse" "$output";
The difference is really noticeable (I just converted your mp4 file here):
You might want to add that as an extra step (to generate the palette).
// This can be useful if one job relies on the product of another job. | ||
// TODO(chunhtai): figure out how to `join` WorkJob[s] so that this iteration | ||
// logic is not needed. | ||
final Map<int, List<WorkerJob>> jobs = <int, List<WorkerJob>>{}; |
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.
Not sure if there is a better way to make one workerJob to wait for another since the ProcessPool runs everything in parallel.
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.
Yeah, there's not a good solution to this at the moment. I'll see if I can add something like that to process_runner
.
How about this: google/process_runner#35
@@ -65,7 +65,7 @@ void main() { | |||
temporaryDirectory.path, | |||
], | |||
workingDirectory: path.join( | |||
DiagramGenerator.projectDir, 'utils', 'diagram_generator'), | |||
DiagramGenerator.projectDir, 'packages', 'diagram_generator'), |
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 test hasn't been run for a while it seems
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.
Oh, wow, yeah. Looks like the bin/ tests weren't being run.
Here's a PR for that (and this fix): #234
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 already enabled the test in this pr.
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.
Oh, I didn't notice that part. OK. I'll just close my PR.
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.
Co-authored-by: Greg Spencer <[email protected]>
auto label is removed for flutter/assets-for-api-docs/232, Failed to merge flutter/assets-for-api-docs/232 with Pull request flutter/assets-for-api-docs/232 could not be merged: 2 of 2 required status checks are expected.. |
auto label is removed for flutter/assets-for-api-docs/232, Failed to merge flutter/assets-for-api-docs/232 with Pull request flutter/assets-for-api-docs/232 could not be merged: 2 of 2 required status checks are expected.. |
Also added the feature to output gif
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.