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
DigitalOcean

How to Loop Pre-Recorded Videos on YouTube Live with FFmpeg on a DigitalOcean Droplet

Use a DigitalOcean Droplet to loop a prerecorded video to YouTube Live with FFmpeg, while understanding the event setup, encoder settings and runtime limits.

By VGSources Team 6 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 DigitalOcean Droplet, create a YouTube live event, copy its current RTMPS server URL and stream key, then run FFmpeg with -stream_loop -1 to repeat the file and -re to send it at real-time speed. The Droplet runs the encoder; YouTube still controls when the event starts, how long it remains live, and whether it is archived.

What you need before starting

  • A YouTube channel with access to live streaming and a live event created or scheduled in YouTube Studio.
  • A Linux DigitalOcean Droplet with FFmpeg installed and enough CPU capacity for your chosen encoding settings. No minimum Droplet size is established here; test the actual workload before relying on it.
  • A video file accessible from the Droplet and a network path capable of sustaining the selected output bitrate.
  • The event’s current YouTube ingestion URL and stream key. Treat the key as a password: someone who has it may be able to send video to your event.

A Droplet is the virtual machine that runs FFmpeg. You can send the file directly from FFmpeg to YouTube; DigitalOcean’s separate SRS Marketplace image is optional, not a requirement for this workflow. See DigitalOcean’s FFmpeg tutorial, the SRS Marketplace listing, and DigitalOcean’s Droplet limits for their respective details.

Create the YouTube Live event and get its stream details

  1. In YouTube Studio, select Create → Go Live.
  2. Use the Stream tab to create a new event, or the Manage tab to schedule one.
  3. Copy the server URL and stream key shown for that event. Use the values YouTube currently displays rather than a sample endpoint or an assumed permanent URL.
  4. For a scheduled stream, be prepared to confirm the incoming preview and select Go live in Live Control Room when the event is ready. Sending video from FFmpeg does not necessarily start a scheduled event by itself.

YouTube recommends RTMPS. Its ingestion guidance requires an RTMPS address with the correct hostname, path and key, using port 443; the hostname matters for TLS SNI. Consult the current YouTube encoder settings and YouTube live-stream ingestion protocol guide when setting up the event. FFmpeg describes RTMPS as RTMP over a secure SSL connection in its protocol documentation.

Prepare and check the video

Make sure the media file is on the Droplet or otherwise reachable by FFmpeg. Before committing to a long broadcast, run a short test with representative motion and audio. Confirm that YouTube accepts the incoming feed and that the resulting picture and sound are correct.

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.

YouTube’s current encoder guidance lists H.264, H.265/HEVC and AV1 video, up to 60 fps, constant bitrate (CBR), and a recommended keyframe interval of 2 seconds that should not exceed 4 seconds. AAC or MP3 audio is supported for RTMP/RTMPS. Choose a bitrate from the current YouTube resolution and frame-rate table, then check that the Droplet can encode at that rate and its outbound connection can sustain it. Requirements can change, so use the current YouTube settings guide rather than treating an example bitrate as universal.

Run FFmpeg with an indefinite input loop

Use -stream_loop -1 before the input it applies to. The -re option reads the file at its native rate so FFmpeg sends it as live media rather than as fast as the server can process it. This illustrative command re-encodes video as H.264 and audio as AAC:

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.
ffmpeg -re -stream_loop -1 -i "/path/to/video.mp4" 
  -c:v libx264 -preset veryfast -b:v VIDEO_BITRATE -maxrate VIDEO_BITRATE -bufsize BUFFER_SIZE 
  -g GOP_FRAMES -c:a aac -b:a 128k 
  -f flv "rtmps://YOUTUBE_INGEST_HOST/YOUTUBE_PATH/STREAM_KEY"
  • Replace /path/to/video.mp4 with the real path to your file.
  • Replace VIDEO_BITRATE and BUFFER_SIZE with values selected for your target output and YouTube’s current guidance.
  • Replace GOP_FRAMES with the number of frames in a 2-second interval: for example, 60 frames at 30 fps. Choose the value for your actual frame rate; the example is not universal.
  • Replace the RTMPS host, path and stream key with the exact event details from YouTube. Keep the key private.
  • Check that your installed FFmpeg build includes the encoder and RTMPS support required by the command.

