Run FFmpeg on Google Cloud Platform to process video and audio files efficiently at scale. This repository provides step-by-step guides, example commands, and ready-to-use scripts to help you set up a Google Cloud project, launch a VM, install FFmpeg, and process media files in the cloud. For a more detailed guide, see FFmpeg on GCP: Step-by-Step for Beginners article.
FFmpeg is a powerful open-source command-line tool for converting, compressing, and processing media. While you can run FFmpeg locally, larger files and workloads can be slow and resource-intensive. Running FFmpeg on GCP allows you to:
- Use scalable infrastructure and faster machines
- Store input/output files in Google Cloud Storage
- Automate video/audio conversions at scale
- Pay only for the compute time you use
This repo walks you through the process with documentation and scripts.
ffmpeg-gcp-demo/
├── README.md # Main project guide
├── docs/ # Step-by-step tutorials
│ ├── 01-setup-project.md
│ ├── 02-compute-engine-vm.md
│ ├── 03-install-ffmpeg.md
│ ├── 04-sample-commands.md
│ ├── 05-process-video.md
│ ├── 06-other-options.md
│ └── 07-conclusion.md
├── scripts/ # Automation scripts
│ ├── install_ffmpeg.sh
│ ├── test_ffmpeg.sh
│ ├── download_from_gcs.sh
│ ├── convert_video.sh
│ └── upload_to_gcs.sh
├── examples/ # Example FFmpeg workflows
│ ├── testsrc_demo.sh
│ ├── mp4_to_webm.sh
│ └── resize_video.sh
├── gcp-config/ # Notes on VM & Storage config
│ ├── vm-instance-config.md
│ ├── storage-setup.md
│ └── access-scopes.md
└── .gitignore
- A Google Cloud account (new users get free credits)
- Billing enabled for your project
- Basic command-line knowledge (Linux shell)
-
Clone this repo
git clone https://github.com/your-username/ffmpeg-gcp-demo.git cd ffmpeg-gcp-demo -
Create a Google Cloud project See docs/01-setup-project.md
-
Launch a Compute Engine VM Follow docs/02-compute-engine-vm.md
-
Install FFmpeg
To make the files executable, run these commandas first:
cd scripts chmod +x *.sh cd ..
Run the provided script:
./scripts/install_ffmpeg.sh
To see what the script does, see here.
-
Test FFmpeg
./scripts/test_ffmpeg.sh
To see what the script does, see here.
-
Process a video (download → convert → upload)
./scripts/download_from_gcs.sh ./scripts/convert_video.sh ./scripts/upload_to_gcs.sh
To see what the scripts do, see here.
- Generate test video: examples/testsrc_demo.sh
- Convert MP4 to WebM: examples/mp4_to_webm.sh
- Resize video to 720p: examples/resize_video.sh
- Cloud Run: Package FFmpeg in a container for serverless jobs
- Transcoder API: Use Google’s managed video processing service
- Kubernetes (GKE): Scale out FFmpeg across many parallel jobs
- Never commit service account keys or credentials to GitHub.
- Use IAM roles and Access Scopes to control bucket read/write access.
- Always add
credentials.jsonand other sensitive files to.gitignore.
This project is licensed under the MIT License – see the LICENSE file for details.