diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 5f31427..78e3221 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -63,6 +63,8 @@ int main() { sf::Image output_image; output_image.create(flag_width, flag_height, sf::Color::Transparent); + const float playtime_sec = 2.0f; + sf::Clock timer; while (window.isOpen()) { sf::Event event; @@ -82,11 +84,15 @@ int main() { output_image.copy(image, 0, 0, sf::IntRect(flag_start_x, flag_start_y, flag_width, flag_height), false); std::lock_guard<std::mutex> lock(images_lock); pending_frames.push_back(output_image); + + if(timer.getElapsedTime().asSeconds() >= playtime_sec) + break; } 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 frames/output.gif"); + 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"); + system("rm -rf frames"); return 0; }
\ No newline at end of file |