The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Run FFmpeg in the foreground as a systemd service, then configure systemd to restart it when the process fails. On a Hetzner Linux server, that can bring the encoder back after a crash or reboot—but it does not prove YouTube is receiving a healthy stream. Verify the incoming feed separately in YouTube Live Control Room.
This guide shows the service setup and checks without prescribing an unverified FFmpeg command, Hetzner server size, or firewall rule. You must supply your own FFmpeg input and encoding options and the ingest details YouTube gives your channel.
As an Amazon Associate I earn from qualifying purchases.
What systemd can—and cannot—keep running
systemd supervises a process. If FFmpeg exits unsuccessfully, a policy such as Restart=on-failure can start it again after a delay. Running FFmpeg in the foreground lets systemd track its main process; do not daemonize it behind the service manager. systemd also applies start-rate limits, so repeated failures may eventually stop automatic restart attempts. See the systemd service documentation.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteA process marked active is not necessarily sending valid video. FFmpeg can remain alive while its input, encoding, or connection to YouTube is stalled or rejected. Check the service journal and YouTube’s stream status as separate signals.
#1 Best Overall
- Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
Before creating the service
Prepare a dedicated account and readable files
- Create or choose a dedicated unprivileged Linux account for the stream. Give it read access to the media and configuration it needs, and avoid running FFmpeg as root.
- Choose a working directory and confirm the account can read the input file and any configuration it requires.
- Find the installed FFmpeg executable’s absolute path on the server. The example below uses
/usr/bin/ffmpegonly as an illustrative path; replace it if the installed binary is elsewhere.
Get the YouTube ingest details
In YouTube Live Control Room, use the ingestion address and stream key assigned to the stream. YouTube’s LiveStreams resource distinguishes primary and backup ingestion addresses and supports RTMP and RTMPS ingest types: YouTube LiveStreams API. A backup address does not mean a single-output FFmpeg service is sending to both destinations.
Where your encoder and assigned ingest endpoint support it, prefer RTMPS. Google documents RTMPS as RTMP over TLS and specifies port 443 and the ingestion server hostname for TLS SNI: Delivering Live YouTube Content via RTMPS. The guide states, “The connection must be made to port 443 on the ingestion server.” Use the actual hostname and address YouTube provides; do not substitute a guessed endpoint.
Decide how to handle the stream key
Treat the stream key like a password. Do not put a real key in a publicly readable unit file, a screenshot, or shell history. systemd warns that environment variables are not suitable for secrets because they can be exposed through D-Bus and inherited by child processes; consult the systemd execution documentation for credential options supported by the systemd version installed on your server.
Rank #2
- Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM)
- Includes Pre-Loaded 32GB EVO+ Micro SD Card (Class 10), USB MicroSD Card Reader
- CanaKit Premium High-Gloss Raspberry Pi 4 Case with Integrated Fan Mount, CanaKit Low Noise Bearing System Fan
- CanaKit 3.5A USB-C Raspberry Pi 4 Power Supply (US Plug) with Noise Filter, Set of Heat Sinks, Display Cable - 6 foot (Supports up to 4K60p)
- CanaKit USB-C PiSwitch (On/Off Power Switch for Raspberry Pi 4)
Choose a secret-delivery method that your installed systemd version and FFmpeg launch method can actually use, and restrict access to the secret file or credential. Check how the launch method passes the key onward: placing a key in an FFmpeg argument may expose it to users able to inspect process details, even if the unit file itself is protected. Do not assume that moving a secret into a credential file automatically prevents exposure in the final FFmpeg invocation.
Create a foreground systemd unit
Save a unit such as /etc/systemd/system/ffmpeg-youtube.service. This is a structural outline, not a tested end-to-end FFmpeg command. Replace the explanatory placeholders with the actual input, encoding options, and YouTube ingest destination for your setup. The angle-bracket text is not valid FFmpeg syntax. Arrange secure stream-key delivery for your chosen launch method; do not paste a real key into this example.
[Unit]
Description=FFmpeg YouTube live stream
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=stream
WorkingDirectory=/srv/stream
ExecStart=/usr/bin/ffmpeg <input-and-encoding-options> <youtube-ingest-url>
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Type=simplesuits a foreground process: systemd tracks the process it starts.User=streamandWorkingDirectory=/srv/streamare examples. Use the account and directory you prepared, and make sure the account can access required files.ExecStartmust use the correct absolute FFmpeg path and your real input and output configuration. This guide does not validate particular FFmpeg flags or a complete command line.Restart=on-failureasks systemd to restart after failure;RestartSec=5adds a delay before a restart attempt. Repeated attempts remain subject to systemd’s start-rate limits.
Load, enable, and start the service
- After saving the unit, ask systemd to reload unit definitions:
sudo systemctl daemon-reload. - Enable the service for startup at boot and start it now:
sudo systemctl enable --now ffmpeg-youtube.service. - Check the service state:
sudo systemctl status ffmpeg-youtube.service. This reports systemd’s view of the service, not YouTube’s video health. - Read recent service output, including FFmpeg stderr when it is sent to the journal:
sudo journalctl -u ffmpeg-youtube.service -n 100 --no-pager. Follow new entries while diagnosing withsudo journalctl -u ffmpeg-youtube.service -f. - Open YouTube Live Control Room and verify that YouTube detects the incoming stream and reports its health. Keep this check open through a restart or configuration change.
RTMP or RTMPS?
| Choice | Connection characteristics | What to verify |
|---|---|---|
| RTMP | YouTube’s LiveStreams resource includes RTMP ingest addresses. The cited material does not establish encryption for RTMP. | Use the actual address assigned by YouTube and confirm that your encoder can connect to it. |
| RTMPS | RTMP over TLS. Google’s guide specifies port 443 and requires TLS SNI to use the ingestion server hostname. | Use the provided RTMPS endpoint; check the scheme, endpoint hostname, port, and SNI if TLS setup fails. |
See Google’s RTMPS ingestion guide and the LiveStreams resource for endpoint details. This one-output service outline does not implement simultaneous delivery to a backup ingest address.
Diagnose failures by separating process health from stream health
FFmpeg exits or systemd reports a failed unit
- Read the unit’s recent journal entries and identify FFmpeg’s first relevant error, rather than treating later restart messages as the root cause.
- Check the executable and input paths, file permissions, working directory, and whether the service account can read the media and configuration.
- Check that the ingest address and secret-delivery method are configured correctly without copying the key into a public log or support post.
Restart=on-failure can respond to a process failure; it does not correct a bad path, invalid input, or rejected output settings.
systemd says active, but YouTube shows no incoming video
Use YouTube Live Control Room and its ingest status or health information. The LiveStreams resource exposes stream states such as active, inactive, error, and ready, along with health information. Investigate the input, encoding, and connection to the ingest endpoint; a live FFmpeg process alone is not confirmation of a valid feed. See YouTube LiveStreams API.
RTMPS reports a TLS or connection timeout error
Confirm the assigned endpoint uses the RTMPS scheme, that the endpoint is the one YouTube supplied, that the connection uses port 443, and that TLS SNI identifies the ingestion hostname. Google documents these requirements in its RTMPS guide. This guide does not establish Hetzner-specific firewall rules; check the current provider and server configuration for your own instance rather than guessing a rule.
Rank #4
- Broadcom BCM2711, quad-core Cortex-A72 (ARM v8) 64-bit SoC @ 1. 5GHz
- 2. 4 GHz and 5. 0 GHz IEEE 802. 11b/g/n/ac wireless LAN, Bluetooth 5. 0, BLE
- 2 × USB 3. 0 ports, 2 x USB 2. 0 Ports
- 2 × micro HDMI ports supproting up to 4Kp60 video resolution
- Micro SD card slot for loading operating system and data storage
YouTube reports a stream health warning
Use the issue category in YouTube’s health report to narrow the cause. Health messages can flag bitrate, codec, frame rate, GOP length, or insufficient video. Change the encoding or input configuration based on the reported problem, then confirm the new incoming feed in YouTube. See YouTube health status messages.
Restarts stop after repeated failures
Check the service and manager logs for start-rate-limit messages and examine the underlying FFmpeg error before trying again. Fix the cause first; avoid configuring a tight, unlimited restart loop. If the unit is rate-limited, use systemd’s documented unit and manager behavior to determine whether and when a reset is appropriate: systemd service documentation.
What this setup does not establish
The service definition is independent of a particular Hetzner server size, price, or firewall rule. Choose infrastructure based on your actual workload and verify networking in the current provider documentation and configuration. No particular FFmpeg command or encoding flags are validated here; supply options appropriate to your input and check YouTube’s reported health rather than assuming a generic command will fit.
Best Value
- Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
Restart supervision handles process exits, not every application-level stall or an unhealthy incoming feed. Monitor both systemd and YouTube, and investigate the failure mode each reports.
Or let it run in the cloud
If your goal is a looping, pre-recorded YouTube stream rather than running and maintaining your own FFmpeg service, StreamNeo keeps uploaded videos live from the cloud. Upload a recording or build a playlist, add your YouTube stream key, and go live; it loops uploaded videos, not a camera feed. Your computer and home connection do not have to stay on, and automatic recovery can restart the stream if YouTube drops it.
Every slot supports the uploaded quality up to 4K 60fps at one flat price per slot, without re-encoding or quality tiers. The first day is free with no card, one free day per account. Monthly billing is $9.99 per month. India-based customers can pay by UPI; cards are available worldwide. See StreamNeo pricing for the available billing lengths and details.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Quick Recap
- Upload a recording or create a playlist.
- Add your YouTube stream key once.
- Go live; StreamNeo loops the video from its cloud service.
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.




