Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
DocumentaryTube
Admit one · Blog

How to Run Two FFmpeg YouTube Loop Streams on One VPS

A practical guide to running two prerecorded YouTube Live loops from one VPS with separate FFmpeg processes, safe stream keys, and tested capacity planning.
Opened Runtime8 min Written byDocumentaryTube Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run two prerecorded YouTube Live loops from one VPS by starting two separate FFmpeg processes, each with its own media input, YouTube stream key, output settings, log, and restart policy. Size the server for the combined outgoing bitrate and test both streams at once; there is no universal VPS CPU or memory requirement because copying media and encoding it impose very different workloads.

What you need before starting

  • A Linux VPS with enough sustained outbound bandwidth for both streams and enough CPU capacity if either process will encode video.
  • Two local media files, or another accessible input for each stream. The commands below show local files.
  • A separate YouTube Live stream and stream key for each output. Retrieve each endpoint and key from YouTube Studio’s Live Control Room.
  • FFmpeg installed on the VPS. Check the build with ffmpeg -version; available codecs vary by build.
  • A way to keep each process supervised, log output separately, and alert you if a process or stream becomes unhealthy.

Use the exact RTMPS ingest URL YouTube provides for each stream. YouTube recommends RTMPS, which encrypts the connection using TLS/SSL. Do not assume an RTMP endpoint can simply be changed to RTMPS by editing its prefix. See YouTube’s encoder settings guidance and RTMPS instructions.

Prepare the two YouTube streams

  1. In YouTube Studio, open Live Control Room and create or select the first live stream. Copy its stream URL and stream key.
  2. Create or select the second live stream and copy its own URL and key. Keep the destinations distinct: each FFmpeg process must send to the stream you intend.
  3. Protect both keys like passwords. Do not put an unredacted key in a public script repository, screenshot, or log shared for troubleshooting. If a key is exposed, reset it in Live Control Room and update the matching FFmpeg configuration.
  4. Configure the streams and visibility in YouTube Studio, then verify each incoming feed in Live Control Room before relying on unattended operation.

YouTube explains that the stream key identifies where the encoder sends its feed and allows YouTube to accept it in Manage live stream settings.

Choose whether to copy or re-encode the media

Re-encode when output control or compatibility requires it

Re-encoding lets you set codec, bitrate, frame rate, resolution, and keyframe cadence, but both VPS processes then perform encoding work. The example below uses H.264 and AAC settings as an illustration, not as a universal preset. Its 5 Mbps video rate aligns with YouTube’s recommended H.264 rate for 720p30, but only use that target when it suits the chosen output.

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

Copy only after checking the source

Stream copy avoids video and audio encoding, which can reduce CPU demand, but the source codecs, frame rate, resolution, and container constraints still need to be compatible with YouTube ingest. Inspect a file with ffprobe /path/to/file.mp4 and confirm what streams it contains before choosing copy mode. Copying does not make an incompatible input compatible.

YouTube’s current guidance supports H.264, H.265/HEVC, and AV1 video for RTMP/RTMPS, recommends CBR, supports frame rates up to 60 fps, and recommends a two-second keyframe interval that should not exceed four seconds. The exact bitrate depends on codec, resolution, and frame rate; consult YouTube’s current encoder settings table.

Run each loop as its own FFmpeg process

FFmpeg’s -stream_loop -1 repeats an input indefinitely. Put -re before each file input so FFmpeg reads it at its native rate for live-style output. FFmpeg options generally apply to the next input or output, so keep input options before -i and output options before the destination.

Rank #2
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
  • 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

Start stream one

ffmpeg -re -stream_loop -1 -i /path/to/stream-one.mp4 
  -c:v libx264 -preset veryfast -b:v 5M -maxrate 5M -bufsize 10M 
  -g 60 -keyint_min 60 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv 'rtmps://INGEST_URL/STREAM_KEY'

