Skip to content
streamneo.
Setup Guides13 min read

How to Loop Prerecorded Videos on YouTube Live with FFmpeg on Windows

A Windows FFmpeg starter workflow for looping a video on YouTube Live, with setup, stream-key, compatibility and testing checks.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

To loop a prerecorded video on YouTube Live from Windows, FFmpeg can repeat the input with -stream_loop -1, pace it with -re, and send an encoded feed to the server URL and stream key shown in YouTube Live Control Room. The command below is a configurable, untested template, not a tested recipe or a way to guarantee an uninterrupted broadcast.

You will need an eligible channel, an FFmpeg build with the encoder you choose, a compatible source file, and enough upload capacity for the selected output. Treat looping, stream connectivity, YouTube’s event controls and archive behaviour as separate concerns: repeating the file does not resolve problems with any of the others.

Check that your channel can go live

Before installing or configuring FFmpeg, confirm that live streaming is enabled for the channel you intend to use. YouTube’s live-streaming eligibility guidance says the channel must be verified and must not have had live-streaming restrictions in the past 90 days. If this is your first time enabling live streaming, activation may take up to 24 hours, according to YouTube’s encoder setup guidance; do not leave the first check until the minute you plan to broadcast.

Open YouTube Studio and look for the live-streaming controls. If YouTube does not let you create or select a stream, resolve that account or channel issue first. An FFmpeg command cannot enable a channel or clear a restriction. Check the current official eligibility page rather than relying on an old tutorial, since platform requirements can change.

A prerecorded loop still goes out as a live broadcast, with a live event and its own controls. If the programme is devotional music, a local news loop or a study video, decide how you will supervise the event and what viewers should see when the scheduled programme ends. For a broader planning example, see how a 24/7 Bengali music channel can use prerecorded videos; the channel’s editorial and rights choices remain yours to make.

Install and verify FFmpeg on Windows

FFmpeg is a command-line media tool. On Windows, it must be available either through a configured system PATH or by calling ffmpeg.exe with its full path. The particular Windows package and installation route are not specified here, so choose a source you trust and check its documentation. Avoid copying an installer recommendation from an unrelated video without checking who distributes it and what it contains.

Open Command Prompt and enter:

ffmpeg -version

If Windows reports that ffmpeg is not recognised, the executable is not on the current PATH, or Command Prompt was opened before that setting changed. You can either configure PATH for the folder containing the executable or use the full path in your command, for example "C:\Tools\ffmpeg\bin\ffmpeg.exe". Adjust that example to the actual location; it is not an installation path you must use.

Next, check whether the build has the encoder in the example command. In Command Prompt, run:

ffmpeg -hide_banner -encoders

Look through the output for libx264. If it is absent, -c:v libx264 will fail, even though FFmpeg itself runs. Select a build containing the encoder or choose an encoder supported by your build and revise the command accordingly. Encoder availability, performance and output quality depend on the build and settings; do not assume that every Windows binary includes the same options.

Also check basic file access. A path with spaces should be enclosed in double quotes, and the Windows account running Command Prompt must be able to read the file. If you want a more managed route than leaving a Windows computer and FFmpeg process in charge, the guide to running a 24/7 YouTube stream without a PC covers that different operating model. It does not change the need to prepare the video and event correctly.

Get the server URL and keep the key private

In YouTube Studio, open Live Control Room and create or select the stream you will use. YouTube’s encoder setup instructions show where to obtain the server URL and stream key. Copy the values for that specific stream into your encoder configuration. Use the current destination displayed by Live Control Room; do not guess a URL format from a sample command or an old screenshot.

A stream key is a credential. YouTube describes it as functioning like a password and address for the stream, so do not post it in a public tutorial, share a screenshot that exposes it or leave it in a file you intend to publish. The command below contains a placeholder rather than a real key. Replace the placeholder locally, and keep the resulting command private.

If you think the key has been exposed, use YouTube Studio’s stream settings to reset it, then update the destination used by FFmpeg. YouTube’s stream-key guidance explains the relevant controls. After a reset, an older command can still contain the old value, so make sure you launch the updated one. Do not paste credentials into a support message or share them with someone who only needs to diagnose a codec or file-path error.

Prepare the video and output settings

Check the source file before starting a broadcast. Confirm that it plays from beginning to end, has the intended audio, and does not contain a black opening or an ending you would not want viewers to see every time around. A loop repeats the source; it does not repair a visible or audible discontinuity at the join. Listen and watch across the end-to-start boundary as well as through the middle.

