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

To keep FFmpeg from suspending when it runs in the background, add -nostdin to the command. For a stream you can manage as a persistent service, create a systemd unit, send FFmpeg to the RTMPS URL and stream key from YouTube Live Control Room, then inspect the service with journalctl.

What you need before starting

  • A Debian host with FFmpeg installed. Check the Debian release and installed FFmpeg build: available codecs and protocol support depend on the package and build.
  • A scheduled or active YouTube live event, with its stream URL and stream key available in Live Control Room.
  • An input file or other readable media source, plus enough upload bandwidth for the chosen encoder settings.

This guide uses a file as an example. Its command is a template, not a tested, universal configuration. Confirm that your FFmpeg build supports the selected encoders and that the settings fit your source and YouTube’s current guidance.

Prepare the FFmpeg command

Use the YouTube RTMPS destination

In YouTube Live Control Room, copy the URL and stream key for the event. YouTube may show the ordinary RTMP URL by default; select or reveal the RTMPS URL and use that destination. YouTube describes RTMPS as its secure streaming option, and FFmpeg documents RTMPS as encrypted transport. See YouTube’s encoder setup and troubleshooting guidance and FFmpeg’s protocol documentation.

Choose settings for the source

Set resolution, frame rate, and bitrate according to the input and YouTube’s current encoder recommendations. A suitable bitrate depends on resolution and frame rate; do not carry a value over from a different format without checking the guidance. See YouTube’s live encoder settings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
CanaKit Raspberry Pi 4 4GB Starter PRO Kit - 4GB RAM
  • 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)

The following example illustrates the command shape and common codec choices. Replace the destination placeholders with the exact RTMPS URL and key from Live Control Room. Check that your FFmpeg build includes libx264 and AAC support before using these codec options.

ffmpeg -nostdin -re -i /path/to/input 
  -c:v libx264 -c:a aac 
  -f flv 'rtmps://INGEST_HOST/APP/STREAM_KEY'

-nostdin prevents FFmpeg from checking for interactive console input, which can otherwise cause a background process to suspend. FFmpeg documents this option for background tasks in its FAQ, section 3.19. For a short shell-run command, redirecting stdin with < /dev/null is another documented option.

Rank #2
Raspberry SC15184 Pi 4 Model B 2019 Quad Core 64 Bit WiFi Bluetooth (2GB)
  • 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

Looping a file

Do not assume that a command suitable for a single pass will loop correctly. Configure looping deliberately for the input type you have, and verify timestamp continuity and audio/video behavior. The right looping options depend on the file and desired result.

Run it as a systemd service

A shell background operator can keep a command running after you start it, but it does not provide named service management or boot startup. A systemd unit is better suited to a persistent job: you can start and inspect it by name, and systemd can apply a restart policy if you configure one. Check the systemd manual installed on the target Debian release for directives it supports.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Raspberry Pi 4 Model B (2GB)
  • 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)

Create a service account and protect the key

Where practical, run the unit as a dedicated, restricted account and use a working directory the account can access. Treat the YouTube stream key like a password. Restrict permissions on files containing it, keep it out of public repositories and shared logs, and rotate it in YouTube if it is exposed. A key placed in a command-line URL may be visible to privileged local users or process inspection tools, so account for that in your access controls.

Write and start the unit

  1. Choose a unit name, such as youtube-ffmpeg.service, and create its unit file using the service-management approach appropriate for your Debian host.
  2. Set the executable to FFmpeg and provide the prepared arguments, including -nostdin, the input path, encoder settings, and RTMPS destination. Make sure the configured service account can read the input and any needed configuration.
  3. Set a working directory if the command relies on relative paths. Configure a restart policy only if you want systemd to restart FFmpeg after a failure; a restart policy does not fix an invalid input, key, URL, or encoder configuration.
  4. After creating or changing the unit, reload systemd’s unit configuration, start the service, and check its status. Use the unit name you chose in the commands and service manager.
sudo systemctl daemon-reload
sudo systemctl start youtube-ffmpeg.service
sudo systemctl status youtube-ffmpeg.service

