Skip to content
streamneo.
Setup Guides12 min read

How to Run Two FFmpeg YouTube Loop Streams on One VPS

Set up two independent FFmpeg loop streams, use separate YouTube destinations, and check bandwidth and encoding load before relying on one VPS.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

Two looping YouTube Live broadcasts can run from one VPS as two independent FFmpeg processes, each with its own input, loop settings and YouTube destination. Whether the VPS can sustain both depends on the actual streams: their bitrates, codecs, resolution, frame rate, filters and whether FFmpeg must encode them.

Plan for the combined outgoing bitrate and test both processes at once before relying on them overnight. There is no universal VPS size that guarantees two streams will work; a setup that copies compatible media has a different workload from one that software-encodes two outputs.

How two independent streams work

Treat each broadcast as a separate job. Process one reads its own file, paces playback in real time, loops it and sends it to the first YouTube Live destination. Process two does the same for a different input and a different destination. They share the VPS operating system and network connection, but neither process should reuse the other stream’s key or output URL.

FFmpeg’s -stream_loop -1 repeats an input indefinitely. The -re input option reads a file at its native rate, which is useful when sending prerecorded media as live-style output rather than transmitting it as quickly as the VPS can read it. FFmpeg documents both options and shows real-time file input in its official examples. These options control file reading and looping; they do not establish that the file is compatible with YouTube or that the machine can encode it in real time.

A useful mental model is two separate command lines, not one command that somehow creates two unrelated channels. Give each a clear name, input path, log file and destination. If you use a service manager or shell scripts, keep the configuration and restart behaviour distinct too. That makes it easier to see which stream failed and to restart one without accidentally interrupting the other.

The audience and channel setup are separate decisions as well. A devotional music loop and a local news bulletin might need different YouTube Live events, titles, descriptions, audience settings and schedules. The encoding processes do not make those editorial or account choices for you. Confirm the intended channel and event in Live Control Room before starting either process.

Check the VPS and network limits

Check two different forms of capacity: network upload and compute. For network planning, add the configured outgoing bitrates of both broadcasts. If one output is set to 5 Mbps and the other to 3 Mbps, the nominal video total is 8 Mbps before audio and transport overhead. That is an arithmetic example, not a recommended configuration or a measurement of actual traffic.

YouTube says the total stream bitrate must not exceed available upload bandwidth and recommends leaving headroom. Its streaming tips recommend 20% upload headroom. Applying that reserve to two independent outputs is a sensible planning inference, not a separate published rule for this two-process setup. Allow additional room for audio, overhead, bitrate variation and other workloads sharing the network interface.

Do not rely only on the VPS plan’s headline network capacity. Check what outbound throughput is available in the machine’s region and measure sustained throughput from the running VPS where your provider permits it. Also consider any traffic limits, shaping or transfer allowances that apply to your account; check the provider’s current terms rather than assuming all advertised capacity is continuously available.

Compute demand depends on what each process does. With compatible source media, stream copy can avoid video encoding work, though the input, container and output compatibility still need checking. If each process decodes, scales, filters and re-encodes video in software, both need enough CPU to keep up in real time. Resolution and frame rate affect that work, as do codec choice, encoder preset, audio processing and the VPS’s actual processor performance.

Memory matters too, but there is no reliable memory figure to prescribe without the actual commands and other services on the VPS. Account for FFmpeg, the operating system, any monitoring or restart tools, and other workloads. The practical test is whether both processes can run together without sustained resource pressure or output health problems, not whether the VPS matches a generic size suggestion.

YouTube’s encoder guidance gives different bitrate recommendations for different codecs, resolutions and frame rates, and asks for constant bitrate and a two-second keyframe interval, not exceeding four seconds, in its documented configuration. Consult the current encoder settings guidance and choose output settings for your intended format. For more background on source compatibility and codec choices, see video codecs and formats for live streaming.

Prepare each input and loop

Before building commands, inspect both files. Note their containers, video and audio codecs, dimensions, frame rates, audio presence and duration. A file that plays locally is not automatically a suitable live input. Decide whether you can pass its streams through unchanged or must transcode to a format and bitrate supported by your chosen YouTube configuration.

