5.1 KiB
Development Roadmap
This document outlines the planned development steps for the VidEnc application.
Phase 1: Code Refactoring
The first priority is to refactor the existing codebase to improve its structure, maintainability, and readability. This will provide a solid foundation for future feature development.
Detailed Plan for Phase 1
This phase will be broken down into the following steps:
-
Centralize Encoding Settings:
- Create
EncodingSettingsModel: In a new file,src/models/settings.py, create a new Pydantic model namedEncodingSettings. - Define Fields: This model will have the following fields, corresponding to the Typer options in
app.py:preset: intcrf: intoriginal_media_type: OriginalMediaTypefilm_grain: int
- Integrate into
app.py:- In the
mainfunction, create an instance ofEncodingSettingsby passing the values from the Typer options. - The
apply_stream_settingsfunction will be updated to accept thisEncodingSettingsobject instead of individual parameters, simplifying its signature.
- In the
- Create
-
Refactor IMDb Search:
- Create a Pydantic model,
IMDbSearchResult, to represent a single search result (e.g., withtitle,year,imdb_id). - Modify the
search_imdbfunction insrc/lib/movie_details.pyto no longer print to the console. Instead, it will return a list ofIMDbSearchResultobjects. - The interactive selection logic will be handled separately in
app.pyafter calling the refactoredsearch_imdb.
- Create a Pydantic model,
-
[x] Implement Template-Based Command Generation: The
ffmpegcommand is now generated using a Jinja2 template, separating the command logic from the Python code.
Phase 2: Logging
Implement comprehensive logging using the loguru library. This will help with debugging and tracking the application's behavior during encoding jobs.
Phase 3: Configuration File
Introduce a configuration file managed by the pydantic-settings package. This will allow loading settings from a file (e.g., .env or config.toml) and environment variables, making the application more flexible and easier to configure for different users.
Phase 4: Enhanced Error Handling
Improve error handling throughout the application, especially for external interactions. This will make the application more robust and provide clearer feedback to the user when things go wrong. Key areas include:
- API interactions (e.g., invalid API keys, network errors, movies not found).
ffprobeandffmpegcommand execution failures.- File system operations (e.g., permission errors).
Phase 5: Encoding Profiles
Introduce encoding profiles (e.g., dvd, bluray, tvrip) to simplify the user experience. These profiles will map to pre-defined sets of encoding parameters (preset, crf, film_grain, etc.), allowing users to choose a quality target without needing to know the underlying ffmpeg settings.
Phase 6: Batch Processing
Implement a stateful batch processing system. This will involve creating a set of commands to manage an internal encoding queue:
- A command to process a video and add its generated
ffmpegcommand to the queue. - A command to write all queued commands into a single, consolidated shell script.
- Commands to view and clear the queue. This provides a more flexible and robust workflow for batch encoding.
Future Goals
Advanced Subtitle Handling
Implement a sophisticated subtitle processing pipeline to automatically convert bitmap-based subtitles (DVD VobSub, Blu-ray PGS) into the text-based SubRip (.srt) format. This is a significant research and development task that will be tackled after the initial roadmap is complete. It involves:
- Automating the OCR process for
dvd_substreams using tools likemkvextractandvobsub2srt. - Researching and implementing a solution for the more complex
pgssubtitle format, potentially using an OCR engine like Tesseract via a command-line tool.
Direct Execution
Add an option to execute the generated ffmpeg command directly from the application. This will require research into the best way to run and monitor long-running subprocesses in Python, providing real-time feedback and progress to the user.
GUI Development
Develop a graphical user interface (GUI) to make the application more accessible and user-friendly for a broader audience. This will be a significant undertaking and will be considered after the core CLI functionality is mature and stable. Research into the best GUI framework (e.g., Dear PyGui, CustomTkinter, PySide6) will be the first step.
Deinterlacing
A bwdif deinterlacing filter is currently hardcoded in the video processing pipeline as a temporary solution.
To-Do:
- Implement detection for interlaced video streams (e.g., by checking the
field_orderproperty fromffprobeoutput). - Apply the deinterlacing filter conditionally, only when interlaced content is detected, to avoid unnecessary processing on progressive sources.
This roadmap will be updated as development progresses.