Enable the unit for boot startup only if you want the stream job started after the Debian host reboots. A service that is merely started does not, by that fact alone, start at boot.

Rank #4
Vilros Raspberry Pi 4 Complete Starter Kit- Includes Raspberry Pi 4 Board, Fan Cooled Case, 64GB Preloaded Micro SD Card and More (4GB, Clear Transparent Case)
  • 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

Read the service logs

View the unit’s journal output with journalctl -u youtube-ffmpeg.service. Follow new entries as they arrive with:

journalctl -f -u youtube-ffmpeg.service

These commands use systemd’s unit-filtered and follow-mode journal output; see the journalctl manual.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
CanaKit Raspberry Pi 4 4GB Basic Kit with PiSwitch (4GB RAM)
  • 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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose between a shell background job and systemd

Method Lifecycle After reboot Restart and logs
Background shell command Suitable for a short-lived job in the current session; use -nostdin or redirect stdin to avoid the documented console-input suspension problem. A shell background operator does not provide boot startup. No named service supervision; manage the process from the shell environment.
systemd service Managed as a named unit. Can be configured for startup at boot. Can use a chosen restart policy; inspect output with journalctl -u or follow it with journalctl -f -u.

Troubleshoot common failures

The process suspends or stops when backgrounded

Check that -nostdin is in the FFmpeg invocation. For a shell command, redirect stdin from /dev/null if appropriate. A background operator alone does not prevent FFmpeg’s console-input check from suspending it.

TLS or SSL error

Confirm that the destination is the RTMPS URL shown in Live Control Room, not the ordinary RTMP endpoint. If the correct RTMPS URL still produces an SSL error, YouTube suggests trying port 443; consult its current troubleshooting guidance.

Connection timeout

Recheck the server URL character by character and confirm that the installed FFmpeg build supports RTMPS. YouTube identifies URL correctness and encoder RTMPS support as checks for connection problems.

The service has no useful output

Inspect the unit’s journal with journalctl -u youtube-ffmpeg.service, or follow live entries with journalctl -f -u youtube-ffmpeg.service. Confirm you are using the actual unit name and that FFmpeg’s output is reaching the journal.

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

YouTube rejects the stream or no video appears

  • Confirm the stream key belongs to the selected live event and has not changed.
  • Check that the Debian service account can read the input file.
  • Verify that the input produces the expected audio and video and that the encoder parameters match YouTube’s current settings for the target resolution and frame rate.
  • Keep the stream key out of logs and bug reports while investigating.

Or let it run in the cloud

If you do not want to maintain an always-on Debian host, StreamNeo runs uploaded videos as a 24/7 YouTube stream from the cloud. Upload a recording or build a playlist, add your YouTube stream key, and go live. Nothing has to stay on at home; it plays the uploaded video rather than broadcasting from a camera. Any quality up to 4K 60fps streams as uploaded at one price per slot, with automatic recovery if YouTube drops the stream. The first day is free with no card required. Monthly pricing is $9.99 per month.

Quick Recap

Bestseller No. 1
CanaKit Raspberry Pi 4 4GB Starter PRO Kit - 4GB RAM
CanaKit Raspberry Pi 4 4GB Starter PRO Kit - 4GB RAM
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
$159.99
Bestseller No. 2
Raspberry SC15184 Pi 4 Model B 2019 Quad Core 64 Bit WiFi Bluetooth (2GB)
Raspberry SC15184 Pi 4 Model B 2019 Quad Core 64 Bit WiFi Bluetooth (2GB)
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
$92.97
Bestseller No. 3
Raspberry Pi 4 Model B (2GB)
Raspberry Pi 4 Model B (2GB)
Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz; 1GB, 2GB, 4GB or 8GB LPDDR4-3200 SDRAM (depending on model)
$83.00
Bestseller No. 5
CanaKit Raspberry Pi 4 4GB Basic Kit with PiSwitch (4GB RAM)
CanaKit Raspberry Pi 4 4GB Basic Kit with PiSwitch (4GB RAM)
Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM); CanaKit USB-C PiSwitch (On/Off Power Switch)
$124.99

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.