October 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 PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
DocumentaryTube
FFmpeg

How to Run FFmpeg as a systemd Service on Vultr for YouTube Live

A practical guide to supervising FFmpeg with systemd on Vultr, from YouTube RTMPS credentials and encoder settings to service recovery and end-to-end stream checks.

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

A systemd service can start FFmpeg at boot and restart it after many process failures, helping keep a YouTube stream running from a Vultr Linux server. It cannot guarantee an uninterrupted broadcast: an active service only confirms that the process is running, not that YouTube is receiving valid media or viewers can watch it.

What you need to decide before configuring the server

The exact FFmpeg command and Vultr instance depend on what you are streaming. Decide whether the input is a prerecorded file or a live capture source; which audio and video streams to send; the output codec, resolution, frame rate and bitrate; and whether to copy the source streams or transcode them. The media, FFmpeg build, server CPU and upload connection all need to support the chosen output.

Vultr’s 2025 OBS-and-Ubuntu guide gives an example profile of 2 virtual CPUs, 4 GB of memory, 80 GB of storage and 3 TB of bandwidth. That is an example for the guide’s setup, not a measured minimum or performance guarantee for FFmpeg streaming. Do not select a server size from that profile alone.

Prepare Vultr and install FFmpeg

  1. Create and access a Linux instance. Choose a distribution version you intend to maintain, then connect using your usual secure administrative method. Vultr’s published FFmpeg installation material includes older distribution examples; do not copy those OS-specific steps blindly to a different release.
  2. Install FFmpeg from a trusted source. Use the package source supported for your distribution or another trusted build. Check the installed binary with ffmpeg -version and inspect its build configuration with ffmpeg -buildconf.
  3. Confirm required support. Verify that the build includes the encoder you intend to use and can access the RTMPS protocol. The available codecs and protocol support depend on the build; do not assume every package includes every option.

Vultr’s article on static FFmpeg builds discusses release and master branches but uses older operating-system examples. Treat it as context, not a current, distribution-neutral installation recipe.

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.

Create the YouTube stream and protect its key

  1. Enable live streaming for the channel if necessary. YouTube says first-time live-stream enablement may take up to 24 hours.
  2. Open YouTube Studio’s Live Control Room and create or select the stream you will use. In its stream settings, copy the server URL and stream key shown for that stream.
  3. Use the displayed RTMPS ingest URL when available and supported. YouTube recommends RTMPS where supported, and FFmpeg describes RTMPS as streaming over a secure SSL connection. Use the URL shown in Live Control Room rather than substituting a generic endpoint.
  4. Keep the key private. YouTube describes stream keys as password-like credentials. Do not put a real key in a public script, shell-history entry, screenshot or broadly readable service file. Reset the key in YouTube if it is exposed.

Choose output settings YouTube can accept

YouTube’s encoder guidance recommends constant bitrate (CBR), a two-second keyframe interval, and a keyframe interval no longer than four seconds. It lists H.264, H.265/HEVC and AV1 options, with recommendations up to 60 fps. Confirm that your FFmpeg build, input, server and connection can sustain the settings you choose.

H.264 output YouTube-listed minimum bitrate YouTube-recommended bitrate
720p at 30 fps 2 Mbps 8 Mbps
1080p at 30 fps 5 Mbps 14 Mbps
1080p at 60 fps 6 Mbps 17 Mbps
2160p (4K) at 30 fps 11 Mbps 42 Mbps

These are YouTube’s published H.264 recommendations, not a guarantee that a particular Vultr instance or network can encode and upload at those rates. The page’s bitrate table varies by codec, resolution and frame rate; consult it for the output you plan to use. Test upload capacity and the stream itself before relying on it.

Build and test the FFmpeg command

Use a foreground FFmpeg command so systemd can supervise its main process. For a prerecorded file that should loop indefinitely, this is an illustrative structure, not a tested turnkey command:

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/input.mp4 -f flv "$YOUTUBE_RTMPS_URL/$YOUTUBE_STREAM_KEY"

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

Replace the bracketed portion with explicit options appropriate to your media and output. For stream-copy, confirm the source codecs and parameters are suitable for YouTube; for transcoding, specify the chosen video and audio encoders, bitrate, frame rate, resolution and keyframe interval. A live capture input requires a different input declaration from a file. Check the command manually before putting it in a service, and confirm the installed build supports every selected encoder and RTMPS.

For a file input, -re reads at the input’s native rate, while -stream_loop -1 repeats the input indefinitely. Neither option makes an invalid, incompatible or silent source valid. Inspect the result in YouTube’s preview before treating the service as ready.

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.

Store the stream key outside the unit file

A practical option is a root-controlled environment file, readable only by root and the service account as needed. For example, create /etc/ffmpeg-youtube.env with the server URL and key as environment variables, set restrictive ownership and permissions, and keep it out of source control and backups that are accessible to unauthorized users. The exact secret-storage mechanism is a deployment choice; the essential point is to limit access to the credential.

