diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-05-15 03:46:16 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-05-15 03:46:16 +0200 |
commit | 36ad9ceddc79d262e55f713e2a6eb39e04a790aa (patch) | |
tree | ce7905da45259da77139a295fdbd5bc5224678b0 | |
parent | 442c8cdeffac21482540aeecefb9e7564166e681 (diff) |
-rw-r--r-- | src/main.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index 12ac8eb..d5bc28d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,6 +5,7 @@ int main() { const int fps = 24; + const float playtime_sec = 1.78f; sf::Texture texture; if(!texture.loadFromFile("flag.png")) @@ -13,7 +14,7 @@ int main() { texture.setSmooth(true); sf::Vector2u window_size = texture.getSize(); - sf::RenderWindow window(sf::VideoMode(window_size.x, window_size.y), "SFML works!", 0, sf::ContextSettings(0, 0, 4)); + sf::RenderWindow window(sf::VideoMode(window_size.x, window_size.y), "flag-maker", 0, sf::ContextSettings(0, 0, 4)); window.setVerticalSyncEnabled(false); window.setFramerateLimit(0); @@ -65,7 +66,6 @@ int main() { sf::Image output_image; output_image.create(flag_width, flag_height, sf::Color::Transparent); - const float playtime_sec = 1.78f; const float frame_time = 1000.0 / (double)fps / 1000.0; double elapsed_frame_time = 0.0; @@ -96,7 +96,10 @@ int main() { window.close(); running = false; work_thread.join(); - system("ffmpeg -i \"frames/%d.png\" -framerate 24 -filter_complex \"fps=24,split=2[palette_in][gif];[palette_in]palettegen[palette_out];[gif]fifo[gif_fifo]; [gif_fifo][palette_out]paletteuse\" -y output.gif"); + + char command[256]; + snprintf(command, sizeof(command), "ffmpeg -i \"frames/%%d.png\" -framerate %d -filter_complex \"fps=%d,split=2[palette_in][gif];[palette_in]palettegen[palette_out];[gif]fifo[gif_fifo]; [gif_fifo][palette_out]paletteuse\" -y output.gif", fps, fps); + system(command); system("rm -rf frames"); return 0; |