## Development Plan: Video Converter

This document outlines the development plan for the Video Converter project, aiming to create a standalone Python tool for converting video files into DaVinci Resolve compatible formats.

### Overall Goal
Develop a user-friendly, standalone Python tool to convert video files into formats compatible with Davinci Resolve (Free edition on Linux) to improve editing workflows for content creators.

### Completed Features

*   **Core Conversion Logic:** Implemented video conversion using `ffmpeg` with `dnxhd` codec and `pcm_s16le` audio, outputting to `.mov` container.
*   **Quality Profile Picker:** Added `--quality` argument (low, medium, high, archive) to control `dnxhd` profiles.
*   **Filename Fail-safe:** Implemented logic to append `_1`, `_2`, etc., to output filenames if a file with the same name already exists.
*   **`yt-dlp` Integration:** Added `--url` argument to download videos from YouTube (and other supported sites) using `yt-dlp` before conversion.
*   **PyInstaller Bundling:** Successfully bundled the application into a standalone executable for Linux.
*   **Robust Download Path Handling:** Ensured `yt-dlp` downloads directly to the user-specified output directory (or current working directory if not specified), resolving `os.path.exists()` issues within the PyInstaller environment.
*   **Basic Error Handling & Logging:** Suppressed verbose `yt-dlp` output and redirected `ffmpeg` output to `ffmpeg_output.log` for detailed error inspection.

### Current Priorities (Next Steps)

1.  **Implement GUI:** Develop a graphical user interface for easier interaction, including file selection, quality profile choice, and URL input. (High Priority)
2.  **Implement Browser Cookies for YouTube Authorization:** Revisit and implement `--cookies-from-browser` functionality for `yt-dlp` to handle age-restricted or private YouTube videos. (Deferred, now higher priority)
3.  **Refine Error Handling/Logging:** Implement more user-friendly error messages, potentially displaying the last few lines of the log file directly in the console upon failure, and providing clear instructions to check the full log.

### Future Considerations

*   **Twitch Integration Strategy:**
    *   **URL Support:** Extend the URL handling to explicitly support Twitch video, single clip, and clip collection URLs.
    *   **Single Video/Clip Downloads:** Leverage `yt-dlp`'s existing capabilities to download single Twitch videos and clips. This should work with the current implementation.
    *   **Clip Collection Downloads (Batch Processing):** For Twitch clip collection URLs, `yt-dlp` will download all clips in the collection. This will require implementing batch processing capabilities (which is already a future consideration) to handle multiple downloaded files. The application will need to iterate through each downloaded clip and convert it individually.
*   **Batch Processing:** Allow conversion of multiple files or URLs in a single run.
*   **Configuration File:** Implement a configuration file (e.g., YAML, JSON) for persistent settings.
*   **Progress Bar:** Integrate a progress bar for both download and conversion processes.
*   **Cross-Platform Compatibility:** Explore bundling for Windows and macOS. (Lowest priority)
*   **Advanced `ffmpeg` Options:** Expose more `ffmpeg` options (e.g., bitrate, resolution scaling) for advanced users.
*   **Metadata Preservation:** Option to preserve or transfer metadata from the original file.

### Known Issues / Limitations

*   DaVinci Resolve Free on Linux has limitations with certain audio codecs (e.g., AAC) and 4K output/encoding (requires Studio version).
*   `ffmpeg-full` AUR package is required for `dnxhd` support on Arch-based systems.

### Large scale implementations
Since one of the limitations of this project is the requirement of ffmpeg-full for encoding videos for Davinci Resolve use we should investigate the proposition of implementing the necessary ffmpeg-full into the project release file.
I do not know, currently if this is viable or even possible. But I think that a fully precompiled program with built in encoders and tools would be more attractive to most users.
We should also see if there are other tools that would be considered natural for this project.
