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

To loop a prerecorded video to YouTube Live from a Google Cloud VM, create a YouTube live event, keep the stream key private, and run FFmpeg with the file-loop option -stream_loop -1 and real-time pacing with -re. Choose stream copy only when the source already matches the output requirements; otherwise encode it with settings suited to YouTube’s current codec guidance. A 4K60 stream also needs a VM and network route that can sustain the chosen bitrate. No single VM type is established as sufficient for every source and encoding workload, so test the complete setup before relying on it unattended.

Before you start: source, event, and cloud requirements

Inspect the media file

Check the file’s video and audio codecs, resolution, frame rate, and audio format before choosing an FFmpeg output. If the streams are already compatible with the output you intend to send, stream copy may avoid a costly real-time transcode. If they are not, FFmpeg must encode them, and the required compute capacity depends on the source, codec, settings, and workload. The available guidance does not establish a generally sufficient Google Cloud machine type or GPU for an unspecified file.

Create the YouTube Live event

In YouTube’s live-control workflow, create or schedule the event, then open its stream settings and obtain the ingest URL and stream key. Enter those credentials in FFmpeg’s destination. Treat the key like a password: anyone who has it may be able to send a feed to your event. If it is exposed, reset it in YouTube’s stream settings before continuing. See YouTube’s stream settings guidance.

Check VM access and egress

Provision a Compute Engine VM in the region you plan to use, install FFmpeg, and make sure it can reach YouTube’s ingest endpoint over RTMPS. Confirm that the VM, project quotas, firewall policy, and route permit sustained outbound traffic. Google Cloud describes VM egress limits as dependent on machine and applicable per-instance, per-flow, and project-level limits; a published ceiling is not a guarantee that your chosen stream will run at that rate. See Compute Engine network bandwidth.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
KOTIN Prebuilt Gaming PC RTX 5070 12GB, Ryzen 7 9700X, 32GB DDR5, 1TB SSD
  • POWERED BY RTX 5070 12GB + RYZEN 7 9700X - The GeForce RTX 5070 12GB GDDR7 graphics card pairs with an 8-core AMD Ryzen 7 9700X processor to drive smooth 1440p and 4K gameplay, giving this gaming PC the headroom for modern titles, streaming, and creative work.
  • 32GB DDR5 6000MHz MEMORY & 1TB NVMe SSD - 32GB of high-speed DDR5 memory and a 1TB PCIe 4.0 NVMe solid state drive deliver quick load times, smooth multitasking, and generous storage, keeping this prebuilt gaming desktop responsive under heavy workloads.
  • BUILT-IN 11.3-INCH Smart DISPLAY - An integrated smart screen shows real-time CPU and GPU temperatures, usage, and weather while you play, adding a distinctive and functional touch to your battlestation.
  • 850W 80+ GOLD POWER SUPPLY, 360MM LIQUID COOLING & WiFi 7 - An 850W 80 Plus Gold certified power supply provides stable, efficient power with headroom for future upgrades, while a 360mm AIO liquid cooler, WiFi 7, and an ARGB mid-tower case keep the Ryzen 7 CPU cool and connected in a clean build.
  • READY TO PLAY OUT OF THE BOX - Arrives fully assembled and tested with Windows 11 Home pre-installed, so your prebuilt gaming computer is ready to set up in minutes. Assembled in the USA, and backed by a one-year limited warranty and lifetime free technical support.

Choose stream copy or real-time encoding

When stream copy may work

Stream copy passes the input audio and video through without re-encoding. It is appropriate only when the source’s codecs and characteristics are acceptable for the YouTube ingest settings you intend to use. It does not convert an unsuitable codec, resolution, frame rate, or bitrate into a suitable one.

When to encode

Re-encode when you need a different codec or output characteristics, such as a specific 2160p60 H.264 output. Encoding at 4K60 can be demanding; validate actual CPU or GPU performance with your file and chosen settings. Do not assume that a general-purpose VM or an attached GPU is sufficient without a representative test.

Set YouTube-compatible 4K60 output settings

YouTube’s encoder guidance recommends RTMPS and supports H.264, H.265/HEVC, and AV1; select the recommendation for the codec you actually send. For H.264 at 2160p60, YouTube’s current Help table gives a recommended bitrate of 35 Mbps. That is a codec-specific recommendation, not a universal bitrate for HEVC or AV1. YouTube also specifies constant bitrate (CBR), up to 60 fps, and a two-second keyframe interval that must not exceed four seconds. Consult YouTube’s live encoder settings, bitrates, and resolutions before launch because its applicable codec rows and guidance may change.