Replace the file path and quoted destination with the actual file and exact RTMPS URL plus key from Live Control Room. A key embedded in a command may be visible to users with access to process details, so restrict server access and prefer protected configuration or secret handling appropriate to your setup.

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

Start stream two independently

Run a second command or service with the second file, second stream’s endpoint and key, and its own log and restart policy. Keep the settings appropriate to that file; the example’s bitrate and output values are not automatically right for a different resolution, frame rate, or codec. Separate processes make it easier to isolate one stream’s failure without stopping the other.

Use copy mode only if the source is suitable

For a compatible source, the output codec options can be replaced with -c:v copy -c:a copy. Confirm that the input’s audio and video codecs and stream layout are accepted by the intended YouTube ingest configuration; if not, encode the incompatible track rather than assuming a copy will work.

Rank #3
CanaKit Raspberry Pi 5 Essentials Starter Kit (4GB RAM)
  • CanaKit Raspberry Pi 5 Essentials Starter Kit

Set bitrate and keyframes for YouTube

YouTube recommends constant bitrate (CBR) and a two-second keyframe frequency, with intervals no longer than four seconds. For the H.264 examples below, YouTube’s current encoder guidance, accessed 2026-10-03, gives these video bitrate figures:

Output H.264 minimum H.264 recommended
720p30 3 Mbps 8 Mbps
1080p30 5 Mbps 14 Mbps
1080p60 6 Mbps 17 Mbps
Stereo audio not stated in the cited recommendation 128 Kbps

These recommendations are specific to codec, resolution, and frame rate; do not treat the H.264 values as the correct targets for HEVC or AV1. In the example command, -g 60 represents a two-second GOP only when output is 30 fps. At 60 fps, a two-second GOP would be 120 frames. If you do not explicitly set the output frame rate, check the resulting frame rate and keyframe timing rather than assuming the value of -g means two seconds.

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

The example’s -maxrate and -bufsize illustrate a constrained-bitrate configuration, but they do not by themselves guarantee CBR in every encoder setup. Validate the actual output and compare it with YouTube’s requirements. Do not add audio and video recommendations into an exact network-capacity figure: transport overhead and bitrate variation also matter.

Rank #4
SANOOV Raspberry Pi 5 4GB Kit, 4GB RAM Single Board Computer with Active Cooler and ABS Case, Complete Raspberry Pi 5 Starter Kit for IoT Robotics Retro Gaming
  • All-in-One Complete Kit: This SANOOV RPi 5 bundle comes with Raspberry Pi 5 4GB RAM single board, active cooler, durable ABS case and screwdriver. No extra parts needed, ready to use right out of the box for beginners and hobbyists
  • Powerful Single Board Computer: Equipped with 4GB RAM and high-performance processor, delivers fast running speed for 4K playback, AI projects, programming and daily computing tasks. SANOOV for raspberry pi 5 4GB is equipped with broadcom 64 quad-core Arm Cortex A76 processor with gigabit ethernet and upgraded with IEEE 802.11ac Wi-Fi, Bluetooth 5.0 dual-band 2.4Ghz and 5Ghz and Power Over Ethernet (POE). Upgrading delivers 2-3 x speed vs Pi 4, redefining the experience
  • Efficient Active Cooler: Effectively lowers operating temperature and prevents performance throttling. Runs quietly even under long-time heavy load, ensures stable operation all day long. SANOOV RPi 5 4GB kit offer an active cooler, which combines an aluminium heatsink with a high-performance PWM fan. Active cooler is fully compatible with the Pi OS, which can effectively reduce the temperature of RPi5 and ensure its good performance during long-term high load operation
  • Sturdy ABS Protective Case: Well-fitted for Raspberry Pi 5 board, can be secured with 4 screws to effectively protect the Pi 5 motherboard from damage, reserves full access to all ports and buttons. SANOOV uses ABS material to produce the case, which has a softer texture and feel. Meanwhile, SANOOV case adopts a layered design for easy disassembly and installation. (Tip: The Case cannot install M.2 HAT Add on Board and Solid State Drive!)
  • Wide Application & Full Compatibility: Seamlessly compatible with official OS and mainstream peripheral accessories for Raspberry Pi 5. Whether you are a beginner, student, electronics hobbyist or professional developer, this all-in-one kit meets your diverse needs. It excels in IoT projects, robotics design, retro gaming devices, home media servers and other DIY creations. Backed by a large global community, you can easily find guides, technical support and shared projects online