Match resolution, frame rate, codec and bitrate to both the source and YouTube’s current encoder recommendations. YouTube’s live encoder settings recommend RTMPS and list H.264, H.265 and AV1 video, AAC or MP3 audio, constant bitrate (CBR), frame rates up to 60 fps, and a two-second keyframe interval, with a maximum interval of four seconds. Its table gives different bitrate ranges for different combinations. For example, the table lists 5–14 Mbps for H.264 at 1080p30; do not apply that range automatically to another resolution, frame rate or codec.

The example transcodes video with H.264 and audio with AAC. Transcoding is a more adaptable starting point than copying streams unchanged, but it takes processing and is not automatically appropriate for every file or Windows build. Check the source’s actual video and audio streams and compare the proposed output with YouTube’s current settings. A silent source needs an appropriately adapted audio configuration; do not assume -c:a aac can create an audio track that is not present.

The keyframe interval is set in frames, so it depends on frame rate. In the sample, -g 60 corresponds to two seconds only at 30 frames per second. If your output is set to another frame rate, change the GOP setting to match YouTube’s two-second target, and check the result against its current guidance. The sample bitrate values are illustrative command parameters, not a recommendation for every source. Choose the value from YouTube’s current table for your chosen codec, resolution and frame rate.

A file copied without re-encoding may use less CPU, but only if its codecs, timestamps, container and stream parameters are compatible with the intended ingest and repeat behaviour. Compatibility is not established merely because the file plays in a desktop media player. If you are deciding between constant and variable bitrate in another workflow, the CBR-versus-VBR explanation may help frame the trade-off; use YouTube’s current encoder guidance for this FFmpeg output.

Use -stream_loop -1 and -re in a starter command

In FFmpeg, -stream_loop -1 asks the input to repeat indefinitely, while -re reads a file at its native rate to simulate live input pacing. They solve different problems: looping makes the input repeat, and pacing avoids sending a file as fast as the computer can process it. FFmpeg documents both options in its command-line documentation. Input options belong before the -i input they apply to.

Here is a configurable template for Command Prompt. It has not been run or tested as part of this article. Replace the file path, tune settings for your actual media, and use the server URL and key from Live Control Room:

ffmpeg -re -stream_loop -1 -i "C:\Videos\prerecorded.mp4" -c:v libx264 -preset veryfast -b:v 6000k -maxrate 6000k -bufsize 12000k -pix_fmt yuv420p -g 60 -c:a aac -b:a 128k -f flv "rtmps://SERVER/APP/STREAM_KEY"

The filename and destination are placeholders. Replace the destination with the complete current RTMPS server URL and the matching key in the format Live Control Room provides. The example uses an FLV output container for an RTMP-family ingest; YouTube recommends RTMPS, so use its supplied secure destination rather than an assumed endpoint. Keep the key private even if you store the command in a local batch file.

Read the command from left to right. -re and -stream_loop -1 are input options, followed by -i and the quoted source path. -c:v libx264 chooses the H.264 encoder if your build includes it; -preset veryfast is an encoder setting, not a promise about picture quality or performance. The bitrate, maximum rate and buffer are output settings that you must check against the chosen format and YouTube’s table. -pix_fmt yuv420p selects a commonly used pixel format, while -g sets the GOP spacing in frames. The audio options choose AAC and an example audio bitrate, which you should verify against the source and output needs.

If the source frame rate is 30 fps, a GOP of 60 frames is two seconds. At a different frame rate, revise -g; do not carry over 60 without checking. Likewise, do not assume the example’s video or audio bitrates fit your media. YouTube recommends CBR and provides settings by format, so adjust the example to the current table rather than treating the values as universal.

When you run the command, FFmpeg prints progress and diagnostics in the console. Keep the window open while this Windows-hosted workflow is operating. Closing Command Prompt stops the process; restarting it later requires checking the YouTube event state and starting the correct command again. A repeating file does not keep a computer powered, preserve an internet connection or reopen a YouTube event after a failure.

Test the feed in Live Control Room

Do not wait for the intended audience to discover a configuration problem. Start a test with representative motion and audio, then check that FFmpeg connects and that Live Control Room shows the incoming preview. YouTube explicitly recommends testing before going live. Inspect the picture and sound, including a passage near the file’s repeat boundary, and confirm that the broadcast looks and sounds as intended.

Watch the stream health indicators in Live Control Room while the test runs. YouTube’s streaming tips recommend leaving 20% of upload bandwidth available beyond the total stream bitrate. That spare capacity is headroom, not a guarantee that a connection will remain stable. If other people or devices use the same connection, account for their traffic too, and check the actual upload conditions at the place and time you expect to broadcast.

