October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
DocumentaryTube
Admit one · Blog

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

A practical guide to running a continuous YouTube video stream from an Ubuntu Azure VM using FFmpeg, YouTube's current RTMPS settings, and systemd supervision.
Opened Runtime8 min Written byDocumentaryTube Team

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.

You can run a continuous YouTube stream from an Ubuntu virtual machine in Azure by sending a local video file to YouTube Live with FFmpeg, then supervising FFmpeg with systemd. You need an Ubuntu VM, media you have permission to stream, the stream-specific RTMPS URL and key from YouTube Live Control Room, and a test session before leaving the service unattended. A process restart can recover from an FFmpeg crash; it cannot guarantee recovery from every VM, network, input-file, or YouTube ingest failure.

How the setup fits together

The Azure VM supplies the always-on Linux host. FFmpeg reads a media file at real-time speed and sends its audio and video to YouTube Live. systemd can start FFmpeg at boot and restart it after certain process failures. YouTube Studio remains a separate monitoring point: an active FFmpeg process does not by itself prove that YouTube is receiving a healthy stream.

This guide covers a file-based stream from an Ubuntu/Linux Azure VM. It does not establish a universal VM size, region, price, encoding preset, or YouTube account eligibility setting; those depend on your deployment, media, output target, and account.

1. Create an Ubuntu VM in Azure

  1. Follow Microsoft’s Linux VM quickstart to create a virtual machine. Select an Ubuntu image and Azure region appropriate for your needs.
  2. Choose a VM size based on the output resolution, frame rate, codec, and whether FFmpeg will encode video on the CPU. No single SKU or current cost is established for every workload, so verify available sizes and pricing for your region in Azure before deploying.
  3. Ensure the VM can make outbound connections to YouTube’s ingest service. You do not need to open a public inbound streaming port merely to push a stream from the VM to YouTube.
  4. Connect to the VM using your normal secure administration method and install updates according to your operating practices.

The VM is cloud infrastructure; this workflow does not inherently require a separate physical encoder or other dedicated streaming hardware.

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 capabilities

Install FFmpeg from a trusted package source suitable for your Ubuntu release, then inspect the installed build before relying on a particular protocol or codec. For example, check ffmpeg -version and review its reported configuration. FFmpeg documents RTMPS among the RTMP protocol variants, but support can depend on how the installed build was compiled. Its protocol documentation describes file-to-server streaming with real-time input, a file, FLV output, and an RTMP URL: FFmpeg protocols documentation.

An rtmps:// URL alone does not prove that the specific FFmpeg package on your VM can connect. Verify the build and test it against the current URL issued for your YouTube stream.

3. Prepare and verify the media

  • Use recordings you have the rights and permissions to stream. This guide does not provide legal or licensing advice.
  • Confirm the file exists on the VM and that FFmpeg can read and decode it. Inspect the input with ffprobe /path/to/video.mp4 if available, and check that it contains the audio and video streams you expect.
  • Choose encoding settings for the source and the output quality you intend to deliver. There is no universally correct resolution, bitrate, frame rate, or encoder preset established here; consult YouTube’s current encoder guidance and check YouTube’s health feedback during testing.
  • For a playlist or a rotation of multiple files, validate the playlist format with the installed FFmpeg version and test transitions before relying on it continuously.

4. Get the correct YouTube Live destination

  1. Open YouTube Live Control Room and create or schedule the stream you intend to use.
  2. Reveal and copy the RTMPS server URL and stream key shown for that stream. Treat both as stream-specific configuration, and use the current values supplied by YouTube rather than a hard-coded endpoint. YouTube’s instructions are in Encrypt your stream using RTMPS.
  3. Check how your encoder expects the destination: some accept the server URL and stream name/key in separate fields, while others require them combined. YouTube’s API describes primary and backup RTMPS ingestion addresses and a stream name as separate fields: YouTube LiveStreams resource.

YouTube describes RTMPS as RTMP over TLS/SSL. Its Help page says, “You can stream to YouTube Live with RTMPS, a secure extension to the popular RTMP streaming video protocol.” Use the protocol and server provided in Live Control Room. If an SSL error persists, YouTube’s troubleshooting guidance says to try port 443.

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.

5. Run a short foreground test

Before creating an unattended service, test a short stream while watching both FFmpeg’s output and YouTube Studio’s stream-health indicator. A general file-loop command shape is:

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.

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 one-size-fits-all recipe. Confirm that your FFmpeg build supports the selected codecs and -stream_loop, adapt the encoding options to the source and target, and use the exact current URL/key structure for your stream. Configure INGEST_URL securely in your environment or service configuration; do not paste a real stream key into a command that will be saved in shell history, a public file, source control, screenshots, or logs.

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 with a finite test where practical, confirm that YouTube receives the stream and reports a healthy signal, and check audio, video, and any file-loop transition. YouTube documents health states and configuration issues through its Live Streaming API, including active/inactive status and health values such as good, ok, bad, and noData: YouTube LiveStreams resource.

6. Loop continuously and supervise FFmpeg with systemd

Use a dedicated service account

Create a non-administrator account for the stream service and give it only the permissions it needs to read the media and the protected configuration. Avoid running the encoder as root. Keep the stream key out of world-readable files and ensure that only the service account and authorized administrators can read the configuration that contains it.

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

Create a systemd unit