When referencing the environment file in a systemd unit, use systemd’s environment-file syntax. Do not expect shell expansion, pipes, redirection or shell operators in ExecStart; systemd does not interpret a service command as an interactive shell command by default.

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

Create a systemd service

For example, create /etc/systemd/system/ffmpeg-youtube.service. Adjust the user, working directory, input path, environment-file path and FFmpeg options to match your host. Keep the command in the foreground; do not add & to background it.

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=FFmpeg YouTube livestream
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=stream
WorkingDirectory=/srv/stream
EnvironmentFile=/etc/ffmpeg-youtube.env
ExecStart=/usr/bin/ffmpeg -re -stream_loop -1 -i /srv/stream/input.mp4 [replace with explicit output options and URL using the environment variables]
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

This is a unit outline, not a copy-and-paste command: replace the bracketed section with valid FFmpeg arguments for your media and a method of supplying the protected URL and key. Confirm the installed systemd version and local manual for supported unit directives and service behavior. Set access controls appropriate to the host, and ensure the service user can read the input and access any required devices.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Enable, start and inspect the service

  1. Validate and reload: run sudo systemd-analyze verify /etc/systemd/system/ffmpeg-youtube.service, then sudo systemctl daemon-reload after creating or changing the unit.
  2. Enable at boot and start now: run sudo systemctl enable --now ffmpeg-youtube.service.
  3. Check process-level status: run sudo systemctl status ffmpeg-youtube.service. An active service means systemd sees the process running; it does not confirm YouTube accepted the stream.
  4. Read recent logs: run sudo journalctl -u ffmpeg-youtube.service -n 100 --no-pager. Avoid exposing the stream key in command-line arguments or logs.

Restart=on-failure is the systemd policy documented for long-running services that should recover from process failure. A modest RestartSec= delay avoids immediate retry loops. Repeated rapid failures can hit systemd start-rate limits and leave the service failed; diagnose the underlying error and restart it deliberately after correcting the cause. A deliberate systemctl stop is not automatically restarted under this policy.

Verify the broadcast in YouTube, not just systemd

  1. Check Live Control Room preview. Confirm that YouTube sees the feed and that video and audio appear as expected.
  2. Review stream health and warnings. Resolve bitrate, frame-rate, audio or connection warnings before relying on the broadcast.
  3. Check the viewer experience. Open the watch page as a viewer and verify that playback, sound and looping behave as intended.
  4. Test recovery before an event. Observe what happens when FFmpeg exits or the connection is interrupted, then confirm both that systemd restarts the process and that YouTube receives a healthy feed again.

YouTube Help says, “Make sure to test before you start your live stream.” It also recommends monitoring the stream. A restarted PID is not proof that the viewer-facing broadcast recovered.

Troubleshoot common failures

The service fails immediately

  • Likely causes: invalid FFmpeg arguments, an incorrect binary path, missing encoder/protocol support, unreadable input, or an inaccessible environment file.
  • Check: run the equivalent FFmpeg command manually as the service user, inspect journalctl -u ffmpeg-youtube.service, and verify file permissions and build support.

The service is active but YouTube shows no incoming stream

  • Likely causes: wrong server URL or key, an unavailable network route, unsupported ingest configuration, or FFmpeg output errors.
  • Check: compare the URL and key with the selected stream in Live Control Room, keep the key private, inspect FFmpeg logs and confirm RTMPS support and connectivity.

YouTube receives the stream but reports poor health

  • Likely causes: bitrate, frame rate or keyframe settings outside the selected target; unstable upload; or inadequate CPU when transcoding.
  • Check: compare output with YouTube’s codec-specific guidance, run an upload-speed test, and reduce output demands or use stream-copy if the source is already suitable.

FFmpeg restarts repeatedly

  • Likely causes: a persistent input or configuration error, unavailable capture device, expired or reset key, or a network condition that does not clear.
  • Check: inspect the journal for the first failure, correct its cause, then start the service again. Repeated retries may trigger systemd’s start-rate limiting.

Video works but audio is missing or wrong

  • Likely causes: the input has no audio stream, FFmpeg mapped the wrong stream, or the selected audio encoding options are unsuitable.
  • Check: inspect input streams with FFmpeg, define explicit audio mapping and encoding options, then verify sound in YouTube preview and the watch page.

Or let it run in the cloud

If you want a YouTube channel to loop uploaded recordings without maintaining a Vultr server and systemd unit, StreamNeo runs the uploaded video from the cloud. Upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home; it supports any uploaded quality up to 4K 60fps at one flat price per slot, with automatic recovery if YouTube drops the stream. The first day is free with no card. Monthly service is $9.99 per month. It plays uploaded videos, not a live camera feed, and streams to YouTube only. Start the free day with StreamNeo.

Frequently Asked Questions

Can I run a camera or other live capture input this way?

Yes, if the Vultr host can access the capture source and FFmpeg has the required input support. The input declaration and permissions differ from the prerecorded-file example.

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

Does systemd restart FFmpeg when I intentionally stop the service?

No. With Restart=on-failure, a deliberate systemd stop is not treated as a failure restart.

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 *

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.

More from the Screening Room

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.