Files
VidEnc/roadmap.md
T
2025-07-01 23:01:39 +03:00

4.9 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:

  1. Centralize Encoding Settings:

    • Create a new Pydantic model, EncodingSettings, in a new file src/models/settings.py.
    • This model will consolidate all encoding-related parameters (preset, crf, film_grain, etc.) that are currently passed individually into the main function in app.py.
    • The main function will be updated to create an instance of this model.
  2. Refactor IMDb Search:

    • Create a Pydantic model, IMDbSearchResult, to represent a single search result (e.g., with title, year, imdb_id).
    • Modify the search_imdb function in src/lib/movie_details.py to no longer print to the console. Instead, it will return a list of IMDbSearchResult objects.
    • The interactive selection logic will be handled separately in app.py after calling the refactored search_imdb.
  3. Implement Template-Based Command Generation:

    • Add Jinja2 as a project dependency in pyproject.toml.
    • Create a new directory src/templates/.
    • Create a template file, ffmpeg_command.sh.j2, inside this directory. This template will contain the full structure of the ffmpeg command, using Jinja2 syntax for loops, conditionals, and variables.
    • Create a new function (e.g., generate_ffmpeg_command) that takes the necessary data models (VideoDetails, EncodingSettings) as input.
    • This function will be responsible for loading the Jinja2 template, rendering it with the provided data, and returning the final command string.
    • The VideoDetails.cmd() method will be removed and replaced with a call to this new function.

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).
  • ffprobe and ffmpeg command 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 ffmpeg command 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_sub streams using tools like mkvextract and vobsub2srt.
  • Researching and implementing a solution for the more complex pgs subtitle 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.


This roadmap will be updated as development progresses.