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

To loop a playlist on YouTube Live from a VPS, put the media paths in an FFmpeg concat-demuxer playlist, pass -stream_loop -1 before that playlist’s -i, and send the output to YouTube’s ingest URL with the stream key from Live Control Room. The example below re-encodes the files for a consistent output; test it with your actual media and VPS before relying on it unattended.

What you need before starting

  • A VPS with FFmpeg installed and enough sustained upload capacity for your chosen stream profile. Requirements vary by workload and provider; transcoding uses more resources than stream copy, and no provider-specific sizing is established here.
  • Video files you have the rights to broadcast, stored on the VPS or accessible to it.
  • A YouTube channel with live streaming available, plus the ingest URL and stream key shown in YouTube Studio’s Live Control Room.
  • A plan for previewing, monitoring, and recovering the stream if the process or connection stops.

Prepare a playlist FFmpeg can read

Create a text file named playlist.txt. Use one file line per clip, in playback order:

file '/path/to/clip-one.mp4'
file '/path/to/clip-two.mp4'

The concat demuxer sequences the listed files; it does not make different media formats uniform. Before streaming, inspect the clips and check that they have compatible stream structure, codecs, and time bases if you intend to copy streams without re-encoding. FFmpeg warns that inaccurate duration information can cause artifacts. If the sources differ, normalize or re-encode deliberately, then check transitions and audio.

The example uses -safe 0 to permit paths outside concat’s restricted safe-path form. Only use it with a playlist you control: do not feed arbitrary or untrusted file lists to FFmpeg. See the FFmpeg concat demuxer documentation for syntax and restrictions.

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

Create or select the YouTube live stream

  1. Open YouTube Studio and go to Live Control Room.
  2. Create a stream or select the one you intend to use. Set its title, privacy, and other metadata as needed.
  3. Copy the ingest URL and stream key displayed for that stream. Treat the key like a password: do not publish it in a script, repository, screenshot, or log. If it is exposed, reset it in Live Control Room. YouTube explains stream-key handling in Manage live stream settings and the encoder workflow in Create a YouTube live stream with an encoder.

Use the URL provided by Live Control Room rather than guessing an ingest address. YouTube recommends RTMPS where supported; consult YouTube’s RTMPS instructions and confirm the FFmpeg build supports the protocol.

Start the looping FFmpeg stream

This is an adaptable command example, not a tested VPS configuration. Replace the paths and ingest URL/key with your own values. The encoder values shown are illustrative; choose settings for your source, target resolution and frame rate, and sustained VPS upload capacity.

ffmpeg -re -stream_loop -1 -f concat -safe 0 -i playlist.txt 
  -c:v libx264 -preset veryfast -b:v 4000k -maxrate 4000k -bufsize 8000k 
  -pix_fmt yuv420p -g 60 -c:a aac -b:a 128k 
  -f flv 'rtmps://INGEST_URL/STREAM_KEY'

-stream_loop -1 tells FFmpeg to repeat the input indefinitely. It is an input option, so it appears before the corresponding -i playlist.txt; placing it after the input will not apply it to that input as intended. The concat input supplies the playlist as one sequential source. The -re option reads at the source’s rate rather than pushing the files as fast as possible.

This command re-encodes video with H.264 and audio with AAC. Re-encoding can produce a consistent output from compatible but non-identical sources, but it consumes VPS CPU or other encoding resources. Stream copy can reduce encoding load when the files are compatible, but it does not fix incompatible streams or normalize output. Test your choice and inspect the transitions.

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

Choose settings and test before leaving it unattended

