October 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 PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
FFmpeg

How to Loop a YouTube Live Stream from a VPS with FFmpeg

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

To loop a prerecorded video from a VPS to YouTube Live, run FFmpeg with -stream_loop -1 and -re, then publish to the RTMPS URL and stream key shown in YouTube Live Control Room. This can repeat an authorized video while the process runs, but the command alone does not guarantee an uninterrupted 24/7 broadcast or establish that continuous looping complies with YouTube’s current rules.

What you need before you start

  • A VPS with the video file stored locally and enough sustained CPU capacity for the encoding settings you choose.
  • Sustained outbound bandwidth sufficient for the selected stream bitrate. There is no universal VPS minimum in the cited YouTube guidance; compare the server’s actual capacity with your planned workload and test it.
  • FFmpeg installed, and a video you have permission to broadcast. Check that the file opens and contains the expected audio and video streams.
  • A YouTube Live stream configuration, its stream key, and the RTMPS URL displayed in Live Control Room.

Get the YouTube RTMPS destination

  1. In YouTube Live Control Room, create or select the stream you intend to use.
  2. Copy the stream key and the RTMPS server URL for that stream configuration. YouTube Help says the URL can be shown by clicking the lock icon beside “Stream URL.” Use the destination provided for your broadcast rather than copying an address from an unrelated tutorial. YouTube Help: Encrypt your stream using RTMPS
  3. Keep the key private. Do not put it in a public script, repository, log, or screenshot. Anyone with access to it may be able to publish to your stream.

RTMPS carries RTMP over TLS/SSL. For YouTube, use the exact valid ingestion host and application path supplied in Live Control Room, the rtmps protocol, and port 443. The URL shown there is authoritative. Google for Developers: Delivering Live YouTube Content via RTMPS

Build the FFmpeg loop command

The basic command pattern is:

ffmpeg -re -stream_loop -1 -i /path/to/authorized-video.mp4 [encoding and audio/video options] -f flv 'rtmps://HOST:443/APP/STREAM_KEY'

This is a template, not a universal copy-and-paste command. Replace the file path and destination with your own values, and supply encoding options appropriate to the source and YouTube’s current encoder guidance. The RTMPS URL may include the stream key, so treat the complete destination as secret.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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.

Why the input options are placed first

  • -re reads the input at its native frame rate rather than sending a file as fast as the server can process it.
  • -stream_loop -1 tells FFmpeg to loop the input indefinitely.
  • Both are input-specific options, so place them before the -i for the file they apply to. FFmpeg options are order-sensitive.

See the FFmpeg documentation for option behavior. The command’s final -f flv selects the output format used by this RTMP-style publishing workflow; the destination must still be the exact RTMPS endpoint and key from Live Control Room.

Choose settings YouTube and the VPS can sustain

Check YouTube’s current encoder table for the resolution and bitrate you plan to send. Its guidance covers RTMP/RTMPS, H.264, H.265 and AV1 video, AAC or MP3 audio, and frame rates up to 60 fps. YouTube recommends a two-second keyframe interval and says it should not exceed four seconds. Choose settings that match the selected stream configuration and that the VPS can encode while maintaining the required outbound connection. YouTube Help: Choose live encoder settings, bitrates, and resolutions

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.
  • Resolution and bitrate: Consult YouTube’s current table for the resolution you select; do not assume a VPS can sustain a particular bitrate without checking its network capacity.
  • Encoding load: Software encoding uses server CPU. If the VPS cannot encode reliably at the chosen quality, lower the workload or use a server with suitable sustained capacity.
  • Test first: YouTube recommends testing before going live and monitoring stream health. A speed test can help assess upload capacity, but it does not replace observing the actual stream.

YouTube transcodes incoming streams for viewers, but that does not remove the need for a stable, correctly configured input stream.

Start the stream and verify it

  1. Run the completed FFmpeg command on the VPS.
  2. Watch FFmpeg’s output for connection or encoding errors, then check Live Control Room to confirm that YouTube is receiving a healthy signal.
  3. Monitor both the process and stream health rather than assuming that a successful initial connection will persist.
  4. If you use a service manager or process supervisor, configure it to restart a crashed process and test the recovery path. A restart supervisor does not guarantee an uninterrupted broadcast, that YouTube will accept a continuous stream, or that a restarted process resumes the same broadcast.

Troubleshoot common connection and playback problems

Connection timeout or SSL error

Check that the copied destination uses rtmps, the exact host and application path shown in Live Control Room, and port 443. Confirm that the encoder and VPS network support the RTMPS connection. YouTube describes RTMPS as its recommended secure option for ordinary content. YouTube Help: Encrypt your stream using RTMPS

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.

YouTube does not receive a healthy signal

Check that the stream key belongs to the selected stream configuration, the destination URL is complete, and the VPS can sustain the configured upload bitrate. Recheck the video and audio settings against YouTube’s current encoder table, then test again while watching stream health.

The file does not loop or runs at the wrong speed

Confirm that -stream_loop -1 and -re appear before the relevant -i input. Verify the source path and that FFmpeg can read the file’s audio and video streams. A misplaced input option may not affect the file you intended.

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

The process stops or the stream drops

Inspect FFmpeg output and the VPS process state to distinguish an encoding failure from a network or ingest interruption. A supervisor can restart a failed process, but the available technical guidance does not establish that any restart preserves the same YouTube broadcast or prevents a gap.

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

RTMPS, HLS, and DASH: which should this workflow use?

YouTube lists RTMP, RTMPS, HLS, and DASH as ingestion protocols, with different capabilities. RTMPS is the straightforward default for this FFmpeg looping-file setup. Consider HLS or DASH only if their documented features meet a specific need, since protocol choice can change latency and implementation requirements. Google for Developers: YouTube Live Streaming Ingestion Protocol Comparison

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.

Continuous streaming, policy, and cost considerations

Running FFmpeg with an infinite input loop does not settle whether a continuously repeated prerecorded broadcast is allowed for your content, how long a live broadcast may run, or whether YouTube will accept a process restart as the same broadcast. Check YouTube’s current rules and requirements for your intended use; technical ingestion documentation alone does not answer those policy questions.

Budget for the VPS and its network capacity, as well as any operational time needed to monitor and recover the process. No specific provider, server minimum, cost, uptime, or reliability level is established here. A working command proves only that the chosen setup can connect under the conditions tested.

Or let it run in the cloud

If your goal is a continuously looping prerecorded YouTube stream without keeping a VPS or home computer running, StreamNeo is the cloud alternative: upload a recording or build a playlist, add your YouTube stream key once, and go live. It runs the loop from the cloud, supports the uploaded quality up to 4K 60fps at one flat price per slot, and automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly pricing is $9.99 per month. It plays uploaded videos and streams to YouTube only. Start your free day with StreamNeo.

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.

Read next

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.