diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3763a25..8e3123b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,4 +23,4 @@ jobs: - name: Run run: | echo "Running the Video Converter..." - ./output/VideoConverter + ./output/davinci-convert diff --git a/.gitignore b/.gitignore index 8e2abce..7ff4b29 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,5 @@ *.app /output /.qtcreator -/.docker \ No newline at end of file +/.docker +PKGBUILD \ No newline at end of file diff --git a/Makefile b/Makefile index 91a9202..6067d78 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# 'make' build executable file 'VideoConverter' +# 'make' build executable file 'davinci-convert' # 'make clean' removes all .o and executable files # @@ -16,7 +16,7 @@ OUTPUT = output SRC = src # define the main executable name -MAIN = VideoConverter +MAIN = davinci-convert # define the C source files SOURCES = $(wildcard $(SRC)/*.cpp) @@ -47,3 +47,6 @@ run: all @echo "Running executable: $(OUTPUTMAIN)" ./$(OUTPUTMAIN) @echo Executing 'run: all' complete! + +install: all + install -Dm755 $(OUTPUTMAIN) /usr/bin/davinci-convert diff --git a/README.md b/README.md index 7d9a0a4..1a9a426 100644 --- a/README.md +++ b/README.md @@ -1 +1,105 @@ -# This is a simple tool that will convert your .mp4 videos into format that davinci resolve on linux uses +# 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. + +## Features + +- Convert `.mp4` videos to DNxHD format. +- Simple command-line interface for user input. + +## Prerequisites + +Before building and running the application, ensure you have the following installed: + +- `g++` (GNU C++ Compiler) +- `make` (Build automation tool) +- `ffmpeg` (Multimedia framework for handling video, audio, and other multimedia files) + +## Installation + +### Using the Build Script + +1. Clone the repository: + ```bash + git clone https://github.com/yourusername/DavinciVideoConverter.git + cd DavinciVideoConverter + ``` + +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 + sudo make install + ``` + +## Running the Program + +To run the program, use the following command: + +```bash +./output/davinci-convert +``` + +### Usage + +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. + +### Cleaning Up + +To clean up the generated files (object files and the executable), run: +```bash +make clean +``` + +## Contributing + +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! + +## License + +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. + +## Acknowledgments + +- This project uses `ffmpeg` for video conversion. For more information, visit the [FFmpeg website](https://ffmpeg.org/). diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..8c42ab2 --- /dev/null +++ b/build.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +set -e # Exit immediately if a command exits with a non-zero status +set -u # Treat unset variables as an error when substituting +set -o pipefail # Prevent errors in a pipeline from being masked + +# Function to install dependencies for Debian-based systems +install_debian_dependencies() { + echo "Installing dependencies for Debian-based systems..." + sudo apt-get update + sudo apt-get install -y build-essential ffmpeg || { + echo "Failed to install dependencies for Debian-based systems." + exit 1 + } +} + +# Function to install dependencies for Red Hat-based systems +install_redhat_dependencies() { + echo "Installing dependencies for Red Hat-based systems..." + sudo dnf install -y gcc-c++ ffmpeg make || { + echo "Failed to install dependencies for Red Hat-based systems." + exit 1 + } +} + +# Function to install dependencies for Arch Linux +install_arch_dependencies() { + echo "Installing dependencies for Arch Linux..." + sudo pacman -Syu --noconfirm base-devel ffmpeg || { + echo "Failed to install dependencies for Arch Linux." + exit 1 + } +} + +# Function to install dependencies for openSUSE +install_opensuse_dependencies() { + echo "Installing dependencies for openSUSE..." + sudo zypper install -y gcc-c++ ffmpeg make || { + echo "Failed to install dependencies for openSUSE." + exit 1 + } +} + +# Function to install dependencies for Alpine Linux +install_alpine_dependencies() { + echo "Installing dependencies for Alpine Linux..." + sudo apk add --no-cache g++ ffmpeg make || { + echo "Failed to install dependencies for Alpine Linux." + exit 1 + } +} + +# Check the package manager and install dependencies accordingly +if [ -f /etc/debian_version ]; then + install_debian_dependencies +elif [ -f /etc/redhat-release ]; then + install_redhat_dependencies +elif [ -f /etc/arch-release ]; then + install_arch_dependencies +elif [ -f /etc/os-release ]; then + . /etc/os-release + case "$ID" in + opensuse*) + install_opensuse_dependencies + ;; + alpine) + install_alpine_dependencies + ;; + *) + echo "Unsupported distribution: $ID. Please install the required packages manually." + exit 1 + ;; + esac +else + echo "Unsupported distribution. Please install the required packages manually." + exit 1 +fi + +# Build the project +echo "Building the project..." +make + +# Check if the build was successful +if [ $? -eq 0 ]; then + echo "Build completed successfully." +else + echo "Build failed. Please check the output for errors." + exit 1 +fi + +# Install the application +echo "Installing the application..." +sudo make install + +# Inform the user about the executable +echo "You can run the application using davinci-convert" \ No newline at end of file