Plan VPS bandwidth and compute for both outputs

Add the configured outgoing rates of both independent streams to estimate the sustained upload requirement. YouTube says total streaming bitrate cannot exceed available upload bandwidth and recommends 20% upload headroom. Applying that reserve to the combined rate of two independent outputs is a practical planning inference, not a YouTube-published two-stream rule. See YouTube’s streaming tips.

  • Check sustained outbound capacity from your VPS region, not just a headline port speed, and leave room above the combined target for overhead and variation.
  • Test both streams concurrently. A server that handles each stream separately may not handle both at once.
  • Monitor CPU, memory, network throughput, FFmpeg output, dropped frames, and each stream’s YouTube health status.
  • Account for scaling, filters, other VPS services, and any workloads beyond the two encoders.

No universal CPU-core or memory figure can be given without the media properties, encode settings, provider, region, and measured VPS performance. Two software encodes can require substantially more CPU than two compatible stream-copy outputs. Choose capacity from a simultaneous test rather than a generic VPS label.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Keep both streams running and recover deliberately

Run the processes under a supervisor such as systemd or another process manager, with one unit or managed job per stream. Configure restart-on-failure, separate logs, and monitoring for both the process and YouTube’s stream health. FFmpeg has reconnect options for certain protocols, but those options do not establish that every RTMP/RTMPS or YouTube-side failure will recover. Consult the FFmpeg protocol documentation, confirm which options apply to your input or output protocol, and test failure and recovery behavior before depending on it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
RasTech Raspberry Pi 5 8GB Kit with Active Cooler and Pi5 Case
  • 【What you Get】You will get 1*Pi 5 8GB Single Board,1*RasTech Case,1*Active Cooler,1*Screwdriver,1*Installation instructions,12-month free warranty, lifetime service, 24-hour prompt and friendly response.
  • 【More Connectors】There are two USB 3.0 ports(5Gbps simultaneously) and two USB 2.0 ports, which triple total bandwidth ,support any combination of up to two cameras or displays. Peak SD card performance is doubled through support for the SDR104 high-speed mode. It provides a smooth desktop experience for you. Offer Gigabit Ethernet and a PCIe interface, along with dual-band Wi-Fi and Bluetooth 5.0/BLE wireless capability. The RasTech Pi 5 Kit use the new 27W 5.1V 5A USB-C power connector.
  • 【 Support Dual 4Kp60 Display 】Each of the two microHDMI sockets can control a 4K display at 60 Hertz, now support HDR, offering super HD video for media streaming projects. RPi 5 is the first RPi model that comes with a PCI Express port (PCIe 2.0 x1 with 500 MB/s) to attach SSDs (requires separate M.2 HAT).
  • 【 Excellent Chips And Applications】Pi 5 is a full-size Pi computer using silicon built in-house at Pi. The RP1 “southbridge” provides the bulk of the I/O capabilities for Pi 5. Pi 5 is more friendly and convenient in the development of Internet of Things, Web development, machine identification, automatic control and other electronic equipment applications and network.
  • 【 Faster CPU, Better GPU 】 Pi 5 features a Broadcom BCM2712 64-bit quad-core Arm Cortex-A76 processor running at 2.4GHz, it delivers a 2–3× increase in CPU performance relative to RaspberryPi 4. The 800MHz VideoCore VII GPU is compatible to OpenGL ES 3.1 and Vulkan 1.2, substantial uplift in graphics performance. Pi 5 Offers lightning-fast CPU speed, a PCI Express interface, a Real Time Clock (RTC) and a power button and runs significantly cooler than Pi 4.
  • Do not share the stream key or log output containing it when asking for help.
  • Test the actual loop duration, audio, moving video, restart behavior, and both streams together before leaving them unattended.
  • Keep per-stream configurations and restart controls independent so a failure in one does not unnecessarily take down the other.