Once the foreground test works, create a unit such as /etc/systemd/system/youtube-loop.service. The following illustrates the main service structure; replace the user, paths, and configuration method with values appropriate to your host. Do not put a real key in a broadly readable unit file.

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

[Unit]
Description=YouTube file loop
After=network-online.target
Wants=network-online.target

[Service]
User=streamer
Group=streamer
EnvironmentFile=/etc/youtube-loop/stream.env
WorkingDirectory=/srv/youtube-loop
ExecStart=/usr/bin/ffmpeg -re -stream_loop -1 -i /srv/youtube-loop/video.mp4 -c:v libx264 -c:a aac -f flv ${INGEST_URL}
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Protect the environment file with restrictive ownership and permissions, and validate how your systemd version expands environment variables in ExecStart before using this example. If the URL or key contains special characters, use a protected wrapper or another configuration approach that safely passes it as one argument; avoid exposing secrets in process arguments or diagnostic output. Adapt the command to the tested media and encoder settings.

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.

Enable, start, and inspect the unit

  1. Reload unit definitions: sudo systemctl daemon-reload.
  2. Enable the service at boot and start it now: sudo systemctl enable --now youtube-loop.service.
  3. Check its state: sudo systemctl status youtube-loop.service.
  4. Read recent logs: sudo journalctl -u youtube-loop.service -n 100 --no-pager. Follow new logs with sudo journalctl -u youtube-loop.service -f.
  5. After changing the unit, reload systemd and restart the service. Confirm both the systemd state and YouTube’s stream health.

Restart=on-failure can restart a process that exits unsuccessfully. It does not diagnose every connection problem or detect every case where FFmpeg remains running but the remote ingest has stalled. Monitor FFmpeg logs and YouTube’s health indicator, and test the failure handling you intend to rely on.

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

7. Keep the stream key and media secure

  • Limit access to the stream key. Do not commit it to source control, publish it in logs or screenshots, or store it in a world-readable service file.
  • If the key is exposed, rotate it through YouTube Live Control Room and update the VM’s protected configuration.
  • Keep the service account and media/configuration permissions narrow, and make sure the systemd service can read the files it needs after a reboot.
  • Use media you are permitted to stream. Copyright and YouTube’s content and monetization rules are separate from whether the FFmpeg command works.

8. Troubleshoot common failures

Symptom Likely cause What to check
FFmpeg cannot open an rtmps:// destination The installed build may lack the needed RTMPS support, or the endpoint configuration may be wrong. Inspect ffmpeg -version and build configuration; confirm the current RTMPS URL and key in Live Control Room. Follow YouTube’s protocol/server guidance and, for persistent SSL errors, try port 443.
YouTube does not receive the stream Wrong or stale URL/key, incorrect URL/key combination, or outbound connectivity issue. Copy the current stream-specific settings again, confirm how FFmpeg expects URL and stream name/key, and verify that the VM can reach YouTube’s ingest endpoint.
FFmpeg exits immediately Missing file, unreadable permissions, unsupported codec/option, or invalid command configuration. Read journalctl -u youtube-loop.service, verify the file path and service-user permissions, and test the same command in a foreground session.
systemd reports a running process but viewers may not have a healthy stream The process may be stalled or YouTube may be reporting an ingest/configuration problem. Compare FFmpeg’s recent logs and progress with YouTube’s stream-health state and configuration issues; do not treat the service’s process state as proof of healthy delivery.
The service does not start after reboot The unit may not be enabled, dependencies or paths may be wrong, or configuration permissions may prevent startup. Check systemctl is-enabled youtube-loop.service, inspect systemctl status and the journal, and confirm the media and protected configuration are available to the service account.

systemd can restart a crashed process, but it cannot guarantee recovery from every network outage, host failure, bad input, or remote ingest stall. An unattended deployment needs monitoring and an operator plan for failures it cannot correct itself.

Or let it run in the cloud

If your goal is a YouTube channel that continuously plays uploaded recordings rather than a hands-on FFmpeg/Azure setup, StreamNeo is a cloud option: upload a recording or build a playlist, add your YouTube stream key once, and go live. It loops uploaded video to YouTube, so no computer or home connection has to stay on. Every slot streams the upload as made, up to 4K 60fps, at one flat price per slot; it does not re-encode or use quality tiers. Automatic recovery can resume if YouTube drops the stream. The first day is free with no card, one free day per account. The same product is included on every plan; only the billing length changes. India-based users can pay by UPI or card, while card checkout is available worldwide. Each slot includes 10 GB storage, pooled across active slots, 24/7 looping and playlists, and StreamNeo team support.

Monthly pricing: $9.99 per month. For five or more slots, contact StreamNeo support. StreamNeo plays uploaded videos and streams to YouTube; it does not go live from a camera.

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

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.

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

  1. How to Send a YouTube Live Stream to a Premiere—and What “Premiere Playlist” Can’t DoAdmit one · BlogHow to Send a YouTube Live Stream to a Premiere-and What “Premiere Playlist” Can't DoOpened04 OCT 2026Runtime6 min
  2. How to Run a YouTube Live Playlist from a Raspberry PiAdmit one · BlogHow to Run a YouTube Live Playlist from a Raspberry PiOpened04 OCT 2026Runtime4 min
  3. How to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootAdmit one · BlogHow to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootOpened04 OCT 2026Runtime6 min
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.