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

How to Stream Prerecorded Video to YouTube 24/7 with FFmpeg on Linux

Use FFmpeg’s real-time input and infinite-loop options to send prerecorded video to YouTube Live, then test the preview and plan for host, network, and process failures.

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

You can loop a prerecorded video to YouTube Live with FFmpeg on Linux by reading the file in real time, encoding it to a YouTube-compatible format, and sending it to the ingest URL with your stream key. The basic loop is -re -stream_loop -1. Keeping that feed live around the clock also requires a dependable host and connection, process monitoring, and a plan for recovery; the FFmpeg command alone does not guarantee uninterrupted uptime or monetization eligibility.

What you need before you start

  • A Linux host that can stay on, run FFmpeg continuously, and sustain the required upload rate. It can be a computer you manage or a server; there is no universal hardware specification for every source video and encoding configuration.
  • A prerecorded video file accessible to the account running FFmpeg.
  • A YouTube channel able to create an encoder stream in YouTube Studio.
  • The stream URL and stream key from YouTube Studio’s Live Control Room.
  • An FFmpeg build with the required input, video encoder, audio encoder, and output protocol support. Linux distributions package FFmpeg differently, so verify what your installed build supports rather than assuming it includes a particular encoder.

This setup sends video from a file; it is not a camera broadcast. If FFmpeg re-encodes the source, the host needs enough CPU for that work as well as enough network capacity for the outgoing stream.

Create the YouTube Live stream and protect its key

  1. In YouTube Studio, open Go Live. Create an encoder stream or schedule one from the Manage tab. Scheduling can let viewers see an upcoming stream and opt into reminders.
  2. Open the stream’s Stream settings in Live Control Room. Copy the stream URL and select or copy the stream key associated with that stream.
  3. Use the exact endpoint and key YouTube displays. Prefer the RTMPS endpoint if your FFmpeg build supports it; RTMPS encrypts the encoder-to-YouTube connection.
  4. Treat the key as a password. Do not publish it in shell history, scripts, logs, screenshots, or process listings. Restrict access to any configuration file that holds it. If it is exposed, reset it in Live Control Room.

YouTube describes stream keys as “your YouTube stream’s password and address.” Keep the key private even on a server you administer, and be especially cautious on shared hosts.

Check FFmpeg and prepare the source

Confirm FFmpeg is installed and inspect the encoders available in your build before choosing a command. For example, ffmpeg -version identifies the build, while ffmpeg -encoders lists its encoders. The command below uses libx264 for H.264 video and AAC for audio; it will not work as written if the build lacks those encoders.

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 input’s resolution, frame rate, and audio tracks. The example targets 1080p at 30 frames per second, so it is a reasonable starting point only when your source and encoding capacity suit that target. It does not include a scaling filter: if the source is a different size, decide whether to keep its dimensions or explicitly scale it. Avoid upscaling solely to claim a higher resolution.

Loop one video to YouTube with FFmpeg

Replace the file path, ingest endpoint, and key placeholder below with your own values. Do not paste a real key into a public tutorial or shared shell session.

ffmpeg -re -stream_loop -1 -i "/path/to/video.mp4" 
  -map 0:v:0 -map 0:a:0? 
  -c:v libx264 -preset veryfast -pix_fmt yuv420p 
  -r 30 -g 60 -b:v 14M -maxrate 14M -bufsize 28M 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "rtmps://INGEST_HOST/APP/STREAM_KEY"

-re paces file input at its normal real-time rate instead of sending it as quickly as the machine can read it. -stream_loop -1 tells FFmpeg to repeat that input indefinitely. Both are input options, so they appear before -i. The optional ? in -map 0:a:0? means FFmpeg will not fail just because the file has no first audio stream; check the resulting preview and audio if your source is silent or has multiple tracks.

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.

The output options re-encode video as H.264 and audio as AAC, package them in FLV format, and send them to the supplied RTMPS address. The example’s 14 Mbps video bitrate corresponds to YouTube’s published H.264 recommendation for 1080p at 30 fps, not a guarantee of quality or a setting for every source. YouTube’s current encoder guidance, accessed October 3, 2026, lists 5 Mbps minimum and 14 Mbps recommended for H.264 at 1080p30. It recommends a two-second keyframe interval and advises not to exceed four seconds; with -r 30, -g 60 sets a 60-frame GOP, or two seconds. Use the current YouTube table for your chosen codec, resolution, and frame rate, and leave upload headroom above the stream bitrate.

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

For reference, YouTube’s published H.264 guidance includes these ingest figures. They are platform recommendations, not a promise of what viewers will receive:

Output Minimum video bitrate Recommended video bitrate
720p at 30 fps 3 Mbps 8 Mbps
1080p at 30 fps 5 Mbps 14 Mbps
1080p at 60 fps 6 Mbps 17 Mbps
1440p at 30 fps 7 Mbps 21 Mbps
2160p (4K) at 30 fps 11 Mbps 42 Mbps

YouTube’s table varies by codec and frame rate; these rows are H.264 guidance and are not a substitute for checking the current table for your exact output. YouTube lists H.264, H.265/HEVC, and AV1 as RTMP/RTMPS video codec options, frame rates up to 60 fps, AAC or MP3 audio, and constant-bitrate encoding. Match the settings to your encoder build and the stream’s actual configuration rather than copying a bitrate from a different row.

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.

