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 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
VGSources
Blog

How to Run a YouTube 24/7 Stream on an Ubuntu Azure VM with FFmpeg

A practical guide to looping media from an Ubuntu Azure VM to YouTube Live with FFmpeg, RTMPS, systemd, and YouTube stream-health monitoring.
Length7 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can run a pre-recorded YouTube stream continuously from an Ubuntu virtual machine in Azure by installing FFmpeg, sending a real-time output to the RTMPS URL and stream key YouTube gives you, and supervising FFmpeg with systemd. First test a short stream, then monitor both the service logs and YouTube’s stream health. A VM and automatic process restarts do not guarantee uninterrupted delivery: network, host, input-file, and YouTube ingest failures still need attention.

How the setup works

Azure supplies the Linux VM; FFmpeg reads your local media and sends it to YouTube Live. YouTube provides the destination URL and stream key for the stream in Live Control Room. The stream key is a credential: do not publish it, put it in a public repository, or expose it in logs.

This guide covers looping a file from an Ubuntu VM. It does not require a separate physical encoder or an inbound port open to the VM just to push video to YouTube. The VM does need working outbound connectivity to YouTube’s ingest endpoint.

1. Create an Ubuntu VM in Azure

  1. Follow Microsoft’s Linux VM quickstart to create a virtual machine in the Azure portal. Choose an Ubuntu image and region suitable for your deployment.
  2. Choose a VM size based on the video’s resolution and frame rate, the codecs you plan to use, and whether FFmpeg will encode on the CPU. There is no universal size recommendation for every source and output.
  3. Plan storage for your source media and confirm that the VM can make outbound connections to YouTube. A public inbound streaming port is not needed for this push workflow.
  4. Connect to the VM and verify that you can read the directory where the media will live.

Azure VM, disk, region, and data-transfer costs vary with the configuration and location. Check current Azure pricing for your intended deployment before committing; no single cost or SKU applies to every stream.

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.

2. Install FFmpeg and check its build

Install FFmpeg from a trusted package source appropriate for your Ubuntu release. Then inspect the installed build:

ffmpeg -version

FFmpeg’s protocol documentation describes real-time file-to-server streaming with -re, an input file, FLV output, and an RTMP URL. It also documents RTMPS among the RTMP protocol variants, while noting that support can depend on how FFmpeg was built. An rtmps:// address alone does not establish that your installed binary can connect; verify the build and test the actual endpoint you receive from YouTube.

3. Prepare and validate your media

  • Use video and audio that you have permission to stream. YouTube’s copyright and platform rules still apply to looping or prerecorded material.
  • Check that the file exists, is readable by the account that will run FFmpeg, and contains the audio and video streams you expect. Use ffprobe, if installed, to inspect a file’s streams and format.
  • Decide whether to pass through compatible streams or re-encode. If re-encoding, choose codecs, resolution, frame rate, and bitrate for your source and desired output, and compare them with YouTube’s current encoder guidance. The right settings depend on the media and target; there is no universally correct preset.
  • Test the file locally before making the service unattended. A file that fails to decode or lacks expected audio will not become a healthy live stream just because systemd restarts FFmpeg.

4. Get the current YouTube RTMPS destination

  1. Open YouTube Live Control Room and open or schedule the stream.
  2. Reveal and copy the RTMPS server URL and the stream key shown for that stream. Use the current values from Live Control Room rather than relying on a hard-coded endpoint from an old guide.
  3. Check how your encoder expects the destination: some take a combined URL and key, while others accept the server URL and stream name separately. YouTube’s API distinguishes the RTMPS ingestion address and stream name fields.

YouTube describes RTMPS as RTMP over TLS/SSL. Its guidance says to use the RTMPS URL from Live Control Room and check the protocol and server if connection setup fails; for a persistent SSL error, it advises trying port 443. See YouTube’s RTMPS help page and the YouTube Live Streams API documentation.

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.

Never paste a real stream key into an example command, shell history, screenshot, public configuration file, or world-readable service file. Keep it in a suitably protected configuration mechanism, restrict access to it, and rotate it in Live Control Room if it is exposed.

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

5. Test a short FFmpeg session

Run FFmpeg in the foreground first so you can see errors directly. A looping file command has this general shape:

ffmpeg -re -stream_loop -1 -i /path/to/video.mp4 -c:v libx264 -c:a aac -f flv "$INGEST_URL"

This is an illustrative command, not a tested universal recipe. Confirm the installed FFmpeg supports the chosen codecs and looping option. Set INGEST_URL securely to the exact current destination format required by your encoder and YouTube stream; do not substitute the placeholder with a real key in documentation or a shared command history. Adapt encoding settings to the source and YouTube’s current requirements.

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.

For a finite smoke test, remove -stream_loop -1 so the file ends. Confirm that FFmpeg reports progress and that YouTube Live Control Room receives the feed. Check YouTube’s own stream-health indicator before treating the session as ready.

6. Loop media and supervise FFmpeg with systemd

