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 DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
DocumentaryTube
Compute Engine

How to Use a Google Cloud VM for a Looping YouTube Live Stream

Use a Linux Google Cloud VM to run an encoder that loops a prerecorded video to YouTube Live. Learn the RTMPS setup, stream-key precautions, settings, testing and cost factors.

By DocumentaryTube Team 8 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To loop a prerecorded video on YouTube Live from a cloud VM, run an encoder such as FFmpeg on a Linux Compute Engine VM and have it repeatedly send the video and audio to YouTube over RTMPS. YouTube Studio supplies the broadcast’s current ingest details; the VM hosts the encoder, while YouTube creates the live stream viewers watch. A VM is optional, not a YouTube Live requirement.

How the VM, encoder, and YouTube Live fit together

Think of this as three separate parts: a video file, an encoder running on a computer, and YouTube’s broadcast and ingest configuration. Compute Engine provides the remote Linux computer. FFmpeg reads and loops the file, then sends a continuous encoded feed to YouTube. YouTube receives that feed and presents the broadcast to viewers. Google describes the distinction between the incoming stream settings and the viewer-facing broadcast in its broadcasts and streams documentation.

The VM can remain running when your own computer is off, but you still need to administer it, monitor the encoder and account for cloud costs. Compute Engine lets you select the instance configuration, operating system, zone and storage; there is no single VM size established for every looping stream. See Google Cloud’s Compute Engine instances documentation.

Before you create the VM

Check that your channel can go live

Check YouTube Studio and current YouTube Live guidance before building the workflow. Channel eligibility and any first-time activation waiting period can depend on the account; do not assume a new channel can start immediately.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Choose headless FFmpeg or a GUI encoder

  • Headless FFmpeg: runs from the command line without a desktop and is a practical choice for a remote Linux VM. You administer it over SSH; Google documents Linux VM connections at Connect to Linux VMs.
  • GUI encoder: may be easier to configure or monitor visually, but an application that needs a display device may require a virtual display. Google documents this option at Enable virtual displays on a VM. A virtual display is not GPU acceleration and is not suitable for graphically intensive workloads that need hardware graphics acceleration.

Whichever you choose, the VM must have enough CPU, memory, disk and sustained network capacity for the actual resolution, codec and encoding workload. Software encoding can use substantial CPU; test your chosen settings on the selected instance rather than assuming any small VM will handle them in real time.

Create and connect to a Linux Compute Engine VM

  1. Choose a project, zone, operating system and machine type in Google Cloud Console under Compute Engine. Base the machine choice on the encoder workload and intended output, then verify it can sustain the stream during a representative test.
  2. Choose persistent storage for the media and operating system. Make sure the disk has room for the video file, the OS and any logs you intend to retain. A larger file requires more storage and takes longer to transfer to the VM.
  3. Review network access and costs before starting continuous runtime. You will need a way to reach the Linux VM for administration and enough outbound network capacity to send the feed to YouTube. Avoid exposing administrative access more broadly than necessary.
  4. Connect over SSH using Google Cloud’s documented Linux VM connection method. Install and configure the encoder for your selected Linux distribution; package names and supported FFmpeg features can vary by distribution and build.

Google Cloud pricing depends on the chosen region, machine family and size, disk, runtime and outbound traffic. Use the current Google Cloud pricing calculator with those actual assumptions; no universal monthly total can be stated for this workflow.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Prepare the YouTube broadcast and protect its stream key

  1. Open YouTube Studio and prepare a live broadcast in the current Live Control Room workflow.
  2. Copy the current server/ingest URL and stream key shown by YouTube. Treat the key like a password: do not publish it, include it in screenshots, or leave it in shared notes or terminal history.
  3. Keep the broadcast and its incoming stream conceptually separate: YouTube’s stream settings describe the encoder’s incoming feed, while the broadcast is the event viewers watch. Use the current settings displayed in Studio rather than relying on an old saved endpoint or key.
  4. Configure the encoder to send to YouTube using RTMPS where supported. YouTube recommends RTMPS, describing it as a secure extension to RTMP: Choose live encoder settings, bitrates, and resolutions.

Configure FFmpeg to loop the video

The following is a starting pattern, not a tested command for every file or FFmpeg build. Replace the file path, ingest URL and key with your own values; adapt audio and codec options to the media and installed FFmpeg. The `-stream_loop -1` input option repeats the file indefinitely, while `-re` reads it at its native playback rate rather than sending it as fast as the encoder can process it.

export YT_KEY='YOUR_STREAM_KEY'
ffmpeg -re -stream_loop -1 -i /path/to/video.mp4 
  -c:v libx264 -preset veryfast -b:v 4M -maxrate 4M -bufsize 8M 
  -r 30 -g 60 -keyint_min 60 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "rtmps://YOUR_INGEST_URL/YOUR_STREAM_KEY"