Start the feed, inspect it, and begin the broadcast

  1. Start FFmpeg and check its output for input, encoder, or connection errors.
  2. In Live Control Room, wait for the incoming preview. Check both picture and sound, then inspect stream health.
  3. When the preview is right, start or confirm the broadcast in Live Control Room as appropriate for the stream settings. YouTube provides auto-start and auto-stop controls in stream settings; the exact interface behavior can change.
  4. Monitor the stream after it begins, including the host’s CPU, network, available disk space, and FFmpeg process. YouTube advises testing before going live and monitoring audio and video quality.

Test the entire path before promoting the stream. An FFmpeg process that has started is not proof that YouTube is receiving a healthy picture and audio feed.

Run it continuously and recover from interruptions

A 24/7 feed depends on more than the loop option. The host must remain powered and reachable, FFmpeg must continue running, the source file must remain readable, and the upstream connection must sustain the selected bitrate. If you transcode, CPU capacity matters; long-running logs and disk use also need attention.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Supervise the process. Use a service manager or another process supervisor to detect an exited encoder and attempt a restart. Test the restart behavior rather than assuming it works.
  • Keep logs and alerts useful. Log enough to diagnose disconnects or encoder errors, but do not write the stream key into logs or expose it through scripts or screenshots.
  • Plan for the failure you have. FFmpeg’s FIFO muxer documents recovery options for retrying an RTMP output after a temporary network failure. That can help with a transient output interruption; it does not fix a failed host, unreadable source file, invalid key, disabled stream, or YouTube-side interruption.
  • Test the connection under sustained load. A brief speed test is not proof that the host can sustain the selected upload rate continuously. Allow headroom and check for provider limits if you use a VPS or dedicated server.

A Linux computer you already manage and a rented server are both possible operating choices, but neither has a universally correct specification. Compare sustained upload capacity, encoding headroom, storage, restart controls, uptime expectations, administration work, and provider terms for your own stream.

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

Use a playlist instead of a single file

A single file is the simplest case: -stream_loop -1 repeats it. A playlist needs more preparation. FFmpeg’s concat demuxer expects input files to have compatible stream layouts and timing properties; clips with different codecs, frame rates, resolutions, audio layouts, or time bases can produce failures or poor transitions.

Before relying on a multi-file sequence, normalize the clips to consistent video and audio properties, test the transitions, and run the complete playlist long enough to catch issues at the end and on repeat. Community discussion on the FFmpeg user mailing list in September 2024 describes problems with mixed-format concatenation and recommends normalization; treat that as practical guidance, not a guarantee that every playlist will concatenate cleanly.

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

Know YouTube’s long-stream and content limits

YouTube says streams under 12 hours are automatically archived. Do not assume an arbitrarily long 24/7 broadcast will become one complete archive. For streams longer than 12 hours, DVR may be limited or unavailable, and viewers cannot seek to a point before the live stream began.

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.

A technical ability to loop prerecorded footage does not establish that a channel or its content qualifies for monetization, or that it complies with every YouTube policy. Check current YouTube content and monetization policies for the actual footage, music, rights, and channel. Repeatedly broadcasting material you do not have permission to use creates copyright risk; a working stream key does not grant content rights.

Troubleshooting common FFmpeg-to-YouTube problems

Symptom Likely cause What to check
FFmpeg says an encoder is unavailable The installed build does not include the selected encoder. Check ffmpeg -encoders. Install or build a version with the required encoder, or choose one your build supports and confirm YouTube accepts it.
No incoming preview or a connection error Wrong ingest URL or key, an unsupported endpoint, a network problem, or a stream not ready to receive the feed. Copy the current URL and key from Live Control Room, use RTMPS when supported, confirm outbound connectivity, and check the FFmpeg error output.
YouTube reports poor stream health Bitrate, codec, frame rate, or keyframe interval may not match the current ingest guidance; the network may lack headroom. Compare the actual output settings with YouTube’s current table for the codec and frame rate, and test sustained upload capacity.
Video works but audio is missing The source may lack an audio track, the wrong track may be mapped, or the audio encoder/output may be incompatible. Inspect the source streams, verify the audio mapping and encoder, and listen to the Live Control Room preview before broadcasting.
The feed stops after a disconnect FFmpeg exited or its output could not recover from the network interruption. Inspect logs and host/network health. Test a supervisor restart or FFmpeg’s documented FIFO recovery options for transient RTMP failures; neither handles every failure type.
A playlist fails or has rough transitions Inputs may differ in stream layout, timing, resolution, frame rate, or audio properties. Normalize the clips to consistent properties and test the whole sequence, including its transition back to the first item.

Or let it run in the cloud

If the goal is a YouTube channel that stays live without leaving a Linux machine running, StreamNeo is a cloud alternative: upload a recording or build a playlist, add your YouTube stream key once, and go live. It plays uploaded videos rather than broadcasting from a camera, and it streams to YouTube.

  • Your computer and home connection do not have to stay on.
  • Any quality up to 4K at 60 fps streams as uploaded, with no re-encode and one flat price per slot.
  • It automatically attempts recovery if YouTube drops the stream.
  • The first day is free with no card. One free day is available per account.
  • Each slot includes one always-on stream, 10 GB storage per slot pooled across active slots, 24/7 looping and playlists, automatic recovery if YouTube drops, and StreamNeo team support. The product is the same on every plan; only the billing length changes.

Billing options are a day, a week, a month, six months, or a year; cancel any time. UPI and cards are accepted in India, and card checkout is available worldwide. Contact support for five or more slots. Monthly pricing is $9.99 per month. Start the free first 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 *

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.

More from the Screening Room

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver 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.