Skip to content
streamneo.
Setup Guides14 min read

How to Set FFmpeg to Loop a Video Forever for YouTube Live

Use FFmpeg or OBS with VLC to loop a local video for YouTube Live, connect RTMPS safely and test the stream before going 24/7.

sn.
StreamNeoPublished 3 October 2026
Worth sharing?

FFmpeg loops a local video forever with -stream_loop -1 placed before the file’s -i option. Add -re before -i as well when you want FFmpeg to read the file at its native frame rate rather than process it as quickly as possible.

If you prefer a visual setup, OBS Studio can loop several local files through its VLC Video Source. That is a different loop from YouTube’s viewer playlist control: OBS repeats media at the encoder, while YouTube’s playlist tools organise what a viewer watches after the broadcast has reached YouTube.

Two different kinds of looping

There are two separate jobs that are often described as “looping a YouTube video”. Keeping them separate prevents a common setup mistake.

The first job happens on your computer or streaming service. FFmpeg reads a file, reaches the end, returns to the beginning and continues sending the result to YouTube. OBS can do the same with its VLC Video Source and a playlist of local files. This is the encoder-side loop. It keeps the live broadcast active while the source media repeats.

The second job happens in YouTube’s viewing interface. A viewer can use YouTube’s playlist or repeat controls to replay videos in their own session. Those controls do not create a broadcast playlist, do not send a file to Live Control Room and do not make an encoder repeat your media. A viewer’s loop cannot replace FFmpeg, OBS or another source that continuously sends the live signal.

This distinction matters for a devotional channel, a bhajan station or a study stream. If the broadcast source stops after one file, viewers may see the live stream end or lose its signal. A viewer choosing to replay the resulting video does not restart the source process for everyone else.

You have two practical encoder-side routes:

Route What it repeats Best fit Main trade-off
FFmpeg command line One input file, or a prepared input sequence A repeatable, lightweight command and a machine you are comfortable administering You must handle command syntax, logs, reconnects and the running machine
OBS with VLC Video Source One or more local files in a playlist A visual workflow with several files and easy source control VLC must be installed with the correct architecture, and OBS must remain open

For a single file, FFmpeg is direct. For a small library, OBS’s VLC playlist is often easier to inspect and change. If the aim is a more deliberate day-long schedule, a grid may be more suitable than repeating one file; the guide on programming a 24-hour grid from a small library covers that planning problem.

The direct FFmpeg method

The essential command pattern is:

ffmpeg -re -stream_loop -1 -i input.mp4 \
  -c:v libx264 -c:a aac \
  -f flv "RTMPS_URL/STREAM_KEY"

Replace input.mp4 with the path to your file and replace the destination with the RTMPS address and stream key shown for your YouTube stream. Do not paste a real stream key into a public article, screenshot, support ticket or shared log.

-stream_loop is an input option. Its value -1 means infinite looping. Put it before the corresponding -i input.mp4, because FFmpeg options generally apply to the next specified input or output. If you place the option after the input, it is no longer being assigned to that input in the intended way.

-re tells FFmpeg to read the file at its native frame rate. That is useful when a local file is being sent as a live stream. Without it, a file-based process can read ahead much faster than real time, which is not what you want when the destination expects a continuous live signal.

The codec options in the example are a command pattern rather than a tested preset for every source. Confirm that your installed FFmpeg build includes the selected codecs, and choose the output resolution, frame rate and bitrate for the source, the channel and your upload capacity. YouTube’s current encoder settings guidance lists supported protocols, codecs and platform recommendations.

You should also test the join between the end and beginning of the file. Infinite input looping tells FFmpeg to repeat the input, but it does not promise a seamless transition for every container, codec, audio track or FFmpeg build. A brief pause, repeated frame or audio discontinuity can be more noticeable in a quiet ambience stream than in a busy music mix.

If you want FFmpeg to repeat several files in a planned order, prepare the input as a playlist or use a separate playlist mechanism rather than assuming that -stream_loop -1 turns one file into a multi-file scheduler. The option loops the input it is assigned to; it does not create an editorial timetable.

Install VLC and match its architecture to OBS

OBS’s VLC Video Source depends on VLC being installed. The source is not a self-contained playlist player that works without the required VLC installation. Install VLC before adding the source, then restart OBS if it was already open.

Use the official VLC download page rather than an unverified download mirror. During installation, note whether your OBS installation is 64-bit or 32-bit and install a matching VLC architecture where the current OBS and VLC documentation requires it. A mismatch can cause the VLC source to be missing, fail to load, or behave inconsistently.

