Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
24/7 streaming

How to Set Up a YouTube 24/7 Stream with FFmpeg on Ubuntu

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

You can loop a video file from Ubuntu into YouTube Live with FFmpeg by enabling live streaming, retrieving the stream URL and key from YouTube Studio, and publishing a real-time H.264/AAC stream over RTMPS. The loop can repeat the file, but it cannot guarantee an uninterrupted broadcast: you still need adequate upload capacity, a tested stream, monitoring, and a plan for failures.

Before you start

  • An Ubuntu machine or server that can stay online, with access to the video file and a stable internet connection.
  • FFmpeg installed for your Ubuntu release. Installation commands and option availability vary by Ubuntu release and FFmpeg build, so check the package and build you actually use rather than relying on an unverified version-specific command.
  • A YouTube channel eligible to stream live. YouTube requires channel verification and no live-stream restriction in the previous 90 days. First-time live activation may take up to 24 hours. YouTube Help: Get started with live streaming.
  • A video file with usable video and audio streams, if audio is intended.

Enable YouTube Live and get the ingest details

  1. Sign in to YouTube Studio and open Live Control Room.
  2. Create a stream or select the stream setup you intend to use. Copy the ingest URL and its matching stream key from the current setup.
  3. Keep the stream key private. Treat it like a password: do not put it in a public script, repository, screenshot, or article, and reset it in YouTube Studio if it is exposed. See YouTube Help: Manage your stream key.
  4. If this is the channel’s first live stream, allow up to 24 hours for activation before troubleshooting FFmpeg.

Choose a format and bitrate your connection can sustain

YouTube’s encoder guidance lists H.264 video, CBR, AAC or MP3 audio, and a recommended keyframe interval of 2 seconds, not exceeding 4 seconds. YouTube recommends RTMPS for encrypted delivery to its servers. Use the ingest URL shown for your stream and verify that your FFmpeg build supports the chosen protocol. Current encoder settings are documented in YouTube Help: Encoder settings for live streaming.

H.264 format YouTube recommended video bitrate
480p at 30 fps 5 Mbps
1080p at 30 fps 10 Mbps
1080p at 60 fps 17 Mbps

These are YouTube recommendations, not a promise that the source or your connection will produce a particular result. Other supported codec recommendations differ; consult YouTube’s current settings table for your selected codec and format. YouTube also recommends 20% upload headroom. That margin is important because other devices and applications may share the connection; YouTube cautions that the total stream bitrate cannot exceed available upload bandwidth. Test sustained upload under representative conditions and account for other traffic before choosing a bitrate. See encoder settings and YouTube Help: Streaming tips.

Publish a looping file with FFmpeg

The following is an illustrative command, not a tested recipe. It combines FFmpeg’s real-time input pacing and input looping with RTMP-style publishing. It assumes a 30 fps output, making a 60-frame GOP approximately two seconds. Adjust the GOP to match the actual output frame rate, and choose a bitrate appropriate for the selected resolution and measured upload capacity.

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.
ffmpeg -re -stream_loop -1 -i video.mp4 
  -c:v libx264 -preset veryfast 
  -b:v 4500k -maxrate 4500k -bufsize 9000k -g 60 
  -c:a aac -b:a 128k 
  -f flv "$YOUTUBE_RTMPS_URL/$YOUTUBE_STREAM_KEY"

Set YOUTUBE_RTMPS_URL to the ingest URL supplied by YouTube and YOUTUBE_STREAM_KEY to the matching key. Confirm the exact RTMPS URL format expected for your current stream setup and FFmpeg build; do not assume every key or endpoint uses an identical URL shape. Keep real credentials out of shell history and logs as well as public files. FFmpeg documents real-time RTMP publishing in its protocol documentation and input looping in its main manual.

In this example, -re reads input at its native rate rather than sending it as fast as possible; -stream_loop -1 requests indefinite input looping; -c:v libx264 encodes H.264; -b:v and -maxrate set the target and maximum video rate; -bufsize sets the rate-control buffer; -g sets the GOP length in frames; -c:a aac and -b:a set AAC audio and its bitrate; and -f flv selects the output container used by this RTMP publishing pattern. The example’s bitrate values are illustrative, not a universal YouTube setting. Its filters, input compatibility, codec availability, looping behavior, and RTMPS handling need to be checked on your actual media and installation.

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.

Verify the live output before leaving it running

  1. Start the command and watch FFmpeg’s output for input, encoding, or connection errors.
  2. Open the stream in YouTube Live Control Room. Confirm that the preview appears and that video and audio are present as intended.
  3. Check YouTube’s stream health indicators and verify that the selected resolution and frame rate are being received. Test the complete path before relying on the broadcast, as recommended in YouTube’s streaming tips.
  4. During operation, monitor both the encoder process and YouTube’s stream health. A process supervisor can restart an exited process, but it cannot correct a bad key, unsupported media, insufficient upload capacity, a channel restriction, or an ongoing network outage.

Plan for long-running operation and platform limits

A file loop only repeats that file. It does not provide a playlist scheduler, alternate source, alerting, or a repair for a damaged or incompatible media file. Decide separately how you will observe failures and respond to them. Restarting FFmpeg blindly may simply repeat the same failure or create a new stream session that needs attention in Live Control Room.

YouTube says streams under 12 hours are automatically archived. Do not assume a broadcast that runs longer than 12 hours will be archived as one complete video; plan stream-session management and check current YouTube behavior if a complete archive matters. YouTube Help: Create a live stream with an encoder.

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.

Common problems and what to check

Symptom Likely checks and next step
YouTube does not show an incoming stream Confirm live streaming is enabled, use the current ingest URL and matching key, and verify the endpoint format and RTMPS support in the installed FFmpeg build.
FFmpeg exits immediately or reports input errors Check the file path and permissions, then confirm the file contains decodable video and any expected audio stream. Test the media independently before starting the live output.
Stream health is poor, unstable, or drops Lower resolution, frame rate, or bitrate until the connection sustains the stream with YouTube’s recommended 20% upload headroom. Retest with other household or server traffic included.
Video arrives but audio does not Check that the input has an audio stream and that the audio codec and mapping are compatible with the output. The illustrative command assumes audio is present.
The process restarts but the broadcast still fails A restart only helps when FFmpeg exited and the underlying cause is transient. Check credentials, media compatibility, channel eligibility, available upload bandwidth, and network status before relying on repeated restarts.
The archive is incomplete or split Review the stream’s duration and session handling. YouTube’s automatic archive statement applies to streams under 12 hours; do not presume a longer session produces one complete archive.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or let it run in the cloud

If you do not want to keep an Ubuntu computer or server running, StreamNeo is a cloud option for looping uploaded videos to YouTube. Upload a recording or build a playlist, add your YouTube stream key once, and go live; the cloud keeps it running without a computer or home connection staying on. It streams the uploaded video as made, up to 4K 60fps, at one flat price per slot; it automatically recovers if YouTube drops the stream. The first day is free with no card required. Monthly pricing is $9.99 per month. For Indian customers, UPI is supported. See StreamNeo or pricing. To try it, start your free day with StreamNeo.

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

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.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
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.