For a single file, -stream_loop -1 requests indefinite looping, while -re reads the file at its native rate rather than sending it as fast as possible. If you need to rotate multiple files, use a playlist-based workflow and validate its syntax against the installed FFmpeg version before relying on it.

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

Run the process as a dedicated, unprivileged service account. Give that account read access to the media and only the configuration access it needs. A systemd unit can start FFmpeg at boot and restart it after an unexpected process exit. The unit should invoke your tested command and read protected configuration; do not put a real key in a broadly readable unit file. After creating or changing a unit, reload systemd and start it using the unit name you chose:

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
sudo systemctl daemon-reload
sudo systemctl enable --now youtube-stream.service
sudo systemctl status youtube-stream.service

Replace youtube-stream.service with your unit’s actual name. A restart policy can recover from an FFmpeg process exit; it cannot fix a bad source file, invalid key, failed network route, VM outage, or stalled remote ingest. Test how the service behaves after a deliberate process stop and inspect the resulting logs before leaving it unattended.

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

7. Monitor both FFmpeg and YouTube

A running systemd unit only confirms that the process is running, not that viewers receive healthy video. Use both local and platform signals:

  • Read recent service output with sudo journalctl -u youtube-stream.service -n 100 --no-pager; follow new entries with sudo journalctl -u youtube-stream.service -f.
  • Check FFmpeg’s progress and errors, including whether it is continuing to read and send frames.
  • Check YouTube Live Control Room’s stream-health view. YouTube’s API describes active/inactive status, health values such as good, ok, bad, and noData, and configuration issues. These platform-side signals can reveal problems a local process check cannot.
  • When delivery fails, distinguish a crashed encoder from an upstream connection problem, VM failure, bad input, or remote ingest stall. Restarting the process is not a diagnosis for every failure.

A community tutorial demonstrates an FFmpeg and systemd watchdog workflow, but its reported freeze behavior and scheduled-restart approach are anecdotal, not a general reliability guarantee: “24/7 YouTube Stream — Setup & Ops Notes”.

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.

Troubleshooting common failures

Symptom What to check Practical next step
FFmpeg rejects the RTMPS URL or reports a TLS/protocol error Whether this FFmpeg build supports the required RTMPS transport; whether the URL and protocol match the values in Live Control Room. Inspect the build, use YouTube’s current RTMPS URL, and follow YouTube’s guidance to check the server/protocol. If an SSL error persists, try port 443 as YouTube advises.
YouTube does not receive the stream The current stream URL and key, their expected combined or separate format, outbound connectivity, and FFmpeg output errors. Copy the destination again from the active stream in Live Control Room, confirm the encoder’s required format, and review both FFmpeg logs and YouTube stream health.
Stream health reports a configuration problem or bad/no data YouTube’s health details, the video/audio streams in the source, and the encoding choices used by FFmpeg. Use YouTube’s reported issue to guide changes; validate the source and encoder configuration, then run another short test.
FFmpeg exits or systemd repeatedly restarts it The journal for the first failure, file permissions, path correctness, decode errors, and whether the service account can read its configuration and media. Fix the underlying error before relying on the restart policy. A restart loop can repeat the same failure without restoring a usable feed.
Service is active but viewers do not see a healthy stream YouTube’s ingest health, not just systemctl status; also check for network loss or a stalled connection. Use platform health and FFmpeg progress together to identify whether the fault is local, in transit, or at the ingest side.

Or let it run in the cloud

If your goal is simply to keep uploaded videos looping on YouTube, StreamNeo is the first alternative to consider: it runs from the cloud, supports any uploaded quality up to 4K 60fps at one flat price per slot, and offers a free first day.

  1. Upload your recording or build a playlist.
  2. Add your YouTube stream key once.
  3. Go live; StreamNeo loops the upload from its cloud service, so your computer and home connection do not need to stay on.

There are no quality tiers or re-encoding: each upload streams as made, up to 4K 60fps. Each slot includes 10 GB storage, pooled across active slots, 24/7 looping and playlists, automatic recovery if YouTube drops the stream, and StreamNeo team support. The first day is free with no card, once per account. Billing options are:

  • Daily: $0.99 per day
  • Weekly: $2.99 per week
  • Monthly: $9.99 per month
  • 6 months: $49.99 for 6 months
  • Yearly: $89.99 a year

You can cancel any time; UPI and cards are available in India, and card checkout is available worldwide. For five or more slots, contact support. StreamNeo is for uploaded videos streamed to YouTube, not camera-based live capture. Compare the service at StreamNeo, then start the free first 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.

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.

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 quests from Patch Notes

  1. How To Create Custom Stickers & Shoutouts In Monster Hunter WildsMonster Hunter WildsBlog20min
  2. How to Get XL Gogoat in Pokemon Legends Z-A (An Extra-Large Gogoat)Pokemon Legends Z-ABlog20min
  3. How to Get Rotting Lightbringer in Diablo 4Diablo 4Blog17min
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.