On a current Windows computer, 64-bit OBS is common, but do not guess if the source does not appear. Check OBS’s installation and system information, then check the VLC build you installed. If you change VLC architecture, close OBS first and reopen it afterwards.

Architecture is separate from file compatibility. A matching 64-bit installation does not guarantee that every video will play correctly. The file still needs a format and codec that VLC can decode, and its audio needs to be present if you expect audio in the live output.

Before building the scene, open each intended file in VLC itself. Check that the picture appears, the audio is audible and the file reaches its end without an error. This simple check separates a media-file problem from an OBS source problem.

Add a VLC Video Source in OBS

Open OBS and select the scene that will carry the broadcast. In the Sources panel, select the plus button and choose VLC Video Source. If that option is not available, check the VLC installation and architecture before troubleshooting the playlist.

Give the source a clear name such as 24-hour media playlist. A descriptive name matters once the scene also contains an overlay, a logo, a background or an audio monitor. Select OK to open the source properties.

The VLC Video Source properties include a playlist area and playback controls. You can add local media files there, set the playlist behaviour and choose how OBS should display the source. The exact labels can vary slightly by OBS version, so use the visible source properties rather than relying on an old screenshot.

After adding the source, look at the preview. If the video is larger or smaller than the canvas, choose whether to resize the source to the canvas or adjust the canvas and output settings deliberately. A stretched devotional image, cropped subtitles or a narrow vertical video can make an otherwise stable stream difficult to watch.

Right-click the source and use the transform options if needed. Keep the intended aspect ratio. If the source has a different shape from the output, decide whether black bars, cropping or a designed background is preferable. Do this before testing the live connection so that you are checking the final composition rather than only the playlist mechanism.

Add local files to the playlist

In the VLC Video Source properties, use the playlist controls to add the files stored on your computer. Add them in the order you want them to play. For a single-file loop, add one file. For a bhajan hour, study session or ambience block, add the files that should follow one another.

Use stable local paths. If you move a file, rename its containing folder or connect a removable drive under a different path, OBS may no longer find it. A simple folder structure is easier to maintain than files scattered across Downloads, external drives and temporary project folders.

For example, a small channel might use a folder such as:

D:\channel-media\
  morning-bhajans.mp4
  temple-visuals.mp4
  quiet-instrumental.mp4

Add the files in the desired sequence and play the source in the OBS preview. Listen through the same audio device or monitoring path you will use during the test. A file can look correct while its audio is silent, too quiet or routed somewhere unexpected.

If a file refuses to play, test it separately in VLC first. Then check its path, permissions and format. Re-encoding every file is not automatically the answer. First identify whether the issue is a missing file, an unsupported codec, an unusual container, a damaged section or an OBS configuration problem.

Keep the source library local to the machine running OBS. A network folder can work in some environments, but it introduces another dependency: the network path must remain available and responsive. For an overnight stream, every additional dependency is something you need to test rather than assume.

A playlist also gives you a practical way to avoid repeating one short clip for an entire day. Repetition can be appropriate for a meditation loop or a single visual station, but a small sequence may be more suitable for a local news loop, a product display or a study channel. If the material is made from existing uploads, see how to turn existing YouTube uploads into a 24/7 live channel for the content-planning side of the decision.

Enable Loop Playlist

In the VLC Video Source properties, enable Loop Playlist. This tells the OBS source to return to the first playlist item after the final item has finished. With one file, it repeats that file. With several files, it repeats the complete sequence.

Do not confuse Loop Playlist with a setting that repeats only the current item. If your OBS version exposes separate playback controls, read the labels carefully and test with at least two short files. You should see file A move to file B, then file A again. That confirms that the playlist, rather than only the first item, is being repeated.

After enabling the loop, leave the preview running through a boundary. Watch for a black frame, frozen image, missing audio or a long pause. The source can be configured correctly and still reveal a transition issue caused by the particular files.

If the boundary is poor, try files with consistent frame rates, dimensions and audio characteristics. You can also edit the media so the final and opening moments make sense together. A hard cut may be acceptable for a news item but distracting in a slow ambience stream.

OBS must stay open and the computer must stay awake for this method. Prevent automatic sleep, confirm that the display turning off does not stop the process, and check that the machine will not restart for updates during the planned broadcast. The exact power and update controls depend on the operating system, so verify them on the machine you will actually use.

If you need a local machine to run continuously, monitor more than the preview. A clean OBS preview does not prove that YouTube is receiving a healthy signal. Watch the output statistics and YouTube’s stream-health indicators during a real test. The guide on reading dropped-frame numbers on a long stream explains why network and rendering figures should be interpreted separately.

Connect OBS to YouTube Live

