To loop prerecorded videos into YouTube Live from a Hetzner server, put the files in an FFmpeg concat playlist, then pass -stream_loop -1 before that playlist’s -i input. A representative command uses stream copy to avoid re-encoding, but it works only when the listed files have compatible streams, codecs, and time bases. Use the ingest URL and stream key from YouTube Live Control Room, test privately or unlisted, and supervise FFmpeg so you can recover if the process or connection stops.
How do I loop an FFmpeg concat playlist forever?
Create a text file named playlist.ffconcat beside the video files:
As an Amazon Associate I earn from qualifying purchases.
ffconcat version 1.0
file 'clip-01.mp4'
file 'clip-02.mp4'
file 'clip-03.mp4'
The ffconcat version 1.0 marker must be the first line and exact if you want FFmpeg to recognize the format automatically. The example command below selects the concat demuxer explicitly with -f concat. Each file line names one input; the demuxer plays them in listed order.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Run this command pattern from the directory containing the playlist and clips, replacing the endpoint and key with the values shown in YouTube Live Control Room:
#1 Best Overall
ffmpeg -re -stream_loop -1 -f concat -safe 0 -i playlist.ffconcat
-c copy -f flv 'rtmps://<youtube-ingest-endpoint>/<stream-key>'
-rereads the input at its native rate, rather than sending it as fast as the server can process it.-stream_loop -1repeats the concat input indefinitely. It is an input option, so it must appear before the-iit applies to.-f concatselects the concat demuxer;-safe 0allows paths that FFmpeg’s default safety rules might reject.-c copypasses the existing audio and video through without re-encoding. It does not make incompatible files compatible.-f flvselects the output container used in this command pattern for YouTube ingest.
This is a representative command, not a tested recipe for every FFmpeg build or source file. Check your installed build and output compatibility, then test with a private or unlisted event before relying on it for a public stream. See the FFmpeg documentation and the concat demuxer documentation.
Will the files concatenate cleanly?
FFmpeg’s concat demuxer expects the files to have the same streams, codecs, and time bases. It adjusts timestamps so each file starts after the previous one, but this is not a general-purpose format converter. If stream layouts or durations do not line up, transitions can have gaps or other timing problems; incorrect duration metadata can also create artifacts.
Rank #2
Use stream copy when the sources match
Check that each clip has compatible audio and video streams, codecs, and time bases before using -c copy. The option avoids the CPU load of encoding, but if one clip differs, it will not reconcile that difference or smooth the transition.
Normalize mismatched files before the live run
If the clips differ, prepare normalized versions with a consistent stream layout, codec, and time base, or use an appropriate re-encoding and filtering workflow. Do not assume a single concat command will convert unlike inputs. The concat script also supports a duration directive when stored duration metadata needs an override. Paths containing spaces or special characters must be escaped or quoted correctly.
Rank #3
-safe 0 relaxes path checks; use it only when you trust the playlist and every path it references. Keep the playlist and media under your control, and do not point it at untrusted paths.
How do I stream prerecorded videos continuously to YouTube Live?
- Create or select the live event. In YouTube Studio’s Live Control Room, create or choose the event and retrieve its ingest server URL and stream key. YouTube describes the key as password-like; keep it secret and do not publish it or commit it to a publicly accessible script or configuration file. Follow YouTube’s live stream settings guidance.
- Use the event’s exact connection details. Put the URL and key into the output configuration. The command above shows their combined RTMPS form only as a pattern; use the exact RTMPS server URL and key provided for your event. YouTube recommends RTMPS, which encrypts the encoder-to-YouTube connection. See YouTube’s RTMPS guidance.
- Choose encoder settings that match the source and current guidance. YouTube’s published options include RTMP/RTMPS and H.264, H.265/HEVC, or AV1 video; AAC or MP3 audio; CBR; frame rates up to 60 fps; and a recommended two-second keyframe interval, not exceeding four seconds. Its bitrate recommendations vary by codec, resolution, and frame rate, so use the matching row in the current encoder settings, bitrate, and resolution guidance, rather than assuming one bitrate suits every stream. With
-c copy, the output retains the source encoding, so check the source against the event’s intended settings. - Preview before making the stream public. Send representative footage with both typical motion and audio. Check the YouTube preview and stream-health alerts, correct any incompatibility or ingest issue, then move to the intended audience and event settings.
- Protect the material as well as the key. Only stream material you have the rights to use. YouTube’s content rules and live-event settings apply to prerecorded material too; looping a file does not grant permission to rebroadcast it. Review YouTube’s encoder live-stream setup guidance and account for any copyright or reused-content issues before scheduling a long-running event.
Can I run FFmpeg nonstop on a Hetzner server?
Yes, the workflow can run on a Hetzner server, but continuous output depends on the server you select and how you operate the process. No particular Hetzner plan, location, sustained throughput, or price is established here; check current provider specifications for your intended region and measure the actual workload before choosing a server.
Rank #4
Check bandwidth and host capacity
YouTube recommends keeping 20% upload-bandwidth headroom over the stream bitrate. Measure the selected host’s real outbound capacity rather than relying only on a headline network speed. YouTube’s guidance is clear: “The total bitrate you’re streaming cannot exceed the amount of upload bandwidth available.” Also allow for the disk reads needed to serve the files reliably. Stream copy usually avoids video re-encoding work, but it does not remove the need for stable storage and network delivery. See YouTube’s streaming tips.
Supervise the process and plan recovery
A single FFmpeg process will not restart itself after an exit, server restart, or network failure. Run it under a process supervisor or other restartable service, and arrange alerts for FFmpeg exits, encoder disconnects, low disk space, and YouTube stream-health warnings. These are operational safeguards, not a guarantee that a specific server or service configuration will remain uninterrupted. After a restart, verify that FFmpeg reconnects and that the event is receiving a healthy feed.
Account for YouTube’s archive limit
YouTube says streams under 12 hours are automatically archived. For a longer stream, do not assume YouTube will preserve an uninterrupted archive; plan event duration and separate recording or archive needs accordingly.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Common problems and fixes
| Symptom | Likely cause | What to check or do |
|---|---|---|
| FFmpeg rejects the playlist or cannot open a clip | Incorrect marker, malformed path, quoting issue, or a path rejected by safe-mode rules | Make ffconcat version 1.0 the exact first line; check each relative or absolute path and its quoting. Use -safe 0 only for a playlist and paths you trust. |
| Playback stutters, gaps, or has timing artifacts at a clip boundary | Incompatible stream layout or time base, or duration metadata that does not reflect the file | Check the source files for matching streams, codecs, time bases, and durations. Normalize the clips, or use a suitable duration override or re-encoding workflow where appropriate. |
| FFmpeg connects but YouTube reports an unhealthy stream | Encoding parameters do not match current guidance, or bitrate exceeds available outbound capacity | Check the applicable YouTube bitrate row, codec, frame rate, keyframe interval, and audio format. Measure outbound capacity and leave the recommended 20% bandwidth headroom. |
| The stream ends and does not resume | FFmpeg exited, the server restarted, or the connection dropped without process recovery | Inspect FFmpeg output and server logs, then restart the process. Configure supervision and alerts so an exit or disconnect is detected and recovery can be attempted. |
| The event connects to the wrong destination or fails authentication | Wrong event URL or key, or a key that was changed | Copy the current ingest details from that event’s Live Control Room and keep the key private. |
Or let it run in the cloud
If you want a nonstop YouTube stream without maintaining an FFmpeg process on a Hetzner server, StreamNeo is a cloud service for looping uploaded videos on YouTube. Upload a recording or build a playlist, add your YouTube stream key once, and go live. Your computer can stay off; the service runs the loop in the cloud.
- Nothing has to stay on at home.
- Each slot streams the upload as made, up to 4K 60fps, at one flat price per slot rather than quality tiers.
- Automatic recovery is included if YouTube drops the stream.
- The first day is free with no card, one free day per account.
The monthly option is $9.99 per month. StreamNeo is for YouTube streams from uploaded videos, not live camera feeds. Start the free day at StreamNeo registration.
Quick Recap
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.