YouTube’s published encoder guidance lists RTMP/RTMPS and H.264, H.265, or AV1 video; AAC or MP3 audio; up to 60 fps; constant-bitrate encoding; and a recommended two-second keyframe interval, not exceeding four seconds. Exact bitrate guidance varies by codec, resolution, and frame rate, so the example’s 4,000 kb/s video rate and 60-frame GOP are not universal recommendations. Check YouTube’s encoder settings, bitrates, and resolutions for the profile you choose.

  1. Start the FFmpeg process and open the stream preview in Live Control Room.
  2. Check picture, aspect ratio, audio level and continuity, and the transition from the last playlist item back to the first.
  3. Watch YouTube’s stream-health messages and FFmpeg output for connection errors or dropped frames. YouTube recommends testing before going live; see Streaming tips.
  4. Test with motion and audio representative of the actual playlist, not only a static or silent clip. Fix any source or profile issues before relying on the stream.

Plan for interruptions and archives

A loop option repeats media while the FFmpeg process is running; it is not a promise that a VPS, network connection, FFmpeg process, or YouTube ingest will remain uninterrupted. A continuous stream needs operational monitoring and a recovery plan. A VPS provider’s CPU, memory, bandwidth, and egress limits differ, and no single plan can be recommended without provider-specific workload measurements.

Rank #3
HP MicroServer Gen10 Plus Mini Tower Server, Intel Xeon E-2224 3.4GHz, 32GB RAM, 16TB Storage, RAID, Windows Server 2019
  • HP MicroServer Gen10 Plus Tower Server for Business with Microsoft Windows Server 2019 OS!
  • Intel Xeon E-2224 Quad-Core 3.4GHz 8MB CPU, Up To 4.6GHz Turbo
  • 32GB (2 x 16GB) DDR4 PC4-21300 2666MHz Unbuffered Memory
  • 16TB (4 x 4TB) 7.2K 6Gb/s SATA 3.5" HDDs in RAID
  • Hard drives and memory upgrades included separately NOT installed, installation required.

YouTube Help says streams under 12 hours are automatically archived when stopped. That is a platform condition, not a guarantee every stream will archive successfully, and it does not establish that an arbitrarily long broadcast will be fully archived. Decide whether to run planned sessions or a continuous broadcast, account for the effect of stops on viewers, and check current Live Control Room behavior. See YouTube’s encoder setup guidance.

Troubleshooting

FFmpeg says it cannot open a playlist file

Check that playlist.txt is in the working directory or provide its full path, and verify that the VPS user running FFmpeg can read the list and every referenced media file. Check spelling, capitalization, quoting, and paths. Use -safe 0 only when you control the playlist and need paths outside the safe form.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

The stream plays only once

Ensure -stream_loop -1 is before the matching -i. It applies to an input; it does not loop a separately constructed output.

FFmpeg reports concat, timestamp, or decoding errors

Inspect the listed files’ stream structure, codecs, time bases, and duration metadata. The concat demuxer sequences packets and does not repair incompatible files. Normalize or re-encode the inputs as needed, then test the full sequence and its loop point.

YouTube does not receive the stream

Verify that the stream is live or ready in Live Control Room, the correct ingest URL and key are in use, and the key has not been reset. Check FFmpeg protocol support and the VPS network path; prefer the RTMPS URL when available. If the key was exposed, reset it and update the command or protected configuration.

YouTube reports poor stream health or playback stutters

Check that the VPS can sustain the selected bitrate and that CPU resources are sufficient for the encoding workload. Reduce the output profile if the connection cannot sustain it, or use stream copy when the media is compatible and the output profile is suitable. Review YouTube’s profile-specific bitrate guidance and inspect its health messages.

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

The playlist has a gap, artifact, or audio change at a transition

Compare source formats and duration metadata, then preview the whole playlist including the wraparound from last clip to first. Normalize incompatible media and check audio continuity, aspect ratio, and timestamps before the next live session.

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

Or let it run in the cloud

If you do not want a VPS and FFmpeg process to be your responsibility, StreamNeo keeps an uploaded-video YouTube stream running from the cloud: upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home. Each slot streams the upload as made, up to 4K 60fps, at one flat price per slot; StreamNeo automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly is $9.99 per month. UPI and cards are supported in India, and card checkout is available worldwide. Start your free day on 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.