Keep one input per process. For example, name the files /srv/media/temple.mp4 and /srv/media/market-news.mp4, then use each path only in its corresponding command. Confirm permissions and paths as the account that will run FFmpeg. If a file is moved, renamed or replaced, the process will not find the new content until you update and restart it.

A representative command for a file that you intend to re-encode might look like this:

ffmpeg -re -stream_loop -1 -i /srv/media/temple.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'

This is a structural example, not a universal preset. Its 5 Mbps video value corresponds to YouTube’s recommended H.264 rate for 720p30 in the supplied guidance, but it is not a claim that your input is 720p30 or that these settings suit it. Match bitrate, frame rate, keyframe interval, audio and codec to the actual output you need. FFmpeg options generally apply to the input or output that follows them, so keep input options such as -re and -stream_loop before the relevant -i, and output settings before the destination.

If you stream-copy, use the appropriate -c:v copy and, if suitable, -c:a copy options instead of the example encoding options. Copying is only appropriate when the source streams and output requirements are compatible; it does not convert an unsupported codec or repair unsuitable media. If you need to scale, change frame rate or encode, test the resulting settings with both processes running.

Keep the two commands in separate files or configuration entries and quote each destination carefully. Avoid putting a real stream key in a public script repository, shared screenshot or unredacted log. The headless FFmpeg setup discussion is useful context if you are choosing to manage these processes without a graphical desktop.

Get a separate YouTube URL and key for each stream

In YouTube Live Control Room, create or select the event for the first broadcast and retrieve the ingest URL and stream key shown for it. Repeat for the second event or stream configuration. Confirm which destination belongs to which process, and label your local configuration accordingly. YouTube explains that the key tells the encoder where to send the feed and allows YouTube to accept it in its stream key help.

Prefer the RTMPS URL provided by Live Control Room where available. YouTube describes RTMPS as an encrypted extension to RTMP. Do not assume that the RTMP and RTMPS addresses can be swapped or assembled by hand; use the URL shown for the relevant destination. The URL and key together form the output target, so each process must use its own pair.

Handle keys as passwords. Restrict access to command files, environment files and logs that might expose them. Do not paste a command containing a key into a public support thread. If a key is exposed, reset it in Live Control Room and update the matching process configuration; changing one key should not lead you to overwrite the other process’s destination by mistake.

Check that both events have the intended visibility and metadata before going live. A valid encoder connection does not guarantee that the public-facing event is configured as you want. YouTube recommends testing with content resembling the real stream and watching the event’s health and messages. That is particularly important when two processes start close together: an error on one event may not be visible in the other event’s dashboard.

Start and verify the first FFmpeg process

Start one process first, with its own input, settings and destination. Run it in a controlled test and inspect the FFmpeg output for missing files, unsupported codecs, authentication failures or connection errors. In Live Control Room, verify that the intended event receives a picture and audio if audio is part of the programme. Do not infer success merely because FFmpeg is still running; check the YouTube event as well.

A practical first-stage test includes motion and representative sound rather than a static frame or silent placeholder. Confirm that the image is the intended size and frame rate, that sound is present at a usable level, and that the stream health display does not show a persistent problem. If the file is long, test across a loop boundary too, since the transition from the end back to the beginning can reveal an unexpected pause or abrupt content change.

Save output to a dedicated log for this process, with timestamps where possible. Keep the key out of shared logs or redact it before sharing a failure report. Note the command version and settings used, so if you adjust a bitrate or codec you can identify which configuration produced the observed result.

Once the first stream is stable in the test, stop or leave it running according to your test plan and prepare the second. Avoid changing several variables at once. If the first test fails, correct the input, output URL or encoding setting before adding the second workload; otherwise you will have two potential causes to investigate.

Start and verify the second process

Launch the second FFmpeg process with its own input path, loop option, encoding or copy settings, and its own RTMPS destination and key. Verify the second event in Live Control Room independently. Confirm that its image and audio are correct, and then confirm that the first stream remains healthy while both are active.