In this example, `-g 60` at 30 frames per second sets a 2-second GOP/keyframe interval, and `-b:v 4M` is a video bitrate starting point for a suitable 30 fps output—not a universal recommendation. The example places the key in the command’s destination argument, which can expose it to local process inspection or logs depending on the environment. For a more secure deployment, use an appropriate secret-management method and a wrapper that does not print the key; protect shell history and restrict VM access. Do not paste a real key into a script or log you may share.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Looping does not guarantee a seamless join. Source file encoding, timestamps, audio layout and container compatibility can affect transitions. Test the actual file and listen at the loop point; if FFmpeg exits or the stream breaks there, inspect its output and the media’s format rather than assuming the loop option alone repairs the file.

Choose YouTube-compatible video and audio settings

YouTube Help’s published encoder guidance, accessed October 3, 2026, lists H.264, H.265/HEVC and AV1 for RTMP/RTMPS video ingestion; AAC or MP3 audio; constant-bitrate encoding; and frame rates up to 60 fps. It recommends a 2-second keyframe interval and says not to exceed 4 seconds. Follow the current YouTube table for the codec, resolution and frame rate you intend to send, since its values can change.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
H.264 output example YouTube-published recommended video bitrate
240p–720p at 30 fps 4 Mbps
720p at 60 fps 6 Mbps
1080p at 30 fps 10 Mbps
1080p at 60 fps 12 Mbps

These are YouTube Help recommendations, not independent measurements or a guarantee that a particular VM can encode at that rate. The official table also provides AV1 and H.265 ranges; consult the current encoder settings page for the row that matches your stream. YouTube transcodes live input for viewer playback formats, so choose a sensible ingest setting rather than trying to encode every viewer resolution yourself.

A useful rule is to make the output resolution and frame rate match the source and desired broadcast, select the matching YouTube bitrate recommendation, and then confirm the VM can sustain that configuration without dropping frames. Higher resolution, frame rate or more demanding encoding can require more compute capacity and network throughput.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test the loop and monitor the live feed

  1. Run a representative preflight test. Include the actual kind of audio and movement in the program, not just a static image. YouTube recommends testing representative audio and motion.
  2. Check YouTube’s preview and stream-health messages in Live Control Room. Confirm that the picture, sound, resolution and frame rate are what you expect.
  3. Watch a loop transition. Check that playback returns to the start cleanly and that audio does not disappear, clip or develop a gap.
  4. Watch the VM and encoder output. Look for FFmpeg exit messages, CPU saturation, dropped frames, network interruptions, disk issues and unexpected process termination.
  5. Verify the result before relying on unattended operation. Check the archived result if you have enabled archiving and confirm it contains the expected video and audio. No recovery guarantee follows merely from running the encoder on a VM; plan how you will notice and respond to a failure.

RTMPS or HLS?

Ingest option When it fits Trade-off
RTMPS The straightforward default for a compatible encoder and a looping prerecorded video. YouTube recommends it; the key setup is to use the current Studio ingest details and keep the stream key secure.
HLS A specific encoder or codec requirement makes HLS ingestion useful. YouTube says HLS has higher latency than RTMP and its setup has additional requirements, including TS segments, a rolling media playlist with no more than five outstanding segments, HTTPS POST/PUT, and no byte ranges. See YouTube’s HLS setup instructions.

For a simple loop, prefer RTMPS unless your encoder or use case gives you a concrete reason to use HLS.

Common problems and what to check

  • YouTube does not show an incoming feed: check that the broadcast is ready, the current ingest URL and key were copied correctly, and the encoder is still running. Do not assume a previously copied key or endpoint is still the one Studio expects.
  • Stream health reports connection or bitrate problems: compare actual output settings with YouTube’s current table, inspect the VM’s network and CPU load, and test at a lower resolution or bitrate if the instance cannot sustain the chosen output.
  • Video plays but audio is missing or wrong: verify the input contains the expected audio track and that the encoder’s audio options match its format. Test sound in both the preview and an archived result where available.
  • The VM runs out of CPU or frames drop: lower the encoding workload or choose a machine with capacity for the selected real-time encode. A virtual display helps an app that needs a display; it does not provide GPU acceleration.
  • The loop stops: check FFmpeg’s exit output and the source file’s compatibility, then test the input and loop transition. The loop flag does not provide automatic process restart or YouTube reconnection by itself.
  • The feed stops after a disconnect: inspect the encoder and YouTube health messages, then reconnect using the current Studio settings. Do not rely on automatic recovery unless your encoder workflow explicitly implements and you have tested it.
  • The stream works but the bill is higher than expected: review VM runtime, disk configuration and outbound traffic against your estimate in the current Google Cloud pricing calculator.

Rights and YouTube rules still apply

A file being available to you does not by itself establish permission to broadcast it. Use video and audio you own or are licensed to stream, and check the current YouTube terms and copyright guidance for your circumstances. A prerecorded loop is not exempt from rights or platform rules simply because an encoder sends it as a live feed.

Or let it run in the cloud

If your goal is simply to keep prerecorded video looping on YouTube, StreamNeo is a managed alternative to operating your own VM and encoder: upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home; it streams uploaded video (not a camera feed), at the quality you uploaded up to 4K 60fps for one flat price per slot, with automatic recovery if YouTube drops the stream. The first day is free with no card. Monthly billing is $9.99 per month.

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.

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

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

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
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.