Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
DocumentaryTube
Admit one · Blog

How to Install FFmpeg on an Ubuntu Google Cloud VM for YouTube Streaming

Install FFmpeg on an existing Ubuntu Google Cloud VM, verify it, and prepare a direct YouTube Live workflow with sensible encoder settings and security checks.
Opened Runtime6 min Written byDocumentaryTube Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On an existing Ubuntu Compute Engine VM, connect over SSH, run sudo apt update and sudo apt install -y ffmpeg, then verify the installation with ffmpeg -version. That installs the command-line encoder; it does not configure a YouTube stream or Google Cloud’s separate Live Stream API.

Install FFmpeg on the Ubuntu VM

This assumes you already have an Ubuntu virtual machine in Google Cloud Compute Engine and can connect to it. Run the commands in the VM’s SSH session—not in Cloud Shell unless you specifically intend to install FFmpeg in that separate environment.

  1. Connect to the VM using your usual SSH method, such as the Google Cloud console’s SSH button or your configured gcloud workflow.

  2. Refresh Ubuntu’s package metadata:

    sudo apt update
  3. Install FFmpeg from the repositories configured for that VM:

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    sudo apt install -y ffmpeg

    Google Cloud’s Live Stream API setup documentation also gives sudo apt install ffmpeg as an encoder installation command. The additional -y answers apt’s confirmation prompt automatically. Google Cloud’s installation guidance is part of a Live Stream API setup guide, but the package-install command itself can be used on an Ubuntu VM.

  4. Check that the executable is available and inspect the version and build information:

    ffmpeg -version

What the version check tells you

If the command prints FFmpeg version and configuration details, the executable is installed and on your shell’s path. If the shell reports “command not found,” confirm that the installation completed and that you are running the command in the VM where you installed the package.

Do not assume a particular FFmpeg version or that a specific codec is enabled. Those depend on the Ubuntu release, configured repositories, and package build. The FFmpeg documentation notes that its online documentation tracks the newest revision; for an older distribution package, consult documentation matching the installed version when available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Connect FFmpeg to YouTube Live

Installing FFmpeg is only the local software step. To stream directly from the VM to YouTube, obtain the current server or ingest URL and stream key from YouTube’s live-control workflow, then use those values in your FFmpeg command. Direct FFmpeg-to-YouTube streaming is separate from Google Cloud’s Live Stream API workflow; you do not need to enable that API just to install FFmpeg or send a stream to YouTube.

Choose encoder settings before building the command

YouTube’s encoder settings guidance lists RTMP and RTMPS ingestion and recommends RTMPS, which encrypts data in transit to Google’s servers. It lists H.264, H.265/HEVC, and AV1 as video codec options, and AAC or MP3 for audio. Whether your installed FFmpeg build supports a chosen encoder must be checked locally.

  • Resolution and frame rate: Match the output to your documentary source and intended live mode. Higher-resolution or higher-frame-rate output generally requires more upstream capacity.
  • Video bitrate: YouTube’s current table recommends 14 Mbps for H.264 at 1080p/30 fps and 8 Mbps for H.264 at 720p/30 fps. These are encoder recommendations for those modes, not guarantees that the VM’s network path can sustain them.
  • Rate control and keyframes: YouTube lists constant bitrate (CBR), recommends a two-second keyframe interval, and says not to exceed four seconds.
  • Audio: Select AAC or MP3 for the listed RTMP/RTMPS workflows and ensure the output sample rate and channel layout are appropriate for the source and intended stream.

Run a speed test and test with representative moving video and audio before an event. Monitor YouTube’s stream health and adjust the output bitrate to the actual upload path rather than selecting it solely from the video resolution.

Build a command without exposing your stream key

There is no single safe command that fits every input file, codec build, and YouTube stream configuration. Use this as a structure, replacing the bracketed placeholders with your own input path, settings, and current ingest URL/key:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ffmpeg -re -i "input.mp4" 
  -c:v libx264 -preset veryfast -b:v 8M -maxrate 8M -bufsize 16M 
  -r 30 -g 60 -keyint_min 60 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "[YOUTUBE_INGEST_URL]/[STREAM_KEY]"

