You can keep a prerecorded video streaming to YouTube from a Debian VPS by running FFmpeg as a supervised service. The setup is not a single “set and forget” command: you must prepare a compatible source, use the current RTMPS URL and stream key from YouTube Live Control Room, test the feed, and monitor both FFmpeg and YouTube’s stream health.
This guide covers a file-based stream. It does not assume a camera, capture card, or generated live feed. FFmpeg’s loop and restart options can help, but neither guarantees uninterrupted delivery after every fault.
What you need before you start
- A Debian VPS with enough sustained outbound capacity and monthly transfer allowance for your chosen stream bitrate.
- A media file accessible on the server, such as
/srv/stream/program.mp4, with video and audio that FFmpeg can decode. - A YouTube channel enabled for live streaming and access to its Live Control Room.
- An FFmpeg build that includes the encoders and protocols you intend to use. Verify the available build on the actual VPS before relying on it.
Choose a VPS by checking its sustained outbound rate against the combined video, audio, and transport traffic; monthly transfer allowance; CPU capacity if you will encode with software; network route and region; reboot and recovery controls; and support and uptime terms. These vary by provider and plan, so check the exact offer you intend to use rather than assuming a VPS label guarantees suitable performance.
Install and inspect FFmpeg on Debian
Install the Debian package using the system package manager, then confirm the executable and build configuration. Package versions and available encoders depend on the Debian release and repositories configured on the host.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- 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.
- Refresh package metadata and install FFmpeg:
sudo apt update && sudo apt install ffmpeg. - Check the installed version:
ffmpeg -version. - Confirm the desired encoder is available:
ffmpeg -encoders | grep -E 'libx264|aac'. - Inspect the media file before streaming:
ffprobe -hide_banner /srv/stream/program.mp4. Note its video and audio codecs, dimensions, frame rate, duration, and audio layout.
If the expected encoder does not appear, check the package and build available for your Debian release before constructing the command. Do not assume that a command using libx264 will work on every FFmpeg build.
Choose a YouTube-compatible output profile
YouTube recommends RTMPS, H.264, H.265 (HEVC), or AV1 video, frame rates up to 60 fps, constant bitrate (CBR), and a 2-second keyframe frequency; it says not to exceed 4 seconds. Stereo audio recommendations are AAC or MP3 at 44.1 kHz and 128 kbps. The platform’s figures are recommendations, not proof that a particular VPS can sustain the required output. See YouTube’s encoder settings and bitrate guidance.
| Example output | YouTube-recommended video bitrate |
|---|---|
| H.264, 720p30 | 5 Mbps |
| H.264, 720p60 | 8 Mbps |
| H.264, 1080p30 | 14 Mbps |
| H.264, 1080p60 | 17 Mbps |
| H.265 or AV1, 720p30 or 720p60 | 6 Mbps |
| H.265 or AV1, 1080p30 | 10 Mbps |
| H.265 or AV1, 1080p60 | 12 Mbps |
The table lists YouTube’s current recommended video bitrates, not minimum VPS capacity. Leave headroom for audio, protocol overhead, and network variation. The example below uses H.264 at 720p30, whose recommended video bitrate is 5 Mbps; it is an example profile, not a universal requirement. The command does not scale or change resolution, so use it only if the input already matches the intended format, or add and validate appropriate filters and output settings.
Rank #2
- 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.
YouTube’s SDR guidance also specifies square pixels, progressive scan, two B-frames, one reference frame, CABAC, Rec. 709 color, and 8-bit depth. HDR has different requirements: YouTube recommends H.265 over RTMP(S) for HDR and says HLS may be considered when an encoder lacks the required RTMP capabilities. Do not apply SDR settings as though they were an HDR profile.
Create or schedule the YouTube broadcast and get its RTMPS details
- Open YouTube Live Control Room and create a live stream or schedule one.
- Open the stream’s settings and reveal the RTMPS URL with the lock icon, following YouTube’s current RTMPS setup instructions.
- Copy the exact RTMPS URL and stream key shown for your account. Verify that the protocol is
rtmps; YouTube may show an ordinary RTMP address by default. - Follow the account’s instructions for how the key combines with the server URL. Some setups expect the key appended to the server address; do not assume an old example endpoint or URL shape applies to your stream.
Treat the stream key like a password. Keep it out of source control, public logs, shell history, screenshots, and world-readable service files. Store it in a protected configuration or credential mechanism accessible only to the service account. If it is exposed, rotate it through YouTube’s controls. YouTube’s SSL troubleshooting advises checking that both protocol and server are correct and suggests port 443 if an SSL error persists.
Prepare a file-based FFmpeg stream
For stored media, FFmpeg’s -re option reads the input at its native frame rate so it is paced in real time instead of being sent as fast as the server can read it. Put it before the input it applies to. FFmpeg documents RTMP and RTMPS URL handling in its protocol documentation.
Rank #3
- 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.
The following is an illustrative command pattern, not a tested command. Replace the placeholders with the exact account-facing URL and key instructions from Live Control Room. The input should already be compatible with the selected output profile; verify this before depending on it.
ffmpeg -re -stream_loop -1 -i /srv/stream/program.mp4
-c:v libx264 -preset veryfast -b:v 5M -maxrate 5M -bufsize 10M
-r 30 -g 60 -keyint_min 60 -sc_threshold 0
-c:a aac -b:a 128k -ar 44100
-f flv "${YOUTUBE_RTMPS_URL}/${YOUTUBE_STREAM_KEY}"
-stream_loop -1repeats this input indefinitely. That is suitable only if repeating the same file is the intended programme. A playlist or a sequence of different files needs a workflow designed for those inputs; there is no single universal looping command for every playlist.-g 60and-keyint_min 60represent 60 frames, or two seconds at 30 fps. At a different frame rate, change the GOP/keyframe interval to preserve the intended two-second frequency. Do not exceed four seconds.-b:v,-maxrate, and-bufsizeare example rate-control settings. Check the resulting stream against YouTube’s guidance and the VPS’s real sustained egress.- The URL expression assumes the key is appended. If Live Control Room gives a complete URL or a different arrangement, follow those instructions instead. Confirm the final URL shape with a short test.
For secure transport, use the RTMPS URL from Live Control Room. FFmpeg’s RTMP protocol options include TCP keepalive, but a keepalive is not application-level reconnection, a process watchdog, or a guarantee of delivery.
Test before leaving the stream unattended
- Run the command interactively with a representative test source using the intended audio, movement, resolution, and frame rate.
- Check that FFmpeg starts without input, encoder, or connection errors and that output continues at the expected pace.
- Open the preview in Live Control Room and inspect the stream-health status and any messages before relying on the feed.
- Confirm that the broadcast is scheduled, started, or ended as intended; a running encoder process does not itself manage the broadcast lifecycle.
YouTube explicitly recommends testing before starting a live stream. Its health guidance identifies issues including unsupported audio or video codecs, bitrate that is too low, frame-rate mismatch, mismatched keyframe frequency, and insufficient incoming video that can cause viewer buffering. The Live Streaming API treats the incoming feed (liveStream) separately from a broadcast (liveBroadcast), and a feed can be associated with broadcasts: YouTube LiveStreams API documentation.
Rank #4
- 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
Run FFmpeg under systemd and retain logs
For an always-on deployment, use a system service to start FFmpeg after boot, run it as a dedicated unprivileged account, restart it when the process exits, and keep logs somewhere you can inspect. Validate the unit on the Debian release you are running. A restart policy such as Restart=always can relaunch a process that exits; it cannot detect every stalled input or unhealthy remote ingest, and it does not guarantee uninterrupted service.
Keep the stream key out of the unit file if that file is readable by other users. Put secrets in a protected configuration or credential file with permissions limited to the service account. Use the service manager’s logs to diagnose failures, and check that the chosen logging approach will not fill the disk during a long run. Exact unit details depend on the targeted Debian release and the way you store credentials, so test boot startup, process restart, and log access before relying on the service.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Monitor the stream and diagnose common failures
Check the host and YouTube side together: a process can appear active while its input is stalled or YouTube is not receiving a healthy feed.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Best Value
- 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.
| Symptom | What to check | Response |
|---|---|---|
| FFmpeg exits or repeatedly restarts | Service state and restart count; recent FFmpeg stderr or journal output; input path and file access; encoder availability | Fix the reported input, permission, or build issue, then test the command interactively before returning it to service. |
| YouTube reports an unsupported codec | Actual audio and video codecs in the outgoing feed | Use a supported codec and test the resulting stream in Live Control Room. |
| Bitrate is too low or incoming video is insufficient | Output bitrate, host CPU and memory pressure, outbound capacity, and whether the input is advancing | Restore the intended output rate, reduce encoding load or select a profile the host can sustain, and check stream health again. |
| Frame-rate or keyframe warning | Actual output frame rate and GOP interval | Match the chosen frame rate and keep keyframes at the recommended two-second interval, never over four seconds. |
| SSL connection error | Whether the URL is the current RTMPS URL and whether its server address is correct | Copy the details again from Live Control Room. YouTube’s SSL guidance suggests port 443 if the SSL error persists. |
| Feed stops at a file boundary or remains alive without new content | Whether the input reached EOF, the source is advancing, and the intended loop or playlist behavior | Choose and test a repeat or playlist workflow appropriate to the media; a process restart alone may not provide the intended content sequence. |
| Logs or media exhaust disk space | Free disk space and log growth | Set up a retention approach and verify that needed logs remain available without allowing them to fill the volume. |
| Encoder is online but broadcast is not as intended | Broadcast schedule and state in Live Control Room | Correct the YouTube broadcast lifecycle separately; systemd manages the encoder process, not channel settings. |
Useful routine checks include service state and restart count, recent logs, output bitrate, CPU and memory pressure, disk space, input progress, YouTube preview and health messages, and broadcast state. For RTMPS or other transport details, consult the Debian trixie FFmpeg protocol manpage as applicable to that release; options may differ with the installed FFmpeg version.
Estimate bandwidth and recurring transfer
Size the VPS around the chosen bitrate and verify its transfer policy. As an arithmetic estimate, a steady 5 Mbps video payload is about 2.25 GB per hour before audio and protocol overhead; at 24 hours a day for 30 days, that is roughly 1.62 TB before overhead. This assumes the stream actually runs continuously at that rate. It is not a provider allowance or a measurement of a particular VPS.
Or let it run in the cloud
If you would rather not operate FFmpeg on a VPS, StreamNeo is a cloud service for keeping an uploaded video or playlist live on YouTube. Upload your recording, add your YouTube stream key, and go live. Nothing has to stay on at home; it streams the upload as made, at any quality up to 4K 60fps for one flat price per slot, and automatically recovers if YouTube drops the stream. The first day is free with no card. Its monthly option is $9.99 per month. See StreamNeo for details.
Quick Recap
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.




