How sasa97a/videofy works
1. Overall shape
- This is a cross-platform Avalonia .NET 8 desktop app built around an MVVM layout.
- The application is a GUI front-end for FFmpeg/FFprobe, not a codec implementation itself. All actual media processing happens in external binaries.
2. Startup and composition
- Program.cs and App.axaml(.cs) boot the Avalonia host.
- DependencyService is the central composition point for app services and viewmodels.
- ViewLocator maps viewmodels to their corresponding views, which is the main navigation/binding boundary in the UI layer.
3. UI layer
- The Views/ folder contains the main windows and feature screens:
- MainWindow
- CompressionView
- ConversionView
- SplitView
- SettingsWindow
- RenameWindow
- LogWindow
- FileSettingsControl
- These views represent the user-facing workflow for selecting videos, configuring output, reviewing logs, and running batch operations.
4. ViewModel layer
- MainWindowViewModel is the likely orchestration hub for the main workflow.
- SettingsViewModel, RenameViewModel, and TimeCodeViewModel model the settings, naming, and trim/time-entry parts of the UI.
- ViewModelBase provides shared notification/binding behavior typical of MVVM.
- The ViewModels are the main bridge between user actions and the backend services.
5. Domain models
- Models/VideoFile.cs is the core domain object representing an input video and its processing state.
- The partial model files VideoFile.Progress.cs and VideoFile.Trimming.cs suggest the file model is split into concerns for encode progress and trim segments.
- Models/AppSettings.cs stores persisted configuration for the application.
- These models are the data contracts shared between UI, settings, and processing services.
6. Processing pipeline
- FfmpegService is the encoder/processor wrapper that builds and runs FFmpeg commands for compression/conversion.
- FfprobeService is responsible for reading source metadata such as stream info, duration, and resolution.
- CompressionView, ConversionView, and SplitView likely feed into this pipeline with different processing modes or output behaviors.
- The architecture is: user selects files → metadata is probed → settings are applied → FFmpeg runs → progress is surfaced back to the UI.
7. File and system boundaries
- FileService handles filesystem interactions such as path handling, file discovery, and likely output/file-name operations.
- AppPathService centralizes application-specific directories, including the internal FFmpeg location mentioned in the README.
- SystemUtilityService likely encapsulates OS-specific checks and environment/path logic, which is important for the cross-platform boundary.
8. Settings, messaging, and logging
- SettingsService persists and reloads AppSettings.
- MessageService abstracts user notifications/dialog prompts so ViewModels do not talk directly to window code.
- LogService captures operational output and error reporting, feeding the LogWindow and helping diagnose FFmpeg setup or encode failures.
- These services keep UI concerns separate from state persistence and diagnostics.
9. Dependency and runtime guard
- The README indicates a startup dependency guard for FFmpeg/FFprobe binaries.
- That guard is part of the app’s architecture because the app cannot function without user-supplied FFmpeg tools.
- This makes the external binary directory an important deployment/runtime boundary distinct from the managed .NET application.
10. Custom controls and converters
- Controls/TimeSegmentControl.cs is a reusable UI component for time-based trimming or segment selection.
- Converters/BoolConverters.cs and TimeSpanToSecondsConverter.cs support binding transformations in the Avalonia UI.
- These pieces reduce logic in the views and keep formatting/state conversion local to the presentation layer.
11. Feature-level flow
- The core workflow appears to be:
1. load one or more video files,
2. inspect them with FFprobe,
3. let the user choose compression/resolution/trimming settings,
4. invoke FFmpeg,
5. track progress and log output,
6. optionally rename or split outputs.
- Batch processing is a key architectural concern, so the app is organized around processing multiple VideoFile items rather than a single file.
12. External dependencies and constraints
- The app depends on a user-provided GPL FFmpeg build with ffmpeg and ffprobe binaries placed in a specific internal directory.
- The README notes that the app supports Windows and Linux, with macOS code support but no official builds.
- Those constraints strongly influence startup validation, path management, and process execution design.
13. What to draw in an architecture diagram
- Draw three major layers:
- Presentation: Avalonia views, controls, converters
- Application/State: ViewModels, models, settings, logging/message abstractions
- Infrastructure: file/path/system services plus FFmpeg/FFprobe process wrappers
- Show FFmpeg/FFprobe as an external executable dependency outside the app boundary.
- Show settings persistence and log output as cross-cutting services connected to the ViewModels and UI.
Main entry points: MainWindowViewModel.cs Main VM · ViewLocator.cs View locator · DependencyService.cs DI service · TimeCodeViewModel.cs Timecode VM
Components 31
Presentation
Avalonia host, windows, reusable controls, and binding helpers.
- Program · Entry point that boots the Avalonia application.
Video Size Optimizer/Program.cs - App · Application host and lifetime wiring.
Video Size Optimizer/App.axaml - App code · Application initialization and startup behavior.
Video Size Optimizer/App.axaml.cs - View locator · Maps ViewModels to their corresponding Views.
Video Size Optimizer/ViewLocator.cs - Main window · Primary shell for file selection and batch processing.
Video Size Optimizer/Views/MainWindow.axaml - Compress UI · Compression workflow screen.
Video Size Optimizer/Views/CompressionView.axaml - Convert UI · Conversion workflow screen.
Video Size Optimizer/Views/ConversionView.axaml - Split UI · Split and segment workflow screen.
Video Size Optimizer/Views/SplitView.axaml - Settings UI · Application settings window.
Video Size Optimizer/Views/SettingsWindow.axaml - Rename UI · Output naming workflow window.
Video Size Optimizer/Views/RenameWindow.axaml - Log UI · Operational log window.
Video Size Optimizer/Views/LogWindow.axaml - File settings · Reusable file configuration control.
Video Size Optimizer/Views/FileSettingsControl.axaml - Time segment · Reusable trim/segment selector control.
Video Size Optimizer/Controls/TimeSegmentControl.cs - Converters · Avalonia value converters for UI binding transformations.
Video Size Optimizer/Converters/BoolConverters.cs
Application / State
ViewModels, domain models, and shared app state.
- Main VM · Coordinates the main workflow across files, settings, and processing.
Video Size Optimizer/ViewModels/MainWindowViewModel.cs - Settings VM · Models user-adjustable application settings.
Video Size Optimizer/ViewModels/SettingsViewModel.cs - Rename VM · Handles output naming and rename behavior.
Video Size Optimizer/ViewModels/RenameViewModel.cs - Timecode VM · Supports timecode and trim input logic.
Video Size Optimizer/ViewModels/TimeCodeViewModel.cs - VM base · Shared notification and binding behavior for ViewModels.
Video Size Optimizer/ViewModels/ViewModelBase.cs - Video file · Core input/output media item and its processing state.
Video Size Optimizer/Models/VideoFile.cs - App settings · Persisted application configuration.
Video Size Optimizer/Models/AppSettings.cs
Infrastructure
Filesystem, settings, logging, messaging, and process-facing services.
- DI service · Central registration point for services and ViewModels.
Video Size Optimizer/Services/DependencyService.cs - FFmpeg service · Builds and runs FFmpeg commands for compression, conversion, and splitting.
Video Size Optimizer/Services/FfmpegService.cs - FFprobe service · Reads source media metadata such as duration and streams.
Video Size Optimizer/Services/FfprobeService.cs - File service · Handles path, discovery, and file operations.
Video Size Optimizer/Services/FileService.cs - App paths · Centralizes app-specific directories and binary locations.
Video Size Optimizer/Services/AppPathService.cs - System utility · Encapsulates OS and environment-specific logic.
Video Size Optimizer/Services/SystemUtilityService.cs - Settings service · Loads and saves application settings.
Video Size Optimizer/Services/SettingsService.cs - Message service · Abstracts user prompts and notifications away from window code.
Video Size Optimizer/Services/MessageService.cs - Log service · Captures operational output and errors for the UI.
Video Size Optimizer/Services/LogService.cs
External Runtime
Required FFmpeg/FFprobe executables outside the managed app boundary.
- FFmpeg/FFprobe · User-provided binaries required at runtime and guarded at startup.
Connections 34
- Program → App: starts · Program boots the Avalonia host.
- App → App code: initializes · Application startup and lifetime wiring.
- App code → DI service: composes · Registers services and ViewModels.
- DI service → Main VM: creates · Resolves the main workflow ViewModel.
- DI service → Settings VM: creates · Resolves settings state.
- DI service → Rename VM: creates · Resolves rename workflow state.
- DI service → Timecode VM: creates · Resolves trim/timecode state.
- View locator → Main window: binds · Maps ViewModel to the main window view.
- View locator → Compress UI: binds · Maps ViewModel to compression screen.
- View locator → Convert UI: binds · Maps ViewModel to conversion screen.
- View locator → Split UI: binds · Maps ViewModel to split screen.
- View locator → Settings UI: binds · Maps ViewModel to settings window.
- View locator → Rename UI: binds · Maps ViewModel to rename window.
- View locator → Log UI: binds · Maps ViewModel to log window.
- Main VM → Video file: manages · Orchestrates the file processing state.
- Main VM → FFprobe service: probes · Reads media metadata before processing.
- Main VM → FFmpeg service: runs · Invokes encode/convert/split operations.
- Main VM → File service: uses · Handles file selection and output paths.
- Main VM → Settings service: reads/writes · Consumes persisted configuration.
- Main VM → Message service: notifies · Shows prompts and status to the user.
- Main VM → Log service: logs · Streams operational messages to the log system.
- Settings VM → App settings: edits · Binds the settings UI to persisted app state.
- Rename VM → File service: renames · Builds output naming and path logic.
- Timecode VM → Video file: annotates · Manages trim and segment metadata.
- Time segment → Timecode VM: binds · Reusable trim UI bound to time entry logic.
- File settings → Main VM: controls · Embeds file-specific configuration in the main workflow.
- Converters → Main window: supports · Binding transformations used throughout the presentation layer.
- App paths → FFmpeg/FFprobe: locates · Points to the internal binary directory.
- System utility → App paths: informs · Platform checks influence path and runtime behavior.
- Settings service → App settings: persists · Saves and loads application configuration.
- FFprobe service → FFmpeg/FFprobe: executes · Depends on external ffprobe binary.
- FFmpeg service → FFmpeg/FFprobe: executes · Depends on external ffmpeg binary.
- Log service → Log UI: feeds · Supplies operational output to the log UI.
- Message service → Main VM: supports · Enables user prompts without direct window coupling.