This example illustrates an H.264 720p/30 fps-oriented bitrate and two-second keyframe interval; it is not a universal preset. Confirm that libx264 is available in your installed build, set the output resolution to match the intended mode, and use the ingest URL and stream key shown for your YouTube stream. For a different codec, frame rate, resolution, or audio arrangement, consult YouTube’s current settings table and verify that the corresponding encoder exists in your FFmpeg build.

A stream key is a credential that lets someone send video to your channel. Do not publish it or paste a real key into an article, shared script, or shell history. Use a private configuration method suitable for your environment, restrict access to it, and rotate the key in YouTube if it is exposed.

Know what the Google Cloud install guide covers

Google Cloud’s cited apt command appears in documentation for using FFmpeg to generate input streams for the Live Stream API. That API workflow has its own project setup, API enablement, authentication, IAM roles, and Cloud Storage requirements. Installing FFmpeg alone does not configure those pieces. Conversely, none of those API steps is required merely to install FFmpeg on a VM or stream directly from FFmpeg to YouTube.

Google-provided public Compute Engine OS images generally include the guest environment; imported or custom images may need separate guest-environment work. That is a VM image concern, not an FFmpeg prerequisite.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common installation and streaming problems

ffmpeg: command not found

Check that apt completed successfully and that you are connected to the intended VM. Run sudo apt update followed by sudo apt install -y ffmpeg again, then retry ffmpeg -version. If apt cannot locate the package, check the Ubuntu release and the repositories configured for that VM rather than assuming a specific package version.

The command rejects an encoder

An error such as an unavailable encoder can mean the package build does not include that encoder. Inspect the locally installed build information from ffmpeg -version and use an encoder it provides, or choose an appropriate package source for your Ubuntu release. Do not infer codec availability from YouTube’s list of accepted codecs alone.

YouTube does not receive a valid stream

  • Check the destination: Copy the current ingest URL and stream key from YouTube’s live setup; do not include explanatory brackets or placeholder text.
  • Check protocol compatibility: Use RTMPS where compatible with the endpoint and command configuration.
  • Check the output mode: Confirm that resolution, frame rate, codec, bitrate, keyframe interval, and audio format are supported and within the chosen YouTube settings.
  • Check stream health and bandwidth: Test the VM’s actual upstream path and reduce the bitrate if it cannot sustain the selected output. YouTube recommends testing before the event and monitoring stream health.

The stream key may have been exposed

Replace or rotate the key in YouTube’s live-control settings, update the private configuration used by FFmpeg, and make sure logs or scripts shared with others do not contain the old credential.

Copyright and channel-policy checks for documentary streams

Technical delivery does not grant rights to the documentary footage, soundtrack, narration, or other material in the stream. Before scheduling a broadcast, confirm that you have permission to use every component for live streaming and that the content complies with YouTube’s applicable rules. Repeating a video continuously does not itself establish permission or make a channel eligible for monetization. Review the copyright safety checklist before using material whose rights or licensing terms are unclear.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or let it run in the cloud

If your goal is a YouTube channel that stays live with uploaded videos, StreamNeo is a hosted alternative to maintaining an FFmpeg process on a VM. Upload your recording or build a playlist, add your YouTube stream key once, and go live. It plays uploaded videos rather than broadcasting from a camera.

  • Your computer and home internet connection do not have to stay on; the stream runs in the cloud.
  • Videos stream as uploaded, up to 4K 60fps, at one flat price per slot rather than quality-based tiers.
  • It automatically recovers if YouTube drops the stream.
  • The first day is free with no card; one free day is available per account.

Each slot includes one always-on stream, 10 GB of storage per slot pooled across active slots, looping and playlists, automatic recovery, and StreamNeo team support. The same product is included on every plan; only the billing period changes. Monthly billing is $9.99 per month. UPI and cards are accepted in India; card checkout is available worldwide. For five or more slots, contact support. See StreamNeo for details, or estimate upload time and compare cloud and PC costs.

Start your free StreamNeo day.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Screening Room

  1. That’s Greece: How to Choose Your TripAdmit one · ArtThat's Greece: How to Choose Your TripOpened05 OCT 2026Runtime3 min
  2. Class of 92 – Out of Their League – Episode 1Admit one · SportsClass of 92 - Out of Their League - Episode 1Opened05 OCT 2026Runtime2 min
  3. The Rise of the NOTORIOUS: The story of Conor McGregorAdmit one · SportsThe Rise of the NOTORIOUS: The story of Conor McGregorOpened05 OCT 2026Runtime2 min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.