The simultaneous test is essential. One process may fit comfortably while two processes compete for CPU, memory, disk reads or outbound capacity. Let both run long enough to observe sustained behaviour rather than judging the setup from a brief connection. Check FFmpeg’s reported frame progress and speed, VPS CPU and memory, network throughput, and each event’s YouTube health status.

If the VPS struggles, determine whether the bottleneck is encoding or network before changing the machine. Try stream copy only if the media is compatible; otherwise consider a less demanding encode, lower resolution or frame rate, or separate machines. Each choice changes output quality or operational complexity. The frame-rate troubleshooting guide explains why a lower frame rate can be a useful setting to test when the actual workload drops frames.

Keep the process controls independent after launch. A restart of stream one should not inadvertently launch another copy of stream two or replace its key. Use distinct process names and logs, and check the exact process and destination before stopping or restarting anything. If your intended goal is to avoid maintaining an always-on computer yourself, compare that operating approach with running a cloud-based 24/7 YouTube stream; this VPS method still leaves you responsible for the server configuration and its monitoring.

Monitor resource use and diagnose failures

A process that starts successfully is not proof of an unattended system. Monitor each FFmpeg process, each YouTube event and the VPS. Look for a process exit, repeated reconnects, increasing dropped or delayed frames, high sustained CPU, memory pressure and network throughput near the available limit. Keep separate logs and alert on a stopped process or an unhealthy event where your monitoring setup allows it.

FFmpeg documents reconnect options for certain protocols in its protocol documentation, including reconnect behaviour and delay controls. These options are not a universal guarantee of recovery for every RTMP or RTMPS failure, nor do they repair a YouTube-side event problem. Check which options apply to your input or output protocol and test what happens after a controlled interruption. A process supervisor can restart a process that exits, but you should still verify that it reconnects correctly and that YouTube accepts the resumed feed.

Diagnose by separating symptoms. If FFmpeg cannot open a file, check the path and permissions. If it connects but YouTube shows no incoming feed, check the event, URL and corresponding key. If the stream is healthy at first but degrades when the second starts, compare CPU and network readings during both runs. If only one process fails, inspect its own log and event before changing shared VPS settings.

Plan for content and platform behaviour as well as process health. YouTube says streams under 12 hours are automatically archived; separately, DVR rewind may be limited or unavailable for streams longer than 12 hours. These are different behaviours, so check current YouTube help and your channel settings if archiving or rewind matters to viewers. A continuously looping process does not by itself settle how you schedule events, handle interruptions or preserve an archive.

For a channel that needs unattended operation, decide who will notice a failure and what they should do. Test a process restart, key reset procedure and recovery after a network interruption before leaving the setup alone. StreamNeo removes the need to keep a personally managed VPS and FFmpeg process running for a file-based broadcast: you upload a video and provide the YouTube stream key, then the cloud-run stream can continue with your computer off and be monitored and restarted if it drops. It is YouTube-only, so it is not a substitute if you specifically need to administer two custom FFmpeg processes or stream to other platforms.

Before committing, compare the operating options on the pricing page. When the file and channel are ready, start free — 24-hour trial, no card.

FAQ

Can one VPS run two FFmpeg streams at the same time?

It can, if its network and processing capacity are sufficient for both actual outputs. Test both processes together; one stream working alone does not demonstrate that the combined workload will work reliably.

Should the two processes use the same YouTube stream key?

No. Configure each process with the URL and key for its own YouTube Live destination. Keep the credentials separate and treat each key as a password.

Is stream copy always the best way to reduce CPU load?

No. Stream copy can avoid video encoding work when the source media is compatible with the required output, but it does not convert codecs, resolution or frame rate. Check the file and test the event before choosing it.

Will FFmpeg automatically recover from every dropped connection?

No. Protocol reconnect options and a process supervisor can help with certain failures, but neither guarantees recovery from every encoder, network or YouTube-side issue. Test recovery and monitor the resulting stream health.

YOU’VE REACHED THE END

Keep the ideas coming.

More guides, useful tools and a little help for your next broadcast.

Back to the journal ↗
YOUR NEXT READ

A little more to explore.

More Setup Guides guides ↗ · All topics ↗