Run FFmpeg as a systemd service with a restart policy, then verify the recovered stream in YouTube Live Control Room. A service manager can launch FFmpeg again after it exits; it cannot by itself prove the source is working, media is advancing, or YouTube has resumed the intended broadcast.
What a restart policy does—and what it does not do
There are two separate recovery layers. Locally, systemd can supervise the FFmpeg process and start it again if it exits. Remotely, YouTube Live Control Room shows whether YouTube is receiving a healthy stream. A successful local restart does not guarantee that the same broadcast or watch URL continues, or that viewers see uninterrupted audio and video.
FFmpeg’s protocol-specific reconnect options have a narrower job. Its protocol documentation describes options such as reconnect for HTTP input behavior. Those options do not relaunch an FFmpeg process that has exited, and they should not be treated as universal reconnection controls for RTMP or RTMPS output.
Diagnose the failure before changing retry settings
First establish what stopped. An exited process, an FFmpeg process that failed to launch, a lost input source, a process that remains alive but stops advancing, and unhealthy YouTube ingest are different problems. Restarting on process exit addresses only the first cases.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11#1 Best Overall
- 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)
- Check the service and its recent logs. Use
systemctl status your-service-nameandjournalctl -u your-service-name -n 100 --no-pager, substituting the actual unit name. Look for the exit status, repeated launch failures, input errors, and output connection errors. Redact the stream key before sharing logs. - Check the input source. Confirm that the camera, file, or other source is reachable and that the command works when run manually under the same account and environment used by the service. A source outage will not be fixed by changing YouTube’s ingest settings.
- Check whether media is still progressing. A service can be reported active while its output is stalled. Review FFmpeg progress or source and ingest health; a process-exit restart policy will not necessarily catch a process that stays alive without producing media.
- Check YouTube’s remote status. Open Live Control Room and inspect the preview and stream health. If YouTube reports a connection or key problem, confirm the configured server URL and stream key as well as the local service state.
Run FFmpeg under systemd on the Raspberry Pi
Use the FFmpeg command that already works for your source and encoder settings. Put that command in a systemd service so the operating system—not an interactive terminal session—manages the process. Exact unit settings depend on the Pi’s operating system, systemd version, service user, source, and desired retry policy; there is no safe universal unit file for every setup. A Raspberry Pi-oriented implementation example uses systemd and also documents progress supervision: rpi-video-streamer. It is an example, not an official YouTube or systemd endorsement.
- Create a unit for your working command. Store the command and necessary environment in a service unit appropriate to the installed OS. Ensure the service account can access the source and any required files. Avoid putting a stream key in a publicly shared command or log.
- Choose a restart policy deliberately. Configure systemd to restart the service after an unexpected FFmpeg exit. Add a suitable delay and restart limits for your deployment so a permanent error—such as an invalid path or missing input—does not produce a rapid restart loop. Check directive support and behavior against the systemd version installed on the Pi.
- Reload and start the service. After editing a unit, run
sudo systemctl daemon-reload, thensudo systemctl enable --now your-service-nameif it should start at boot. Replace the placeholder with the actual unit name. - Inspect the result. Run
systemctl status your-service-nameandjournalctl -u your-service-name -f. Confirm that FFmpeg launches with the intended source and output, then verify YouTube preview and health in Live Control Room.
Handle a live-but-stalled process separately
If FFmpeg remains active but stops producing progress, restarting only after an exit is insufficient. Add an appropriate health check or progress timeout for the actual command and source. The referenced Pi project documents progress timeout and source probing as separate controls; choose and validate equivalent behavior for your own deployment rather than assuming a service restart policy detects every stall.
Rank #2
- 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
Verify YouTube ingest, stream keys, and encoder settings
YouTube’s live encoder setup guidance recommends checking the preview and stream health. Its live stream settings guidance says stream keys are like the stream’s password and address. If YouTube reports a key or start error, confirm that the encoder has the current server URL and key; if you reset the key in YouTube, update the encoder configuration too. Prefer RTMPS when the encoder supports it.
Encoder settings can affect whether YouTube accepts and displays the stream, but they do not make a crashed process restart. YouTube’s settings page lists a maximum frame rate of 60 fps and recommends a 2-second keyframe interval, not exceeding 4 seconds. Treat these as encoder configuration guidance, not recovery guarantees.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #3
- Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz
- 1GB, 2GB, 4GB or 8GB LPDDR4-3200 SDRAM (depending on model)
- 2.4 GHz and 5.0 GHz IEEE 802.11ac wireless, Bluetooth 5.0, BLE Gigabit Ethernet
- 2 USB 3.0 ports; 2 USB 2.0 ports.
- Raspberry Pi standard 40 pin GPIO header (fully backwards compatible with previous boards)
RTMP/RTMPS and HLS are different ingest choices. YouTube recommends RTMPS for encrypted ingest. HLS is documented for supported scenarios such as HDR or codecs unsupported by RTMP; it has higher latency and specific segment and playlist requirements. YouTube’s HLS setup guidance calls for 1–4 second segments and a rolling playlist with no more than 5 outstanding segments. Selecting HLS changes ingest configuration; it does not replace local FFmpeg supervision.
Test recovery end to end
A systemd restart test proves only that systemd can relaunch the local process. YouTube recommends test streams, checking moving video and audio, monitoring stream quality, and testing a configured backup encoder. Test with representative motion and sound, and confirm both the local logs and Live Control Room after recovery. If you use backup ingest, test failover independently and confirm that the viewer-facing player changes over as expected.
Rank #4
- Vilros Complete Starter Kit for Pi 4 Includes Raspberry Pi 4 Model B Board and all the accessories you need to get started.
- 9-PART KIT WILL HAVE YOU READY TO GET UP AND RUNNING: Kit Includes 1. Raspberry Pi 4 Model B Board 2. Case With Easy to connect Built-in fan 3. 64GB Micro SD card Preloaded with RP OS 4. Vilros Pi 4 Compatible Power Supply with Inline on/off switch (power supply color may vary white/black) 5. Micro HDMI to Standard HDMI cable (5ft) 6. Micro SD to USB adapter to reflash card if desired 7. Neoprene Storage Bag to store all parts when not in use 8. Set of 4 Heatsinks 9. Vilros QuickStart Guide instruction booklet for Pi 4
- PASSIVE & ACTIVE COOLING: The included case is well-vented and the kit also includes a set of heatsinks with thermal stickers for easy application and a pre-installed fan to keep the board cool in any use.
- CONVENIENT ACCESSORIES: The power supply features an inline on/off switch neoprene bag that holds and protects all the parts when not in use and the QuickStart guide is updated and written for Raspberry Pi 4.
- IMPORTANT: Kit does NOT include Keyboard, Mouse or Monitor
YouTube says streams under 12 hours are automatically archived. That statement does not establish that every restarted encoder process preserves one uninterrupted broadcast or archive in every configuration. Check the broadcast state and resulting archive for your own channel setup.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot common restart and ingest failures
| Symptom | Likely area to inspect | Next action |
|---|---|---|
| Service is inactive after FFmpeg exits | Unit restart policy, unit edits, or service configuration | Inspect status and journal, verify the restart behavior and systemd version, reload systemd after edits, and test again. |
| Service repeatedly starts and exits | Persistent command, permission, path, or source error | Read the journal for the first failure; test the command as the service account and correct the underlying error before increasing retries. |
| Service is active but the picture or sound is frozen | Stalled source or FFmpeg process | Check source availability and media progress. Add a validated progress or health timeout if the process can hang without exiting. |
| FFmpeg is running, but YouTube shows no healthy preview | Output connection, server URL, stream key, or ingest health | Review FFmpeg output logs and Live Control Room. Confirm the current URL and key, updating the encoder if the key was reset. |
| Restart succeeds but viewers do not return to the expected broadcast | Remote broadcast state or ingest configuration | Check Live Control Room and the viewer-facing player; do not infer broadcast continuity from local service status alone. |
Or let it run in the cloud
If you want a YouTube channel to loop uploaded recordings without leaving the Raspberry Pi, computer, OBS, or home connection running, StreamNeo runs the stream in the cloud. Upload a recording or build a playlist, add your YouTube stream key once, and go live. Each slot includes 24/7 looping and playlists, 10 GB of storage per slot pooled across active slots, and automatic recovery if YouTube drops the stream.
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 →Quick Recap
Best Value
- Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM)
- CanaKit 3.5A USB-C Power Supply with Noise Filter (UL Listed) specially designed for the Raspberry Pi 4 (5-foot cable)
- CanaKit USB-C PiSwitch (On/Off Power Switch)
- Set of 3 Aluminum Heat Sinks for the Raspberry Pi 4
- Nothing has to stay on at home.
- Uploads stream as made, up to 4K 60fps, at one flat price per slot with no re-encode or quality tiers.
- Automatic recovery if YouTube drops the stream.
- The first day is free, with no card required; one free day per account.
Monthly: $9.99 per month.
Start your free first day with StreamNeo.
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.