For a scheduled event, use the controls in Live Control Room after the preview is present; follow the current instructions shown for that event rather than assuming that starting FFmpeg alone starts every kind of scheduled broadcast. Decide in advance who will monitor the event and how it will be ended. This is particularly important if the programme is intended to run overnight: a successful short test shows that the configured feed reached the preview, not that all parts of a longer operation will keep working.

Troubleshoot playback and connection problems

If there is no preview or FFmpeg reports a connection error, first confirm that the server URL and stream key belong to the selected stream and were copied accurately. Check for accidental spaces, missing characters or a stale key. YouTube’s encoder troubleshooting guidance recommends obtaining a new key in Live Control Room and updating the encoder when a third-party encoder cannot start. If you reset a key, remove the old one from the command you intend to run.

If the stream is rejected or appears unstable, compare the actual output against YouTube’s current requirements: protocol, codec, bitrate mode, keyframe interval, resolution and frame rate. Check that your installed build provides the requested encoder and that the input file remains readable. Leave upload headroom, watch stream health, and use the console’s error messages to distinguish an input problem from an encoder or network problem. A generic connection error alone does not identify which setting is wrong.

If the picture repeats but audio is missing, out of sync or unpleasant at the join, verify that the source has the audio track you intend to broadcast. Test the full repeat boundary and revise or edit the source if the transition is noticeable. Do not assume that looping produces seamless audio. If the picture freezes, check whether FFmpeg is still making progress and whether the source or network has failed; a loop option cannot repair a stalled process or interrupted connection.

If the stream stops unexpectedly, review the FFmpeg console for input errors, encoder failures or network interruption, then check the event state in YouTube Studio before restarting. Avoid launching a second command blindly: first establish whether the original process is still running and whether the event remains active. If the ongoing issue is that a local OBS setup stops overnight, the OBS troubleshooting guide for a 24/7 stream covers a different tool, but the same basic distinction applies: restarting a media process is not the same as guaranteeing a continuous YouTube event.

Plan for long streams and archives

A looped input can continue supplying media while FFmpeg is running, but it does not make a Windows computer an unattended broadcast system. Power settings, a Windows restart, a closed console, a failed encoder, a network interruption or a YouTube event ending can all interrupt the intended schedule. If the channel must operate while nobody is available to watch it, plan how you will notice a failure and what you can realistically do to recover. Do not treat -stream_loop -1 as an uptime mechanism.

YouTube says that streams under 12 hours are automatically archived in its encoder setup guidance. That statement is limited to streams under that duration; do not assume the same archive behaviour for a longer event or promise replay retention. Check the current official page and the event’s settings before relying on a recording. Decide whether the live event should end at a planned time, and use the available Live Control Room controls to end it when appropriate.

There is also a practical difference between an endless input and a useful programme. Repeating one file may be right for a static ambience station or a fixed devotional set, but viewers may notice a hard cut, repeated announcement or unchanged visual. Review the content and the boundaries, and decide whether a playlist or a scheduled change would better serve the channel. Your publishing plan should also account for whatever permissions apply to the video and audio you intend to broadcast; technical compatibility does not establish that you have rights to use the material.

Running the process on a local Windows machine means keeping that machine available and checking the live event. When the pain is needing the local computer to stay on for the whole broadcast, StreamNeo removes that specific burden by turning an uploaded video into a YouTube Live stream without keeping your computer running. It does not change the need to check channel eligibility, credentials, content, event settings or archive limits.

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

How do I loop a video on YouTube Live?

Use FFmpeg’s -stream_loop -1 input option to repeat the file, and -re to pace reading at its native rate. Encode a YouTube-compatible output and send it to the current server URL and stream key from Live Control Room. Test the actual preview before the intended broadcast.

Does -stream_loop -1 guarantee a 24/7 stream?

No. It repeats the input while FFmpeg is operating, but it does not prevent a computer shutdown, process error, internet interruption or YouTube event ending. Plan to monitor the feed and check how you will respond to a failure.

Can I use the command exactly as written?

No. It is an untested template with placeholders and example settings. Confirm the encoder exists in your Windows build, replace the path and destination, and adapt the bitrate, frame rate, GOP and audio settings to your source and YouTube’s current guidance.

Will YouTube keep an archive of a long loop?

YouTube states that streams under 12 hours are automatically archived, but that is not a promise about streams at or beyond that duration. Check the current official guidance and event settings before relying on a replay.

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 ↗