From 5fe41239e43f43f5c7df87a5feb42bb4d4f7f454 Mon Sep 17 00:00:00 2001 From: Ian comings Date: Thu, 5 Sep 2024 05:23:35 -0500 Subject: [PATCH 1/4] Create btbn-ffmpeg7.sh --- DockerMods/btbn-ffmpeg7.sh | 75 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 DockerMods/btbn-ffmpeg7.sh diff --git a/DockerMods/btbn-ffmpeg7.sh b/DockerMods/btbn-ffmpeg7.sh new file mode 100644 index 0000000..ff1591f --- /dev/null +++ b/DockerMods/btbn-ffmpeg7.sh @@ -0,0 +1,75 @@ +#!/bin/bash +# ---------------------------------------------------------------------------------------------------- +# Name: btbn_ffmpeg7-latest_installer +# Description: This script installs the BtbN Linux GPL static build of FFmpeg into /opt/ffmpeg-static and symlinks it to /usr/local/bin. +# Revision: 1 +# 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" +INSTALL_DIR="/usr/local/bin" +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..." + sudo rm -f "$INSTALL_DIR/ffmpeg" + sudo rm -f "$INSTALL_DIR/ffprobe" + echo "FFmpeg and FFprobe symlinks removed." + + if [ -d "$FFMPEG_DIR" ]; then + echo "Removing $FFMPEG_DIR..." + sudo rm -rf "$FFMPEG_DIR" + fi + echo "Uninstallation complete." + exit 0 +fi + +# Check if ffmpeg is already installed +if command -v ffmpeg &>/dev/null; then + echo "FFmpeg is already installed." + exit 0 +fi + +# Step 1: Create the directory for ffmpeg installation in /opt if it doesn't exist +echo "Creating $FFMPEG_DIR for installation..." +sudo mkdir -p "$FFMPEG_DIR" + +# Step 2: Create a temporary directory for downloading the static build +echo "Creating temporary directory for download..." +mkdir -p "$TEMP_DIR" + +# Step 3: 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 4: Extract the downloaded archive into /opt/ffmpeg-static +echo "Extracting ffmpeg static build to $FFMPEG_DIR..." +sudo tar -xf "$TEMP_DIR/ffmpeg-static.tar.xz" -C "$FFMPEG_DIR" --strip-components=1 + +# Step 5: Remove any existing ffmpeg and ffprobe symlinks from /usr/local/bin +echo "Removing existing ffmpeg and ffprobe symlinks from $INSTALL_DIR..." +sudo rm -f "$INSTALL_DIR/ffmpeg" +sudo rm -f "$INSTALL_DIR/ffprobe" + +# Step 6: Symlink the new ffmpeg and ffprobe from /opt/ffmpeg-static to /usr/local/bin +echo "Creating symlinks to $INSTALL_DIR..." +sudo ln -s "$FFMPEG_DIR/ffmpeg" "$INSTALL_DIR/ffmpeg" +sudo ln -s "$FFMPEG_DIR/ffprobe" "$INSTALL_DIR/ffprobe" + +# Step 7: Cleanup temporary files +echo "Cleaning up temporary files..." +rm -rf "$TEMP_DIR" + +# Step 8: Verify installation +echo "Verifying ffmpeg installation..." +if command -v ffmpeg &>/dev/null; then + echo "FFmpeg $FFMPEG_VERSION successfully installed." + exit 0 +else + echo "Failed to install FFmpeg." + exit 1 +fi From 3e9517279df23350c7cb69f55d9bd5b28a0b8512 Mon Sep 17 00:00:00 2001 From: Ian comings Date: Thu, 5 Sep 2024 05:37:49 -0500 Subject: [PATCH 2/4] Update btbn-ffmpeg7.sh Adjusted script to check full FFMPEG path for existing FFMPEG --- DockerMods/btbn-ffmpeg7.sh | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/DockerMods/btbn-ffmpeg7.sh b/DockerMods/btbn-ffmpeg7.sh index ff1591f..3161f7f 100644 --- a/DockerMods/btbn-ffmpeg7.sh +++ b/DockerMods/btbn-ffmpeg7.sh @@ -2,7 +2,7 @@ # ---------------------------------------------------------------------------------------------------- # Name: btbn_ffmpeg7-latest_installer # Description: This script installs the BtbN Linux GPL static build of FFmpeg into /opt/ffmpeg-static and symlinks it to /usr/local/bin. -# Revision: 1 +# Revision: 2 # Icon: fas fa-file-video # ---------------------------------------------------------------------------------------------------- # Variables @@ -28,43 +28,49 @@ if [ "$1" == "--uninstall" ]; then exit 0 fi -# Check if ffmpeg is already installed -if command -v ffmpeg &>/dev/null; then - echo "FFmpeg is already installed." +# Step 1: Check if ffmpeg is already installed by checking the full path +FFMPEG_PATH=$(command -v ffmpeg) + +if [ -n "$FFMPEG_PATH" ]; then + if [ "$FFMPEG_PATH" == "$INSTALL_DIR/ffmpeg" ]; then + echo "FFmpeg is already installed in $INSTALL_DIR." + else + echo "FFmpeg is installed in $FFMPEG_PATH. Skipping installation." + fi exit 0 fi -# Step 1: Create the directory for ffmpeg installation in /opt if it doesn't exist +# Step 2: Create the directory for ffmpeg installation in /opt if it doesn't exist echo "Creating $FFMPEG_DIR for installation..." sudo mkdir -p "$FFMPEG_DIR" -# Step 2: Create a temporary directory for downloading the static build +# Step 3: Create a temporary directory for downloading the static build echo "Creating temporary directory for download..." mkdir -p "$TEMP_DIR" -# Step 3: Download the static build of ffmpeg from BtbN GPL builds +# 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 4: Extract the downloaded archive into /opt/ffmpeg-static +# Step 5: Extract the downloaded archive into /opt/ffmpeg-static echo "Extracting ffmpeg static build to $FFMPEG_DIR..." sudo tar -xf "$TEMP_DIR/ffmpeg-static.tar.xz" -C "$FFMPEG_DIR" --strip-components=1 -# Step 5: Remove any existing ffmpeg and ffprobe symlinks from /usr/local/bin +# Step 6: Remove any existing ffmpeg and ffprobe symlinks from /usr/local/bin echo "Removing existing ffmpeg and ffprobe symlinks from $INSTALL_DIR..." sudo rm -f "$INSTALL_DIR/ffmpeg" sudo rm -f "$INSTALL_DIR/ffprobe" -# Step 6: Symlink the new ffmpeg and ffprobe from /opt/ffmpeg-static to /usr/local/bin +# Step 7: Symlink the new ffmpeg and ffprobe from /opt/ffmpeg-static to /usr/local/bin echo "Creating symlinks to $INSTALL_DIR..." sudo ln -s "$FFMPEG_DIR/ffmpeg" "$INSTALL_DIR/ffmpeg" sudo ln -s "$FFMPEG_DIR/ffprobe" "$INSTALL_DIR/ffprobe" -# Step 7: Cleanup temporary files +# Step 8: Cleanup temporary files echo "Cleaning up temporary files..." rm -rf "$TEMP_DIR" -# Step 8: Verify installation +# Step 9: Verify installation echo "Verifying ffmpeg installation..." if command -v ffmpeg &>/dev/null; then echo "FFmpeg $FFMPEG_VERSION successfully installed." From 500c79c096b5489a7470e2608851c60249bbe97a Mon Sep 17 00:00:00 2001 From: Ian comings Date: Thu, 5 Sep 2024 05:44:26 -0500 Subject: [PATCH 3/4] Update btbn-ffmpeg7.sh Adjusted script to no longer replace the existing FFMPEG install but to instead place it in /opt/ffmpeg-static and instruct users to update the Variables to reference /opt/ffmpeg-static/bin/ffmpeg and /opt/ffmpeg-static/bin/ffprobe --- DockerMods/btbn-ffmpeg7.sh | 60 +++++++++++++------------------------- 1 file changed, 21 insertions(+), 39 deletions(-) diff --git a/DockerMods/btbn-ffmpeg7.sh b/DockerMods/btbn-ffmpeg7.sh index 3161f7f..ec46415 100644 --- a/DockerMods/btbn-ffmpeg7.sh +++ b/DockerMods/btbn-ffmpeg7.sh @@ -1,42 +1,37 @@ #!/bin/bash # ---------------------------------------------------------------------------------------------------- -# Name: btbn_ffmpeg7-latest_installer -# Description: This script installs the BtbN Linux GPL static build of FFmpeg into /opt/ffmpeg-static and symlinks it to /usr/local/bin. -# Revision: 2 +# 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: 5 # 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" -INSTALL_DIR="/usr/local/bin" 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..." - sudo rm -f "$INSTALL_DIR/ffmpeg" - sudo rm -f "$INSTALL_DIR/ffprobe" - echo "FFmpeg and FFprobe symlinks removed." - + echo "Uninstalling ffmpeg and ffprobe from $FFMPEG_DIR..." if [ -d "$FFMPEG_DIR" ]; then - echo "Removing $FFMPEG_DIR..." sudo 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 by checking the full path -FFMPEG_PATH=$(command -v ffmpeg) - -if [ -n "$FFMPEG_PATH" ]; then - if [ "$FFMPEG_PATH" == "$INSTALL_DIR/ffmpeg" ]; then - echo "FFmpeg is already installed in $INSTALL_DIR." - else - echo "FFmpeg is installed in $FFMPEG_PATH. Skipping installation." - 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 @@ -56,26 +51,13 @@ wget -O "$TEMP_DIR/ffmpeg-static.tar.xz" "$FFMPEG_URL" echo "Extracting ffmpeg static build to $FFMPEG_DIR..." sudo tar -xf "$TEMP_DIR/ffmpeg-static.tar.xz" -C "$FFMPEG_DIR" --strip-components=1 -# Step 6: Remove any existing ffmpeg and ffprobe symlinks from /usr/local/bin -echo "Removing existing ffmpeg and ffprobe symlinks from $INSTALL_DIR..." -sudo rm -f "$INSTALL_DIR/ffmpeg" -sudo rm -f "$INSTALL_DIR/ffprobe" - -# Step 7: Symlink the new ffmpeg and ffprobe from /opt/ffmpeg-static to /usr/local/bin -echo "Creating symlinks to $INSTALL_DIR..." -sudo ln -s "$FFMPEG_DIR/ffmpeg" "$INSTALL_DIR/ffmpeg" -sudo ln -s "$FFMPEG_DIR/ffprobe" "$INSTALL_DIR/ffprobe" - -# Step 8: Cleanup temporary files +# Step 6: Cleanup temporary files echo "Cleaning up temporary files..." rm -rf "$TEMP_DIR" -# Step 9: Verify installation -echo "Verifying ffmpeg installation..." -if command -v ffmpeg &>/dev/null; then - echo "FFmpeg $FFMPEG_VERSION successfully installed." - exit 0 -else - echo "Failed to install FFmpeg." - exit 1 -fi +# 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 From 5cee605e003655ddd20796ed7a3a9032b96ecb5a Mon Sep 17 00:00:00 2001 From: Ian comings Date: Thu, 5 Sep 2024 05:48:29 -0500 Subject: [PATCH 4/4] Update btbn-ffmpeg7.sh Removed all sudo references as the container user is root --- DockerMods/btbn-ffmpeg7.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DockerMods/btbn-ffmpeg7.sh b/DockerMods/btbn-ffmpeg7.sh index ec46415..700b053 100644 --- a/DockerMods/btbn-ffmpeg7.sh +++ b/DockerMods/btbn-ffmpeg7.sh @@ -5,7 +5,7 @@ # 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: 5 +# Revision: 6 # Icon: fas fa-file-video # ---------------------------------------------------------------------------------------------------- @@ -20,7 +20,7 @@ TEMP_DIR="/tmp/ffmpeg-static" if [ "$1" == "--uninstall" ]; then echo "Uninstalling ffmpeg and ffprobe from $FFMPEG_DIR..." if [ -d "$FFMPEG_DIR" ]; then - sudo rm -rf "$FFMPEG_DIR" + rm -rf "$FFMPEG_DIR" echo "$FFMPEG_DIR removed." else echo "FFmpeg is not installed in $FFMPEG_DIR." @@ -37,7 +37,7 @@ fi # Step 2: Create the directory for ffmpeg installation in /opt if it doesn't exist echo "Creating $FFMPEG_DIR for installation..." -sudo mkdir -p "$FFMPEG_DIR" +mkdir -p "$FFMPEG_DIR" # Step 3: Create a temporary directory for downloading the static build echo "Creating temporary directory for download..." @@ -49,7 +49,7 @@ 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..." -sudo tar -xf "$TEMP_DIR/ffmpeg-static.tar.xz" -C "$FFMPEG_DIR" --strip-components=1 +tar -xf "$TEMP_DIR/ffmpeg-static.tar.xz" -C "$FFMPEG_DIR" --strip-components=1 # Step 6: Cleanup temporary files echo "Cleaning up temporary files..."