diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 0000000..7e03ff1
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,41 @@
+{
+ "name": "DaVinci Video Converter",
+ "image": "docker.io/library/fedora:39",
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "ms-vscode.cpptools",
+ "ms-vscode.cmake-tools",
+ "twxs.cmake"
+ ],
+ "settings": {
+ "terminal.integrated.defaultProfile.linux": "bash",
+ "C_Cpp.default.compilerPath": "/usr/bin/g++",
+ "C_Cpp.default.cStandard": "gnu17",
+ "C_Cpp.default.cppStandard": "gnu++17"
+ }
+ }
+ },
+ "features": {
+ "ghcr.io/devcontainers/features/common-utils:2": {
+ "installZsh": true,
+ "configureZshAsDefaultShell": true,
+ "installOhMyZsh": true,
+ "upgradePackages": true,
+ "username": "vscode",
+ "userUid": "1000",
+ "userGid": "1000"
+ }
+ },
+ "postCreateCommand": "dnf install -y gcc-c++ make ffmpeg ffmpeg-devel && dnf clean all",
+ "remoteUser": "vscode",
+ "updateRemoteUserUID": true,
+ "mounts": [
+ "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached"
+ ],
+ "runArgs": [
+ "--cap-add=SYS_PTRACE",
+ "--security-opt",
+ "seccomp=unconfined"
+ ]
+}
diff --git a/Makefile b/Makefile
index a652c86..78fd315 100644
--- a/Makefile
+++ b/Makefile
@@ -1,52 +1,38 @@
-#
-# 'make' build executable file 'davinci-convert'
-# 'make clean' removes all .o and executable files
-#
-
-# Define the C++ compiler to use
CXX = g++
+CXXFLAGS = -std=c++17 -Wall -Wextra -O2
+INCLUDES = -Isrc/include
+TARGET = davinci-video-converter
-# Define any compile-time flags
-CXXFLAGS = -std=c++17 -Wall -Wextra -g
+SRCS = src/main.cpp src/parser.cpp src/validator.cpp src/converter.cpp
+OBJS = $(SRCS:.cpp=.o)
-# Define output directory
-OUTPUT = output
+all: $(TARGET)
-# Define source directory
-SRC = src
+$(TARGET): $(OBJS)
+ $(CXX) $(CXXFLAGS) -o $(TARGET) $(OBJS)
-# Define the main executable name
-MAIN = davinci-convert
+src/%.o: src/%.cpp
+ $(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
-# Define the C source files
-SOURCES = $(wildcard $(SRC)/*.cpp)
+src/main.o: src/main.cpp src/include/config.hpp src/include/parser.hpp src/include/validator.hpp src/include/converter.hpp
+src/parser.o: src/parser.cpp src/include/parser.hpp src/include/config.hpp
+src/validator.o: src/validator.cpp src/include/validator.hpp src/include/config.hpp
+src/converter.o: src/converter.cpp src/include/converter.hpp src/include/config.hpp
-# Define the C object files
-OBJECTS = $(SOURCES:.cpp=.o)
-
-OUTPUTMAIN = $(OUTPUT)/$(MAIN)
-
-all: $(OUTPUT) $(OUTPUTMAIN)
- @echo "Building executable: $(MAIN)"
- @echo Executing 'all' complete!
-
-$(OUTPUT):
- mkdir -p $(OUTPUT)
-
-$(OUTPUTMAIN): $(OBJECTS)
- $(CXX) $(CXXFLAGS) -o $(OUTPUTMAIN) $(OBJECTS)
-
-.PHONY: clean
clean:
- @echo "Cleaning up..."
- rm -f $(OUTPUTMAIN)
- rm -f $(OBJECTS)
- @echo Cleanup complete!
+ rm -f $(TARGET) $(OBJS)
-run: all
- @echo "Running executable: $(OUTPUTMAIN)"
- ./$(OUTPUTMAIN)
- @echo Executing 'run: all' complete!
+install: $(TARGET)
+ cp $(TARGET) /usr/local/bin/
-install: all
- install -Dm755 $(OUTPUTMAIN) /usr/bin/davinci-convert
+uninstall:
+ rm -f /usr/local/bin/$(TARGET)
+
+test: $(TARGET)
+ @echo "Running tests..."
+ @./$(TARGET) --help
+ @echo "Test: Help command passed"
+ @./$(TARGET) 2>&1 | grep -q "Usage:" && echo "Test: No args passed" || (echo "Test failed" && exit 1)
+ @echo "All tests passed!"
+
+.PHONY: all clean install uninstall test
diff --git a/README.md b/README.md
index 94af9a5..e82a17a 100644
--- a/README.md
+++ b/README.md
@@ -1,105 +1,137 @@
-# Davinci Video Converter
+# DaVinci Video Converter
-This is a simple tool that converts your `.mp4` videos into a format that DaVinci Resolve uses on Linux. The application utilizes `ffmpeg` for video conversion.
+A command-line video conversion tool optimized for DaVinci Resolve workflows.
## Features
-- Convert `.mp4` videos to DNxHD format.
-- Simple command-line interface for user input.
+- Convert videos using various codecs (H.264, H.265, ProRes)
+- Quality presets for different use cases
+- CRF-based quality control
+- Verbose output for debugging
-## Prerequisites
+## Development Environment
-Before building and running the application, ensure you have the following installed:
+### DevContainer (Podman)
-- `g++` (GNU C++ Compiler)
-- `make` (Build automation tool)
-- `ffmpeg` (Multimedia framework for handling video, audio, and other multimedia files)
+This project includes a DevContainer configuration for use with Podman. To use it:
-## Installation
+1. Install the Dev Containers extension in VS Code
+2. Configure VS Code to use Podman:
+ - Set `remote.containers.defaultDockerCommand` to `podman` in VS Code settings
+3. Reopen the project in the container (Ctrl+Shift+P → "Dev Containers: Reopen in Container")
-### Using the Build Script
+The container includes all necessary dependencies (g++, make, ffmpeg).
-1. Clone the repository:
- ```bash
- git clone (https://github.com/tkmxqrdxddd/davinci-video-converter)
- cd davinci-video-converter
- ```
+### Nix Shell
-2. Run the build script to install dependencies and build the project:
- ```bash
- ./build.sh
- ```
-
- This script will automatically install the required dependencies based on your Linux distribution and build the project. It will also install the application to `/usr/bin`, making it accessible from anywhere.
-
-### Manual Installation
-
-If you prefer to install manually, follow these steps:
-
-1. Install the required dependencies (if not already installed):
- - For Debian-based systems:
- ```bash
- sudo apt-get install -y build-essential ffmpeg
- ```
- - For Red Hat-based systems:
- ```bash
- sudo dnf install -y gcc-c++ ffmpeg make
- ```
- - For Arch Linux:
- ```bash
- sudo pacman -Syu --noconfirm base-devel ffmpeg
- ```
- - For openSUSE:
- ```bash
- sudo zypper install -y gcc-c++ ffmpeg make
- ```
- - For Alpine Linux:
- ```bash
- sudo apk add --no-cache g++ ffmpeg make
- ```
-
-2. Build the project using `make`:
- ```bash
- make
- ```
-
- This will create an executable named `davinci-convert` in the `output` directory.
-
-3. Install the application:
- ```bash
- make install
- ```
-
-## Running the Program
-
-To run the program, use the following command:
+For Nix users, enter the development shell:
```bash
-davinci-convert
+nix-shell
```
-### Usage
+This provides a development environment with g++, make, and ffmpeg.
-1. When prompted, enter the input file path of the `.mp4` video you want to convert.
-2. Enter the desired output file path (including the filename and extension) for the converted video.
-3. The program will start the conversion process. You will see messages indicating the progress.
-4. Once the conversion is complete, you will receive a success message.
+## Building
-### Cleaning Up
+### Using Make
+
+```bash
+make
+```
+
+### Using build.sh
+
+```bash
+./build.sh
+```
+
+### Clean Build
-To clean up the generated files (object files and the executable), run:
```bash
make clean
```
-## Contributing
+## Usage
-If you would like to contribute to this project, please fork the repository and submit a pull request. Any contributions, bug reports, or feature requests are welcome!
+```bash
+./davinci-video-converter [options]