Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Support multi-platform downloads of ffmpeg in the integration test scripts

Gabe Kangasae7c838c3e22
diff --git a/test/automated/tools.sh b/test/automated/tools.sh
index 928d0f091c..a4d2ffe51b 100755
--- a/test/automated/tools.sh
+++ b/test/automated/tools.sh
@@ -5,30 +5,50 @@ set -e
function install_ffmpeg() {
# install a specific version of ffmpeg
- if [[ "$OSTYPE" != "linux-"* ]] && [[ "$OSTYPE" != "darwin"* ]]; then
- echo "Unsupported platform: $OSTYPE"
- exit 1
- fi
-
FFMPEG_VER="8.0"
- FFMPEG_BUILD_VERSION="20251223233512"
+ FFMPEG_BUILD_VERSION="20260223192056"
FFMPEG_PATH="$(pwd)"
PATH=$FFMPEG_PATH:$PATH
+ case "$OSTYPE" in
+ linux-*) ffmpeg_os="linux" ;;
+ darwin*) ffmpeg_os="darwin" ;;
+ *)
+ echo "Unsupported platform: $OSTYPE"
+ exit 1
+ ;;
+ esac
+
+ case "$(uname -m)" in
+ x86_64 | amd64) ffmpeg_arch="amd64" ;;
+ aarch64 | arm64) ffmpeg_arch="arm64" ;;
+ *)
+ echo "Unsupported architecture: $(uname -m)"
+ exit 1
+ ;;
+ esac
+
+ if [[ "$ffmpeg_os" == "linux" ]]; then
+ ffmpeg_asset="ffmpeg${FFMPEG_VER}-linux-${ffmpeg_arch}-static.tar.gz"
+ else
+ ffmpeg_asset="ffmpeg${FFMPEG_VER}-darwin-${ffmpeg_arch}.tar.gz"
+ fi
+
if [[ -x "$FFMPEG_PATH/ffmpeg" ]]; then
ffmpeg_version=$("$FFMPEG_PATH/ffmpeg" -version | awk -F 'ffmpeg version' '{print $2}' | awk 'NR==1{print $1}')
- if [[ "$ffmpeg_version" == "$FFMPEG_VER-static" ]]; then
+ # Linux static builds report "8.0-static"; macOS builds report "8.0" or "8.0.1".
+ if [[ "$ffmpeg_version" == "$FFMPEG_VER" || "$ffmpeg_version" == "$FFMPEG_VER".* || "$ffmpeg_version" == "$FFMPEG_VER"-* ]]; then
return 0
else
mv "$FFMPEG_PATH/ffmpeg" "$FFMPEG_PATH/ffmpeg.bk" || rm -f "$FFMPEG_PATH/ffmpeg"
fi
fi
- echo "Downloading ffmpeg v${FFMPEG_VER} release ${FFMPEG_BUILD_VERSION}"
+ echo "Downloading ffmpeg v${FFMPEG_VER} release ${FFMPEG_BUILD_VERSION} for ${ffmpeg_os}/${ffmpeg_arch}"
rm -rf ffmpeg.tar.gz
- curl -sL --fail "https://github.com/owncast/ffmpeg-builds/releases/download/${FFMPEG_BUILD_VERSION}/ffmpeg${FFMPEG_VER}-amd64-static.tar.gz" --output ffmpeg.tar.gz >/dev/null
+ curl -sL --fail "https://github.com/owncast/ffmpeg-builds/releases/download/${FFMPEG_BUILD_VERSION}/${ffmpeg_asset}" --output ffmpeg.tar.gz >/dev/null
tar -xzf ffmpeg.tar.gz
rm -f ffmpeg.tar.gz
chmod +x ffmpeg
@@ -72,11 +92,11 @@ function kill_with_kids() {
# kill a process and all its children (by pid)! return no error.
if [[ -n $1 ]]; then
- mapfile -t CHILDREN_PID_LIST < <(ps --ppid "$1" -o pid= &>/dev/null || true)
- for child_pid in "${CHILDREN_PID_LIST[@]}"; do
+ while IFS= read -r child_pid; do
+ [[ -n "$child_pid" ]] || continue
kill "$child_pid" &>/dev/null || true
wait "$child_pid" &>/dev/null || true
- done
+ done < <(pgrep -P "$1" 2>/dev/null || true)
kill "$1" &>/dev/null || true
wait "$1" &>/dev/null || true
fi