Skip to content

Commit

Permalink
Merge pull request #51 from KRDucky/master
Browse files Browse the repository at this point in the history
BtbN FFMPEG 7.0.2 Git Master Static build dockermod
  • Loading branch information
revenz authored Sep 15, 2024
2 parents 844c9fc + 5cee605 commit 0cb94bb
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions DockerMods/btbn-ffmpeg7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
# ----------------------------------------------------------------------------------------------------
# Name: btbn-latest-ffmpeg7_installer
# Description: This script installs the BtbN Linux GPL static build of FFmpeg 7.x into /opt/ffmpeg-static.
# It does not remove or modify any existing FFmpeg installation. Users should manually
# update their environment variables to use the new installation by adding
# /opt/ffmpeg-static/bin/ffmpeg and /opt/ffmpeg-static/bin/ffprobe to their PATH.
# Revision: 6
# Icon: fas fa-file-video
# ----------------------------------------------------------------------------------------------------

# Variables
FFMPEG_VERSION="latest" # Since we're using the 'latest' build
# URL for the latest BtbN Linux GPL build
FFMPEG_URL="https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz"
FFMPEG_DIR="/opt/ffmpeg-static"
TEMP_DIR="/tmp/ffmpeg-static"

# Check if the --uninstall option is provided
if [ "$1" == "--uninstall" ]; then
echo "Uninstalling ffmpeg and ffprobe from $FFMPEG_DIR..."
if [ -d "$FFMPEG_DIR" ]; then
rm -rf "$FFMPEG_DIR"
echo "$FFMPEG_DIR removed."
else
echo "FFmpeg is not installed in $FFMPEG_DIR."
fi
echo "Uninstallation complete."
exit 0
fi

# Step 1: Check if ffmpeg is already installed in /opt/ffmpeg-static
if [ -d "$FFMPEG_DIR" ]; then
echo "FFmpeg is already installed in $FFMPEG_DIR."
exit 0
fi

# Step 2: Create the directory for ffmpeg installation in /opt if it doesn't exist
echo "Creating $FFMPEG_DIR for installation..."
mkdir -p "$FFMPEG_DIR"

# Step 3: Create a temporary directory for downloading the static build
echo "Creating temporary directory for download..."
mkdir -p "$TEMP_DIR"

# Step 4: Download the static build of ffmpeg from BtbN GPL builds
echo "Downloading ffmpeg $FFMPEG_VERSION GPL static build..."
wget -O "$TEMP_DIR/ffmpeg-static.tar.xz" "$FFMPEG_URL"

# Step 5: Extract the downloaded archive into /opt/ffmpeg-static
echo "Extracting ffmpeg static build to $FFMPEG_DIR..."
tar -xf "$TEMP_DIR/ffmpeg-static.tar.xz" -C "$FFMPEG_DIR" --strip-components=1

# Step 6: Cleanup temporary files
echo "Cleaning up temporary files..."
rm -rf "$TEMP_DIR"

# Step 7: Provide instructions to the user
echo "FFmpeg $FFMPEG_VERSION successfully installed in $FFMPEG_DIR."
echo "Please update your environment variables or PATH to use the new binaries:"
echo " /opt/ffmpeg-static/bin/ffmpeg"
echo " /opt/ffmpeg-static/bin/ffprobe"
exit 0

0 comments on commit 0cb94bb

Please sign in to comment.