This is a command template, not a tested command for every FFmpeg build, input file or Droplet. Re-encoding gives you control over the outgoing format but uses server CPU. If a file already has compatible codecs and timestamps, stream-copying may reduce encoding load, but its compatibility depends on the file and ingest conditions; test it before relying on it. DigitalOcean’s tutorial documents -stream_loop -1 for repeating an input indefinitely; check syntax against the FFmpeg version installed on your server. See the FFmpeg documentation.

Start the stream and monitor it

  1. Run the command in a terminal session on the Droplet and watch FFmpeg’s output. Check for connection failures, timestamp warnings, encoder overload and unexpected process exit.
  2. Open the event in YouTube Live Control Room. Confirm that the preview appears and review stream health and encoder warnings.
  3. If the event is scheduled and the interface requests it, select Go live after checking the preview.
  4. Observe at least one file boundary. -stream_loop -1 repeats the input, but does not make the transition seamless; the end-to-start cut or audio may be noticeable.

YouTube recommends testing with representative motion and audio and monitoring stream health during the broadcast. Keep the Live Control Room open when practical so you can see warnings and event status.

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.

Understand what looping does—and what it does not

-stream_loop -1 makes FFmpeg repeat the input; it does not guarantee that the YouTube event stays live indefinitely, that FFmpeg survives a server or network failure, or that YouTube keeps an archive forever. YouTube says streams under 12 hours are automatically archived. That statement is not a promise of an indefinitely running event or an archive for streams lasting 12 hours or longer. For longer broadcasts, plan how you will stop and restart sessions, and verify current YouTube behavior for your intended runtime in the YouTube live-streaming instructions.

Also check YouTube’s policies before streaming prerecorded material. Having a working encoder does not grant rights to music, gameplay footage or other material in the video, and repeating content does not by itself establish eligibility for monetization. Review YouTube’s channel monetization policies and obtain the rights or permissions needed for the content you broadcast.

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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common problems

  • YouTube shows no preview or FFmpeg cannot connect: re-copy the server URL and key for the correct event; check the RTMPS hostname, path and port 443; confirm that the Droplet can reach the endpoint and that the FFmpeg build supports RTMPS.
  • The stream connects but YouTube reports poor health: compare resolution, frame rate, bitrate, CBR and keyframe interval with YouTube’s current guide. Check whether the Droplet is CPU-bound or its network path cannot sustain the output.
  • The picture or sound is missing or rejected: verify the source file and chosen codecs. Re-encoding to a supported video and audio format can help when source compatibility is uncertain, but it increases CPU use.
  • The command exits or stops looping: inspect FFmpeg’s last log lines for file-access errors, timestamp issues or an encoding failure. Confirm the input path is readable and that -stream_loop -1 appears before the corresponding -i.
  • The loop has a jarring cut: the loop repeats the file; it does not edit the boundary. Adjust the source video and audio if you need a smoother transition, then test the revised file.
  • The feed arrives, but the event is not public/live: check the event state in Live Control Room. A scheduled workflow may require you to verify the preview and explicitly start the event.

Or let it run in the cloud

If maintaining a Linux server and FFmpeg process is more work than you want, StreamNeo is a cloud service for keeping a YouTube channel live from uploaded videos. Upload a recording or make a playlist, add your YouTube stream key, and go live. It loops the video in the cloud, so nothing has to stay on at home. Any quality up to 4K 60fps streams as uploaded at one price per slot, and StreamNeo automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly is $9.99 per month.

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.

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 *

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.

More from Patch Notes

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.