Create or open the broadcast in YouTube Live Control Room. In the stream settings, copy the stream URL and stream key shown for that broadcast. YouTube may show an ordinary RTMP address by default, so confirm whether the current stream uses RTMPS and copy the secure address provided by Live Control Room.

In OBS, open Settings, then Stream. Select the relevant YouTube service if it is available, or choose a custom streaming service when you are entering the server details yourself. Paste the server address and stream key into the matching fields. Keep the key private and avoid placing it in a scene description or a public configuration file.

YouTube describes RTMPS as RTMP sent over TLS/SSL. If the connection reports a protocol or SSL problem, re-copy the address from Live Control Room, check that it begins with rtmps when that is what YouTube supplied, and review YouTube’s RTMPS troubleshooting guidance. The guidance also discusses trying port 443 when needed.

Before starting, open OBS’s Output settings and choose an encoder and output mode that your computer can sustain. YouTube’s current guidance covers H.264, H.265 and AV1 video, AAC or MP3 audio, CBR encoding and other recommended properties. Your practical choice still depends on the source, the available hardware and the upload connection.

For example, YouTube’s current H.264 table lists different bitrate recommendations for different resolutions and frame rates. A 1080p stream at 30 fps is not the same workload as a 720p stream at 60 fps, and neither should be treated as a universal setting for every file. Compare the current table with your source and available upload capacity instead of copying a number from an unrelated tutorial.

Set the output resolution and frame rate deliberately. If the source is a static devotional image with modest motion, there may be little benefit in forcing a high frame rate. If the source contains fluid motion, a suitable frame rate may matter more. The right choice is the one your encoder can maintain while leaving enough upload capacity for ordinary network variation.

Start the stream as an unlisted or otherwise controlled test where appropriate. Let it pass through at least one file boundary and check the received picture and sound in YouTube. YouTube recommends testing with audio and video movement similar to the intended stream and monitoring stream health. Run an upload speed test as part of your preparation, but treat the result as an indication rather than a guarantee for every hour of operation.

Test the overnight failure points

A stream that runs for ten minutes is not yet an overnight setup. Test the parts that change over time: the playlist boundary, audio continuity, available disk paths, computer power settings, upload stability and YouTube’s received signal.

Keep a short checklist beside the machine:

  • The VLC Video Source appears in the scene.
  • VLC is installed and matches the OBS architecture requirement.
  • Every playlist file plays in VLC and in the OBS preview.
  • Loop Playlist is enabled.
  • The first file follows the last file as expected.
  • Audio is present at the source and in the YouTube test.
  • The stream key and RTMPS address are current and private.
  • OBS is not scheduled to sleep, close or restart during the run.
  • YouTube reports a healthy incoming signal.

For FFmpeg, keep the terminal output available during testing. If the file plays once and stops, check that -stream_loop -1 is before the file’s -i. If it runs too quickly, check that -re is before the input. If YouTube does not receive a signal, check the key, destination protocol, supported codecs, bitrate and upload capacity.

For OBS, a missing playlist item often points to a path or permission problem. A source that disappears can indicate VLC installation or architecture trouble. A stream that reaches YouTube but has dropped frames may involve rendering load or network capacity rather than the loop itself.

If continuous operation is more important than keeping a particular computer switched on, a managed workflow can remove the need to leave your desktop running. StreamNeo removes the recurring task of keeping the local playback machine open by taking an uploaded video and sending it to YouTube after you provide the stream key, with automatic monitoring and restart when the broadcast drops.

That convenience does not remove the need to check your media rights, YouTube settings, stream health or the suitability of the content. It simply addresses the specific operational problem of a local computer being the thing that must stay awake. If you are comparing local software with hosted approaches, Restream and 24/7 loop services solve different problems, so compare the actual operating requirement rather than only the feature names.

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

Does -stream_loop -1 loop a video forever?

Yes. FFmpeg documents -1 as the value for infinite input looping. Place -stream_loop -1 before the relevant file input, such as ffmpeg -re -stream_loop -1 -i input.mp4 ....

Why use -re with a local file?

-re makes FFmpeg read the input at its native frame rate, which is useful when sending a file as a real-time live stream. It does not repair a damaged file or guarantee a seamless transition at the loop boundary.

Does YouTube’s repeat control loop my live broadcast?

No. A viewer’s repeat or playlist control affects that viewer’s playback session. It does not create an encoder-side playlist and does not make OBS or FFmpeg continue sending media to YouTube.

Can OBS loop files without VLC installed?

Not when you are using OBS’s VLC Video Source. Install VLC with an architecture compatible with your OBS installation, add the files to the source playlist, enable Loop Playlist and test the transition before relying on it.

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 ↗