For one already-rendered saree catalog video, FFmpeg can repeat the file for a YouTube Live encoder stream with -stream_loop -1. Put that option before the file’s -i; the RTMPS destination and stream key must come from your YouTube Live Control Room, not from a command copied from somewhere else.
This guide is for one continuous video file, not a directory of separate product clips or a text playlist. The command below is a starting shape, not a tested recipe for every Ubuntu installation or network: check your own FFmpeg build, media, upload capacity and YouTube preview before relying on it.
Check the rendered catalog file
Prepare the catalog as a single video before starting FFmpeg. That could be a carefully edited sequence of saree images, product footage, titles and transitions rendered into one file. The loop option repeats that finished input; it does not assemble a set of images or join a folder of clips into a playlist.
Review the whole file, including the end and the transition back to the beginning. A hard cut from the last frame to the first may be acceptable for a rotating product catalogue, but an abrupt change in music or a title that appears for only a moment can make the repeat distracting. If you need a deliberate transition, edit it into the rendered file rather than expecting -stream_loop to add one.
Check that the video opens and plays locally, that its dimensions and frame rate suit the output you intend to send, and that any audio behaves as expected. A silent catalogue can be intentional; if there is music, make sure it is cleared for your use and that it does not cut out unexpectedly at the loop point. This is a practical content and rights check, not a determination of your rights or YouTube eligibility.
You can inspect basic media details with ffprobe if it is installed alongside FFmpeg. For example, ffprobe -hide_banner -i "catalog.mp4" reports streams and format details; it may also print a non-zero exit status because no output format was requested, so treat it as an inspection command rather than a conversion. If you only have separate photographs or many independent clips, create and inspect a single rendered video first. A related distinction comes up in handling missing files in a YouTube podcast stream: a repeating source file and a sequence of separately managed assets fail in different ways.
Install and verify FFmpeg on Ubuntu
Ubuntu installations do not all have the same FFmpeg version or build options. If FFmpeg is already installed, begin with ffmpeg -version; this shows the version and build configuration on the machine that will run the stream. Then check the available options with ffmpeg -h full and look for -stream_loop and the encoders you expect to use. Do not assume a command line written for another Ubuntu release or another machine has been tested on yours.
If you need to install FFmpeg, use the package source appropriate to your Ubuntu release and follow its current instructions. The Ubuntu Jammy manual describes a package version for that release, but that release-specific detail is not a statement about what your machine or a different Ubuntu version will install. Use Ubuntu’s package manager and documentation for your release rather than downloading an unknown binary from a forum.
After installation, check that the command starts and that the expected encoders are present. The example later uses libx264 for video and AAC for audio; a build may not include every named encoder. ffmpeg -encoders lists available encoders, and ffmpeg -h encoder=libx264 can show relevant options when that encoder exists. If an encoder is unavailable, resolve the build or choose settings supported by your actual installation before starting a public event.
This is also where a local computer has a real trade-off. It gives you direct control over the file and process, but the machine, power and network connection all become part of the broadcast path. If the computer is at home in India, consider whether it will remain powered and connected overnight, and whether a household router or power interruption could stop the process. For operational planning, see how to restart a YouTube stream after a power outage; restart behaviour is separate from making a file repeat.
Get the YouTube RTMPS ingest details
In YouTube Studio, open the Live Control Room and create or select the encoder stream you intend to use. Copy the server URL and stream key shown for that stream. Those values belong to your channel and live setup; they are not universal FFmpeg values. YouTube’s encoder setup guidance explains how to connect an encoder, and its live encoder settings page recommends RTMPS where supported.
RTMPS is RTMP carried over a secure TLS connection. Use the RTMPS server URL shown by YouTube when the selected endpoint and your FFmpeg build support it. Do not infer the URL from an example in a guide: the Control Room is the source for the details for your stream. In the command, YOUR_INGEST_URL and YOUR_STREAM_KEY are placeholders, not values to paste unchanged.
The key acts like a credential. Keep it out of screenshots, public posts, shared documents and public code repositories. Do not put a real key in an article, tutorial or command copied into a forum. If you think someone else has seen it, reset or replace it in the Live Control Room and update the command or configuration that uses it. A key that has leaked should not be treated as private just because the stream has not started yet.
Before using the channel for a product presentation, check the current stream setup and any account requirements in YouTube’s official pages. A successful connection does not itself establish that a channel or its content qualifies for every YouTube feature. This guide only covers the encoder connection and repeating one file.
Put -stream_loop -1 before the input
The key syntax is the position of the loop option. FFmpeg documents -stream_loop as an input option: -1 means infinite repetition, and the option belongs before the corresponding input. In this example, -stream_loop -1 comes before -i "catalog.mp4":
ffmpeg -re -stream_loop -1 -i "catalog.mp4" \
-c:v libx264 -pix_fmt yuv420p -r 30 -g 60 \
-c:a aac -b:a 128k -ar 44100 \
-f flv "rtmps://YOUR_INGEST_URL/YOUR_STREAM_KEY"
The official FFmpeg command-line documentation describes the input loop option. Its placement matters because FFmpeg command options apply to inputs or outputs according to where they appear. If you move -stream_loop -1 after the input, do not assume it will loop that already-opened file; place it before the input it should affect.
The command uses -re to read the file at its native pace rather than as fast as the computer can process it. -i identifies the single input. The output portion selects video and audio encoders, some format parameters and the FLV container commonly used for RTMP-family streaming. The final quoted string is the output address, where YouTube’s actual ingest URL and key go. These are example settings, not a guarantee that the command will work unchanged on your system.
A common source of confusion is the word “playlist” in the title. A rendered video can itself contain a sequence of product shots, which makes it suitable for this single-file loop. A directory of separate videos, a list of URLs, or still images is a different input arrangement. Do not expect -stream_loop -1 alone to discover or play those assets in order. Render them into one continuous file, or design and test a source-specific playlist workflow separately.
Set output encoding parameters deliberately
The example selects H.264 video and AAC audio because they are familiar choices for a broadly compatible SDR starting point, but your choice depends on the source, installed FFmpeg encoders and current YouTube guidance. The -pix_fmt yuv420p option requests a common pixel format. The frame rate (-r 30) and GOP setting (-g 60) in this illustration correspond to a two-second keyframe interval only if the output is actually 30 frames per second. Do not copy these numbers blindly if the source or intended stream profile differs.
YouTube’s current encoder settings guidance specifies supported codecs and recommends a two-second keyframe interval, with an upper limit in its guidance. It also provides bitrate recommendations by codec, resolution and frame rate. For example, its table lists H.264 at 720p30 with a 2 Mbps minimum and 6 Mbps recommended bitrate. That is a platform-specific reference for that profile, not a universal bitrate for every resolution, codec, upload connection or catalog file. Consult the current table for the profile you select.
The example does not set a video bitrate, so it is not ready to treat as a complete profile. Decide on output dimensions, frame rate and target video bitrate based on the source and the applicable YouTube table, then add and verify the corresponding FFmpeg options for your encoder. Your sustained upload rate needs headroom beyond the stream’s target rate so that normal variation does not leave the encoder struggling to send data. A speed test at one moment is not proof that a connection can sustain a stream through the night.
| Decision | What to check | Why it changes the command |
|---|---|---|
| Resolution and frame rate | Source properties and the YouTube profile you intend to send | These affect encoding load and which bitrate guidance applies |
| Video codec and encoder | FFmpeg build, available encoder and CPU capacity | A codec name in a command is useful only if the build can encode it reliably |
| Video bitrate | Current YouTube table and sustained upload capacity | A target that exceeds available upload capacity can produce health problems; a lower target may call for a different profile |
| Audio | Whether the file has audio, its codec and sample rate, and your intended output | A silent catalogue may not need the same audio path as a narrated or music-backed one |
| Ingest endpoint | The exact URL from Live Control Room and RTMPS support | The destination is specific to your stream and must match the selected endpoint |
For stereo AAC, the example uses 128 kbps and 44.1 kHz, values listed as recommended in YouTube’s guidance, but do not force an audio track if the source has none or the content is meant to be silent. Check whether the file contains audio and decide whether to encode, map or omit it accordingly. Settings should reflect what you are actually sending, not merely fill out a template.
Encoding also consumes CPU. A modest Ubuntu computer may manage a simple static catalogue at one profile and struggle at another, especially if other workloads run at the same time. Watch actual encoder output and system load during a private test rather than assuming that a machine capable of playing a file can encode it in real time. YouTube’s recommendations are not a promise that a particular device or internet connection can sustain them.
Run the command and inspect the incoming preview
Start with a private test, or use an unlisted stream if that suits your channel setup. Replace the filename with the path to the rendered file and replace the output placeholder with the exact RTMPS destination assembled from YouTube’s displayed server URL and stream key. Do not paste your actual key into a public example or share it while asking for help. If the file path contains spaces, keep it quoted as in the example.
Once FFmpeg starts, read the console rather than leaving it unattended immediately. Check that the input is recognised, the expected audio and video streams are mapped, the chosen encoder starts, and output is being sent. A local message that the process is running does not tell you whether YouTube is receiving a healthy stream. Open the Live Control Room preview and inspect its status and health messages.
YouTube recommends testing with the audio and motion expected in the actual broadcast and monitoring stream health. That matters for a saree catalogue too: inspect small text, product colours, transitions, and any voiceover or music in the preview. If the preview is blank, delayed, or reports a problem, stop and diagnose the file, options, connection and ingest details before making the stream public. Do not treat a single successful test as proof that the setup will remain healthy indefinitely.
If the preview shows unexpected colour, choppy motion or audio issues, revisit the source and the chosen output profile. A static slideshow may not need the same frame rate as detailed moving footage, while a product close-up can reveal compression artefacts that are less visible in a simple title card. Change one relevant setting at a time and retest. Record the working profile locally without recording or sharing the stream key alongside it.
A local FFmpeg process remains dependent on the computer and its connection. If your stream drops, identify whether the process stopped, the network changed, or YouTube reported an ingest issue. The guide to checking for a CGNAT-related stream drop in India can help frame one possible network investigation, but it does not establish that CGNAT is the cause in every case.
Protect the key and plan for monitoring
Treat the stream key as a password from the moment you copy it. Keep it in a private local configuration or other protected place, restrict access to the Ubuntu account that runs FFmpeg, and avoid leaving it visible in terminal recordings or screenshots. Shell history can retain commands typed directly into a prompt, so consider how you launch the process and who can read that account’s files. Do not commit a real key to a repository, even a private one, without considering who can access it and how long it will remain there.
Plan who will notice a problem during the hours the catalogue is meant to run. A terminal window left open is not the same as monitoring. Check the Control Room stream health, the running process and the local connection as appropriate, and decide what you will do if the machine reboots or the connection fails. FFmpeg can repeat its input indefinitely while it runs; it does not guarantee uninterrupted streaming, reconnect successfully in every circumstance, or keep a YouTube live event open forever.
YouTube says streams under 12 hours are automatically archived, according to its live stream archiving guidance. Do not read that as a promise of an archive for a longer stream, or as a guarantee that an infinitely looping input makes a perpetual event. If you intend a long-running channel, check the current YouTube guidance and plan event restarts and monitoring around the platform’s limits rather than relying on the word “infinite” in the FFmpeg option.
If managing a powered computer, process restarts and an exposed key is becoming the bigger burden than editing the catalogue itself, StreamNeo can take the uploaded video and keep the YouTube broadcast running without your computer left on; it is still your responsibility to prepare appropriate media, provide the channel’s stream key privately, and monitor the resulting stream.
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 folder of saree clips?
No. In the example it repeats one input file, and it must appear before that file’s -i. To play several clips as a catalogue, first render them into one continuous video or use a separately designed playlist workflow that matches your media layout.
Where do I find the RTMPS URL and stream key?
Use the Live Control Room in YouTube Studio and copy the details for the encoder stream you created or selected. Prefer the RTMPS endpoint where it is offered and supported by your FFmpeg build. Keep the key secret and reset it if it is exposed.
Can I use the command exactly as written for any Ubuntu computer?
No. It is an illustrative starting shape. Check your FFmpeg version and encoders, the file’s properties, YouTube’s current settings for your intended profile, and your sustained upload capacity; then test the actual stream in the preview.
Does an infinite input loop mean the YouTube stream will never end?
No. The option describes input repetition while FFmpeg is running. The computer, network, encoder process and YouTube event can still stop or encounter problems, so plan to monitor the stream and check YouTube’s current guidance for long broadcasts.