#!/bin/bash # Install FFmpeg static build for Hugging Face Spaces echo "Installing FFmpeg..." # Download FFmpeg static build wget -q https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz # Extract tar -xf ffmpeg-release-amd64-static.tar.xz # Find the extracted directory (version may vary) FFMPEG_DIR=$(find . -maxdepth 1 -type d -name "ffmpeg-*-amd64-static" | head -n 1) # Copy binaries to a location in PATH mkdir -p /home/user/.local/bin cp "$FFMPEG_DIR/ffmpeg" /home/user/.local/bin/ cp "$FFMPEG_DIR/ffprobe" /home/user/.local/bin/ # Make executable chmod +x /home/user/.local/bin/ffmpeg chmod +x /home/user/.local/bin/ffprobe # Clean up rm -rf ffmpeg-*.tar.xz "$FFMPEG_DIR" # Add to PATH in current session export PATH="/home/user/.local/bin:$PATH" echo "FFmpeg installed successfully!" ffmpeg -version