Rank #2
msi Codex Z2 Gaming Desktop, AMD R7-8700F, RTX 5070, 32GB DDR5, 2TB SSD
  • POWERHOUSE 8-CORE GAMING PERFORMANCE — Driven by the AMD Ryzen 7 8700F with 8 cores and 16 threads, boosting up to 5.0 GHz for smooth, responsive gameplay and the ability to handle AAA titles, streaming, and background tasks all at once
  • NEXT-GEN BLACKWELL ARCHITECTURE — The NVIDIA GeForce RTX 5070 is powered by NVIDIA's cutting-edge Blackwell GPU architecture, delivering a massive generational leap in rasterization and ray tracing performance so you can experience your games the way they were meant to be played.
  • Simplistic Design: Enjoy the latest generation of Windows 11 Home for your everyday needs. *MSI recommends Windows 11 Pro for business use.
  • Cool While Gaming: In conjunction with an ARGB fan Air Cooler, the Codex R2 features four system cooling fans; three in the front and one in the rear to pull in cool air and push heat out of the PC.
  • Turn on the Bright Lights: With the built-in RGB lighting, take your gaming experience to the next level by pressing the MSI LED button to cycle through lighting options. Customize lighting even further with MSI Center software.

Use the RTMPS ingest URL supplied for your event, not a guessed endpoint. Add the stream key in the destination URL in the format required by that endpoint, and avoid placing the key in shell history, shared logs, or a public script. Test with representative motion and audio; YouTube recommends testing before a live stream and monitoring stream health and messages while it runs. YouTube transcodes received streams into multiple playback formats, so viewers may not see the source resolution immediately.

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

Build and run the FFmpeg loop

Basic loop with stream copy

For a compatible source, the general command shape is:

ffmpeg -stream_loop -1 -re -i "/path/to/video.mp4" -c:v copy -c:a copy -f flv "rtmps://INGEST_URL/STREAM_KEY"

Rank #3
ZOTAC MEK Gaming PC Desktop, Ryzen 7 9800X3D, NVIDIA GeForce RTX 5080 16GB
  • Effortless Gaming: MEK from ZOTAC comes with all hardware and Windows 11 Pro pre-installed. Crafted in the USA, simply unbox, plug in, power up, and dive into your favorite games with ease. Backed by a 1-Year Complete System Warranty and 3-Year GPU Warranty — no registration required.
  • Heart of the MEK: the ZOTAC GAMING GeForce RTX 5080 16GB GDDR7 uses NVIDIA Blackwell architecture with AI-enhanced technologies including DLSS 4 Multi Frame Generation and real-time ray tracing — delivering exceptional 4K gaming performance with AI-driven frame rates and next-gen visual fidelity.
  • Powerful Processor: the AMD Ryzen 7 9800X3D AM5 Desktop CPU — featuring AMD's industry-leading 3D V-Cache technology — delivers up to 5.2GHz with 8 cores, 16 threads, and 96MB L3 Cache for elite gaming performance, seamless multitasking, and professional content creation.
  • Well-Rounded: 32GB DDR5-6000MHz RAM, 2TB NVMe M.2 SSD, and 850W 80+ Gold PSU provide quick loading times and stable power. Connections: HDMI 2.1b, 3x DisplayPort 2.1b (up to 4 displays), USB 3.2 Gen 2 (10Gbps), WiFi 6E, Bluetooth 5.3, 5-Gigabit LAN, 7.1 HD Audio.
  • 360mm AIO Liquid Cooling + Optimized Airflow & Warranty Support: MEK features a powerful 360mm all-in-one liquid cooler with front 2x 120mm Infinity fans and rear 1x 120mm Infinity fan for optimized system airflow, keeping your RTX 5080 and Ryzen 7 9800X3D running at peak performance during extended gaming sessions. Warranty service is provided through ZOTAC USA. Return shipping after warranty service is available only for U.S. addresses.

Replace the file path and destination with your own values. The ingest URL and key must match the YouTube event. FFmpeg’s -stream_loop -1 loops the input indefinitely. Its -re option reads file input at its native frame rate, equivalent to -readrate 1, which is useful to pace file output in real time. These are input options, so place them before the relevant -i. See the FFmpeg command-line documentation.

The example is a command shape, not a guarantee that a particular file will be accepted. If stream copy fails because the source is not compatible with the ingest format or requirements, choose a suitable encoding path rather than assuming the same command can transform it.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Encoding path

For an H.264 2160p60 encode, the output needs to be configured for the source and YouTube’s current H.264 recommendations: CBR, the applicable bitrate target (35 Mbps in YouTube’s guidance for this resolution and frame rate), and a two-second keyframe interval, never over four seconds. Exact FFmpeg codec and hardware-acceleration options depend on the encoder available on the VM and the input file; the official guidance cited here does not establish one universal encoding command or VM configuration. Confirm the encoded output’s resolution, frame rate, bitrate behavior, keyframe spacing, and audio in a test event before using it for an unattended loop.

