Skip to content

Informative export process with accurate estimates #735

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

loveucifer
Copy link

This pull request significantly enhances the user experience of the video export process in the desktop editor. Previously, exporting a video provided no feedback, making the application appear unresponsive and providing inaccurate estimates for file size and export time.

This change introduces a real-time, event-driven progress system and a more robust, calculation-based estimation engine. The user is now presented with:

More reliable estimates for export time and file size.

A real-time progress bar and percentage indicator during the export.

A clear success message upon completion, including a convenient button to open the exported file directly.

Improved error handling and cancellation capabilities.

Key Changes

Refactored Estimation Logic (get_export_estimates):

The function no longer uses brittle, hardcoded "magic numbers" for different resolutions.

Size Estimation: It now calculates the video bitrate based on a quality factor per megapixel, adjusting for framerate. This provides a much more accurate file size estimate that scales correctly for any video dimension.

Time Estimation: It now estimates processing time based on the total pixels to be rendered per second, providing a more realistic forecast of the export duration.

Robust Progress Handling (export_video):

The on_progress callback passed to the exporter now checks if the IPC channel to the frontend is still open.

If the frontend closes (e.g., the user quits the app), the callback returns false, signaling the cap_export crate to gracefully cancel the ongoing export process. This prevents orphaned ffmpeg processes.

Reactive Frontend (Not included in this PR, but enabled by these changes):

The backend now provides all the necessary events (export_progress, export_finished) and accurate data for the frontend to build a rich, informative UI for the export dialog.

This pull request significantly enhances the user experience of the video export process in the desktop editor. Previously, exporting a video provided no feedback, making the application appear unresponsive and providing inaccurate estimates for file size and export time.

This change introduces a real-time, event-driven progress system and a more robust, calculation-based estimation engine. The user is now presented with:

More reliable estimates for export time and file size.

A real-time progress bar and percentage indicator during the export.

A clear success message upon completion, including a convenient button to open the exported file directly.

Improved error handling and cancellation capabilities.

Key Changes

Refactored Estimation Logic (get_export_estimates):

The function no longer uses brittle, hardcoded "magic numbers" for different resolutions.

Size Estimation: It now calculates the video bitrate based on a quality factor per megapixel, adjusting for framerate. This provides a much more accurate file size estimate that scales correctly for any video dimension.

Time Estimation: It now estimates processing time based on the total pixels to be rendered per second, providing a more realistic forecast of the export duration.

Robust Progress Handling (export_video):

The on_progress callback passed to the exporter now checks if the IPC channel to the frontend is still open.

If the frontend closes (e.g., the user quits the app), the callback returns false, signaling the cap_export crate to gracefully cancel the ongoing export process. This prevents orphaned ffmpeg processes.

Reactive Frontend (Not included in this PR, but enabled by these changes):

The backend now provides all the necessary events (export_progress, export_finished) and accurate data for the frontend to build a rich, informative UI for the export dialog.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant