DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
DocumentaryTube
DigitalOcean

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

Use FFmpeg’s real-time input and infinite-loop options to send a prerecorded video from a DigitalOcean Droplet to a YouTube Live event, with practical setup, encoder guidance, and recovery caveats.

By DocumentaryTube Team 7 min read

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.

To loop a pre-recorded video on YouTube Live from a DigitalOcean Droplet, run FFmpeg on the Linux server with -stream_loop -1 before the input file and -re to pace playback in real time. In YouTube Live Control Room, create or schedule an event, then copy that event’s current server URL and stream key into the FFmpeg command. The command sends a continuous feed; it does not create or start the YouTube event for you, guarantee a seamless loop, or ensure the event and its archive remain available indefinitely.

What you need before starting

  • A YouTube channel able to create a live event, and a current event server URL and stream key from YouTube Live Control Room.
  • A Linux DigitalOcean Droplet with FFmpeg installed, enough CPU for the encoding settings you choose, and a working network connection.
  • A video file stored on the Droplet or otherwise available to FFmpeg.
  • A plan for monitoring the stream and handling interruptions. A Droplet runs your FFmpeg process, but it does not remove the need to maintain the server or account for YouTube event limits.

A Droplet is the Linux virtual machine doing the encoding and sending. You do not need DigitalOcean’s separate SRS Marketplace image for this direct file-to-YouTube workflow; that image is an optional streaming-server stack, not a prerequisite.

Create the YouTube Live event and get its credentials

  1. In YouTube Studio, choose 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 specific event. Do not use a sample key or assume an endpoint is permanent; use the current values YouTube gives you.
  4. Keep the stream key private. Anyone who has it may be able to send video to the event.

Connecting FFmpeg supplies the encoder feed, but a scheduled workflow may still require you to check the preview and select Go live in Live Control Room. Follow the current controls shown for your event.

Prepare the Droplet and video

Install and verify FFmpeg

Install FFmpeg using the package source appropriate for the Droplet’s Linux distribution, then confirm the installed build includes the codecs and RTMPS support required by your command. Package names and available codec support vary by distribution and build, so verify the result on the server rather than assuming a particular installation includes every encoder.

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.
#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.

Check the source file and workload

Make sure the file is readable from the account that will run FFmpeg. Before a long broadcast, inspect its resolution, frame rate, audio, and codecs, and test with a short private or unlisted event. There is no established minimum Droplet size that guarantees a given resolution: encoding demand depends on the chosen output and the actual server workload. Re-encoding gives you control over the outgoing stream but consumes Droplet CPU.

YouTube recommends testing with movement and audio representative of the intended stream, then watching stream health and encoder warnings. Do not treat a successful connection alone as proof that the video, sound, or bitrate is suitable.

Configure FFmpeg for a real-time loop

Use this schematic command as a starting point, replacing every uppercase placeholder with values for your file, event, frame rate, and current YouTube encoder guidance:

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"

This is an illustrative template, not a tested command for every file or FFmpeg build. The loop option is an input option, so place -stream_loop -1 before the corresponding -i. A value of -1 requests indefinite input looping. -re reads the file at its native real-time pace instead of sending it as fast as the server can process it.

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

Choose an ingestion URL and protect the key

Prefer RTMPS when YouTube offers it. Use the complete current URL and key copied from the event, including the correct host and path; do not type a guessed endpoint or expose the key in a public script, screenshot, or log. YouTube’s RTMPS ingestion requires the rtmps scheme and port 443, with the correct hostname for TLS SNI. FFmpeg describes RTMPS as RTMP carried over a secure SSL connection.

Set frame rate, keyframes, and bitrate deliberately

YouTube’s encoder guidance lists H.264, H.265/HEVC, and AV1, supports up to 60 fps, recommends CBR, and recommends a 2-second keyframe interval that should not exceed 4 seconds. For a 2-second GOP with a 30 fps output, for example, -g 60 is the corresponding frame count; calculate the value from your actual frame rate rather than copying that example blindly. Choose the video bitrate from YouTube’s current resolution/frame-rate guidance and confirm the Droplet and its network path can sustain it. AAC or MP3 audio is supported for RTMP/RTMPS.

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.

Re-encode or stream-copy?

The template re-encodes to H.264 video and AAC audio. This is a controllable starting point when source compatibility is uncertain, but encoding costs CPU. If the file already has compatible codecs and timestamps, stream-copying may reduce encoding load; it is not established as reliable for every file or ingest condition. Test that approach with the exact source and event before relying on it.

Start FFmpeg and bring the event live

  1. Run the command on the Droplet and keep the process in a session or service arrangement you can monitor. A disconnected terminal should not be mistaken for a healthy stream.
  2. Watch FFmpeg output for connection failures, timestamp problems, encoder overload, or a nonzero exit status.
  3. Open the event in Live Control Room. Check the preview and stream-health indicators; resolve encoder warnings before relying on the broadcast.
  4. If the event is scheduled and YouTube requires it, select Go live after confirming the preview.
  5. Observe at least one file boundary. A loop repeats the file, but it does not remove a hard cut, silence gap, or abrupt audio transition at the end-to-start point.

Plan for interruptions and long runtimes

-stream_loop -1 describes what FFmpeg does with its input while the process is running. It does not automatically restart FFmpeg after a server reboot or process failure, recover every dropped YouTube connection, or guarantee that a YouTube live event remains open forever. For a long-running channel, decide how you will detect a failed process or ingest, restart the encoder, and verify the event state. Test that recovery procedure rather than assuming the loop flag provides it.

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

YouTube says streams under 12 hours are automatically archived. That does not establish that one event can run indefinitely or that broadcasts longer than that will be archived. If a continuous broadcast matters, plan sessions and archive handling around the event’s intended runtime, and verify current YouTube behavior before committing to a longer session.

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 failures

Symptom Likely area to check What to do
FFmpeg cannot connect or YouTube receives no feed Event credentials, URL, network, or RTMPS configuration Copy the current server URL and key again from the correct event. Check for typos in the host and path, confirm the URL uses the offered RTMPS endpoint, and ensure outbound access to port 443.
YouTube preview appears, but the event is not publicly live Event workflow Check Live Control Room. A scheduled stream may require preview verification and an explicit Go live action.
Video or audio is missing, rejected, or unhealthy Codec, output settings, or source file Check FFmpeg’s output and YouTube’s encoder warnings. Test representative motion and sound; confirm the selected codec, bitrate, frame rate, and keyframe interval meet current guidance.
Droplet is overloaded or frames are late Encoding workload Re-encoding can be CPU-intensive. Check the server’s actual load and simplify or adjust the encoding workload, or test stream-copying if the source codecs and timestamps are compatible.
The stream stops after a disconnect or restart Process and recovery plan Check FFmpeg’s exit status and logs, then restart the process and confirm the YouTube event is still usable. The loop option does not itself restart a failed process or guarantee automatic reconnection.
The repeated video has an obvious jump or audio gap File boundary Inspect the end and start of the source file. Looping repeats the file as-is; edit or replace the media if the transition needs to be smoother.

Copyright and channel-policy checks

Streaming a file you can play locally does not establish that you have the rights to broadcast it. Before going live, confirm you have permission for the video, music, and any other included material, and review YouTube’s current copyright and monetization rules. Repeatedly broadcasting a pre-recorded file also does not guarantee monetization eligibility; assess the channel and content under YouTube’s current policies rather than assuming that a live format changes the rules.

Cost and operating trade-offs

A self-managed Droplet gives you command-line control, but its total cost is not just the virtual machine: include the server, storage for the media, bandwidth where applicable, and the time spent maintaining FFmpeg and recovery. The available evidence does not establish a current Droplet price, a reliable minimum server size, or a workload-specific performance guarantee. DigitalOcean also offers an SRS Marketplace image with bundled FFmpeg and streaming-server features, but it is optional and its listed software versions should not be treated as current without checking the listing.

If you prefer not to maintain a server, YouTube’s encoder help identifies Gyre as a cloud-based prerecorded-video streaming tool. This article does not establish its current pricing, feature set, availability, or terms, so compare those details directly before choosing it.

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.

Or let it run in the cloud

With StreamNeo, upload your recording or build a playlist, add your YouTube stream key once, and go live. It loops uploaded videos from the cloud, so nothing has to stay on at home. Each slot streams the video as uploaded, up to 4K 60fps, at one flat price per slot rather than quality tiers; if YouTube drops the stream, StreamNeo automatically recovers. The first day is free with no card, one free day per account. Monthly pricing is $9.99 per month.

StreamNeo is for YouTube prerecorded-video streams, not camera broadcasts or other platforms. See StreamNeo or start your free 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

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.