YouTube recommends testing with audio and moving video similar to the actual content, then monitoring stream health and messages in Live Control Room; see YouTube’s streaming tips.

Understand YouTube’s archive and DVR behavior

YouTube says streams under 12 hours are automatically archived. Separately, DVR rewind may be limited or unavailable for streams longer than 12 hours. DVR affects pausing and seeking backward while a stream is live; archive availability is a separate behavior. Check current Live Control Room settings and YouTube’s DVR guidance when choosing whether to run a continuous session or shorter sessions.

Troubleshoot common failures

Symptom Likely cause What to check
YouTube does not receive a stream Wrong endpoint or key, stream not configured, or connection issue Copy the exact RTMPS URL and matching key from Live Control Room; check FFmpeg logs and Live Control Room messages.
One stream works, the other drops or buffers Combined network demand or CPU load exceeds what the VPS sustains Measure both processes together; check outbound throughput, CPU, dropped frames, and each stream’s health.
FFmpeg reports an unsupported codec or YouTube rejects output Source format or chosen output settings are incompatible Inspect the file with ffprobe; use compatible codecs or re-encode to settings supported by YouTube.
The loop plays too quickly or output timing is wrong File input is not being paced in real time, or frame-rate/keyframe assumptions are incorrect Use -re before the file input and verify output frame rate and GOP timing.
Process exits and stays stopped No supervisor restart policy, or the failure is not handled by the configured reconnect options Inspect the process exit and logs, configure a per-stream supervisor, and test restart behavior.
Stream stops after exposing or changing a key Key was reset, compromised, or no longer matches the stream configuration Retrieve the current key, update only the corresponding process, and secure configuration and logs.

Or let it run in the cloud

If your goal is a prerecorded YouTube channel that stays live without maintaining a VPS and FFmpeg processes, StreamNeo runs uploaded videos or playlists from the cloud. Upload the video, add your YouTube stream key, and go live. Nothing has to stay on at home; each slot streams what you upload at any quality up to 4K 60fps for one flat price per slot, with automatic recovery if YouTube drops the stream. The first day is free with no card. Monthly: $9.99 per month. It streams to YouTube and plays uploaded videos rather than broadcasting from a camera. Start your free day with StreamNeo.

Frequently Asked Questions

Can the two FFmpeg loops use the same YouTube stream key?

No. Configure each process with the destination and stream key for its own intended YouTube Live stream.

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

Does a stream running longer than 12 hours get archived?

YouTube’s stated automatic archive behavior applies to streams under 12 hours; check current YouTube guidance for longer sessions.

Quick Recap

Bestseller No. 1
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM); CanaKit Turbine Black Case for the Raspberry Pi 5
$259.95
Bestseller No. 2
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM); CanaKit Turbine Black Case for the Raspberry Pi 5
$419.99
Bestseller No. 3
CanaKit Raspberry Pi 5 Essentials Starter Kit (4GB RAM)
CanaKit Raspberry Pi 5 Essentials Starter Kit (4GB RAM)
CanaKit Raspberry Pi 5 Essentials Starter Kit
$189.99

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

  1. How to Migrate a 24/7 YouTube Stream to a New VPSAdmit one · BlogHow to Migrate a 24/7 YouTube Stream to a New VPSOpened04 OCT 2026Runtime6 min
  2. How to Run a YouTube Playlist on a Headless Linux Server—and Broadcast It LiveAdmit one · BlogHow to Run a YouTube Playlist on a Headless Linux Server-and Broadcast It LiveOpened04 OCT 2026Runtime6 min
  3. How to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootAdmit one · BlogHow to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootOpened04 OCT 2026Runtime6 min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.