Rank #4
CyberPowerPC Gaming PC, AMD Ryzen 7 8700F, GeForce RTX 5060 Ti 8GB
  • System: AMD Ryzen 7 8700F 4.1GHz 8 Cores | AMD B850 Chipset | 16GB DDR5 | 1TB PCIe 4.0 NVMe SSD | Windows 11 Home
  • Graphics: NVIDIA GeForce RTX 5060 Ti 8GB Graphics | 1x HDMI | 2x DisplayPort
  • Connectivity: 2 x USB-C 3.2 | 4 x USB-A 3.2 | 2 x USB-A 2.0 | 1 x LAN | WiFi 6 | Bluetooth 5.3 | 7.1 Channel Audio
  • Tempered Side Case Panel | Custom RGB Lighting | Keyboard and Mouse
  • 1 Year Parts & Labor Warranty, Free Lifetime Tech Support

Do not use file pacing for live capture

-re is useful here because the input is a prerecorded file. FFmpeg cautions against low read rates with an actual capture device or live stream because packet loss may result. If you adapt the command to a live input, reconsider the pacing option rather than carrying it over automatically.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test the stream and run it unattended

  1. Start a test event or test stream. Use the same VM, source file, FFmpeg command, codec, bitrate, and destination path planned for the real run.
  2. Check stream health in YouTube Studio. Watch for ingest warnings, dropped frames, or audio/video problems, and review YouTube’s messages while the test is active.
  3. Check the VM during the test. Confirm encoding load (if transcoding), sustained outbound throughput, and that FFmpeg remains running. Test long enough to reach the end of the file and verify that playback returns to the beginning.
  4. Correct failures before leaving it unattended. Lower or change the encode workload if the VM cannot encode in real time; investigate route, quota, and egress constraints if outbound delivery falters. Re-test after changes.

FFmpeg running in a terminal is not by itself a restart strategy. For unattended operation, use a process supervisor or system service appropriate to your VM, arrange logs you can inspect, and decide how you will restart the process after a VM reboot. Keep the stream key out of world-readable service files and logs. YouTube can automatically recover playback formats from a received stream, but that does not remove the need to monitor whether your encoder and VM are still sending.

Troubleshooting common failures

YouTube does not receive a signal

  • Verify that the live event is in the expected state and that you copied its current ingest URL and stream key correctly.
  • Check that the VM can reach the RTMPS endpoint and that its firewall and network policy permit outbound traffic.
  • If the key may have been exposed or changed, reset or recopy it from YouTube’s stream settings.

The stream is unstable or drops frames

  • For encoding, check whether the VM can sustain the workload in real time. A 4K60 transcode may exceed the capacity of a selected machine.
  • For either copy or encode, compare actual sustained outbound delivery with the selected codec’s bitrate recommendation and check applicable Google Cloud egress and quota limits.
  • Use YouTube’s stream-health messages to distinguish ingest problems from encoding or source issues; a documented bandwidth maximum is not proof of achievable throughput on your VM and route.

The video is rejected or does not appear as 4K60

  • Confirm the source properties and whether the command is copying or encoding. Copy mode cannot make a source into 2160p60.
  • Check that the selected codec’s output settings match the relevant YouTube guidance, including CBR and keyframe interval.
  • Allow for YouTube’s processing of received streams into playback formats, and use a test stream to verify what the event actually accepts.

The loop stops at the end of the file

  • Check that -stream_loop -1 is present before the input’s -i option and that FFmpeg is not exiting due to an input, output, or network error.
  • Inspect FFmpeg’s logs and YouTube stream health; infinite input looping does not recover a failed process or network connection by itself.

Estimate the complete Google Cloud cost

There is no defensible single cost for this setup without a region, machine family, disk, encoding workload, stream duration, and current pricing. Compute Engine VM charges are separate from categories such as disks and networking; an attached GPU is charged in addition to the machine type, and internet data transfer out is a separate VPC pricing component. Estimate the full configuration and duration using current regional rates rather than a headline VM price. Review Compute Engine pricing, GPU pricing, and VPC network pricing. The lowest-cost VM that sustains your actual command cannot be identified without testing the representative source and workload.

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 simply to keep prerecorded video live on YouTube, StreamNeo is an alternative to managing a VM and FFmpeg: upload a recording or build a playlist, add your YouTube stream key once, and go live. It loops uploaded videos in StreamNeo’s cloud, so nothing has to stay on at home; it supports whatever quality you upload up to 4K 60fps at one flat price per slot, with automatic recovery if YouTube drops the stream. The first day is free with no card. Monthly service is $9.99 per month. It is for prerecorded videos and YouTube streaming, not camera broadcasting. See StreamNeo or start the free first day.

Quick Recap

Bestseller No. 4
CyberPowerPC Gaming PC, AMD Ryzen 7 8700F, GeForce RTX 5060 Ti 8GB
CyberPowerPC Gaming PC, AMD Ryzen 7 8700F, GeForce RTX 5060 Ti 8GB
Graphics: NVIDIA GeForce RTX 5060 Ti 8GB Graphics | 1x HDMI | 2x DisplayPort; Tempered Side Case Panel | Custom RGB Lighting | Keyboard and Mouse
$1,489.00

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.