Open JamesLMilner opened 2 years ago
Hey! Firstly, thanks for the great project.
I am noticing an issue with odd shaped gifs :
[11ty] Problem writing Eleventy templates: (more in DEBUG output) [11ty] > Having trouble writing template: _site/posts/cancelling-requests/index.html `TemplateWriterWriteError` was thrown [11ty] > Failed executing '/home/james/Code/jameslmilner.com-11ty/node_modules/ffmpeg-static/ffmpeg' -y -v error -i '_site/img/posts/abort/abortable-fetch.gif' -filter_complex '[0:v] fps=15, scale=iw:-2' -vsync 0 -f mp4 -pix_fmt yuv420p '_site/img/posts/abort/abortable-fetch.mp4' with [libx264 @ 0x6970fc0] width not divisible by 2 (1203x492) Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height `Error` was thrown: [11ty] Error: Failed executing '/home/james/Code/jameslmilner.com-11ty/node_modules/ffmpeg-static/ffmpeg' -y -v error -i '_site/img/posts/abort/abortable-fetch.gif' -filter_complex '[0:v] fps=15, scale=iw:-2' -vsync 0 -f mp4 -pix_fmt yuv420p '_site/img/posts/abort/abortable-fetch.mp4' with [libx264 @ 0x6970fc0] width not divisible by 2 (1203x492) Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
If I change
https://github.com/google/eleventy-high-performance-blog/blob/fd0dcd858935acd57c44e91adf4a8313fd812bb8/_11ty/video-gif.js#L44
to:
"[0:v] fps=15, scale=trunc(iw/2)*2:trunc(ih/2)*2",
It removes the errors, but I think that doesn't perform any scaling as was originally intended. I could look at the correct rounding logic to figure out how to keep the -2 scaling and raise a PR if it would be helpful. Let me know!
Hey! Firstly, thanks for the great project.
I am noticing an issue with odd shaped gifs :
If I change
https://github.com/google/eleventy-high-performance-blog/blob/fd0dcd858935acd57c44e91adf4a8313fd812bb8/_11ty/video-gif.js#L44
to:
It removes the errors, but I think that doesn't perform any scaling as was originally intended. I could look at the correct rounding logic to figure out how to keep the -2 scaling and raise a PR if it would be helpful. Let me know!