If your fireplace audio is already inside the video file, loop that single input with -stream_loop -1. If the video and crackling-fire audio are separate files, loop each input and map the intended video and audio streams explicitly.
Use -t when you want a finished file of a known duration. If you plan to keep a live process running, leave -t out, but test the join between the end and beginning first: FFmpeg repeats the input, but it does not automatically make an abrupt source seam sound or look seamless.
Choose the input arrangement first
Start by identifying what you actually have. Open the fireplace video in a media player and check whether it produces sound. If it does, you have one audiovisual input and can begin with the simpler command. If it is silent, or if you want to use a separate WAV or other audio file, you need a command with two inputs.
This distinction matters because -stream_loop is an input option. It applies to the input that follows it, rather than to every file mentioned later in the command. With one file, one loop option is normally enough. With separate video and audio files, each input needs its own loop option if both are shorter than the intended output.
A second question is whether you need a finite export or an ongoing process. A one-hour MP4 is useful for checking the result, uploading a prepared file, or creating a repeatable source for another workflow. An indefinitely running command is a different job, and it needs a way to stop it manually rather than an output duration.
Before editing commands, check the files themselves. Note their extensions, whether they play correctly from beginning to end, and whether the audio begins and ends cleanly. A fireplace recording that contains a short silence at the end may repeat with a noticeable gap even when the FFmpeg syntax is correct.
If your eventual plan is a YouTube broadcast rather than a local file, keep the two stages separate while testing. First make a file that loops correctly. Then work through the broadcast setup, as explained in this guide to running prerecorded videos on a YouTube Live stream. This makes it easier to tell whether a problem comes from the source file or from the streaming process.
Loop one file with FFmpeg
For a one-hour MP4 where the fireplace video already contains its audio, use this as a practical starting point:
ffmpeg -stream_loop -1 -i fireplace.mp4 -t 01:00:00 -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 192k fireplace-loop.mp4
Replace fireplace.mp4 with your input filename and change 01:00:00 to the duration you need. The output filename is fireplace-loop.mp4, so choose a different name from the input to avoid confusion and to preserve the original source.
The placement of -stream_loop -1 is important. It appears before -i fireplace.mp4 because it controls that input. FFmpeg documents -1 as infinite looping. The command therefore keeps presenting the input again until an output limit or manual stop ends the process.
The -t option appears after the input and before the output filename. In this position it limits the output duration. The input can be looped indefinitely while the written file still stops at the requested duration. This is why the command can make a finite one-hour file without needing to calculate how many copies of the source are required.
The remaining options ask FFmpeg to encode video with libx264 and audio with AAC. -preset medium and -crf 23 are example video settings, while -b:a 192k is an example audio bitrate. They are not universal quality settings. The encoders available to you depend on the installed FFmpeg build, and the most suitable output also depends on the software or platform that will play it.
If you want the process to continue until you stop it, remove -t 01:00:00 and use an appropriate output target. The command will then have no finite output duration supplied by -t. Do not treat this as proof that the source has a good boundary. Let it run during a test and listen when the clip returns to its beginning.
For a long-running YouTube workflow, the command is only one part of the arrangement. You may also need to account for reconnects, credentials, and the chosen ingest method. If the stream itself keeps dropping, the relevant fault may be outside the loop command; this troubleshooting guide covers YouTube RTMP reconnects.
Set the output duration deliberately
A finite output is usually the best first test because it gives you a file that can be inspected from beginning to end. Set the duration with -t and put it before the output filename, as in the example above. You can use another duration in the same HH:MM:SS style, provided it matches what you actually intend to produce.
Do not remove -t merely because the source is being looped. -stream_loop -1 describes how long the input remains available. It does not, by itself, tell a finite export when to stop. Without an output limit, the process continues until you interrupt it or another condition ends it.
-shortest is not a substitute for a chosen duration when the relevant inputs are looped indefinitely. It stops when the shortest output stream ends, but an endlessly looped stream is specifically being kept available. For a defined file, use -t and inspect the resulting duration afterwards.
The duration limit is also useful when the source video and audio are not the same length. If both are looped and mapped into the output, -t gives the result a clear end even when one input would otherwise continue. It does not correct a mismatch inside the source material, so listen for drift or a change in the relationship between picture and sound.
If you are preparing several test files, use a short duration first, but make sure the test is long enough to pass the source boundary. A test that ends before the first repeat cannot tell you whether the join is acceptable. Once the boundary has been checked, render the longer file with the same arrangement and review the beginning, the join, and the end.
Loop separate video and audio inputs
When the video and sound are in separate files, explicitly loop both inputs and select their streams:
ffmpeg -stream_loop -1 -i fireplace-video.mp4 \
-stream_loop -1 -i crackling-fire.wav \
-map 0:v:0 -map 1:a:0 -t 01:00:00 \
-c:v libx264 -preset medium -crf 23 -c:a aac -b:a 192k \
fireplace-loop.mp4
Here, the first -stream_loop -1 belongs to fireplace-video.mp4. The second belongs to crackling-fire.wav. Repeating the option is necessary because each option applies to the input that follows it. If you loop only the video input, the separate audio may end before the requested output duration.
The -map expressions make the selection explicit. -map 0:v:0 selects the first video stream from input zero, and -map 1:a:0 selects the first audio stream from input one. This is helpful when a file contains more than one possible stream, or when FFmpeg's automatic selection does not choose the combination you intended.
Use the actual filenames and keep the output name distinct from both source names. The example assumes that the first file contains a video stream and the second contains an audio stream. If your files contain additional streams, or if the audio is not the first audio stream, inspect them before changing the map expressions.
The separate inputs can have different durations and different loop boundaries. The picture may return to its first frame while the sound has a different rhythm, or the sound may contain a short lead-in that becomes obvious on every repeat. FFmpeg will repeat the streams according to the command, but it does not establish that their subjective transitions will blend.
If the finished file has sound but the wrong picture, or picture but no sound, review the input order and the -map values first. A map refers to the numbered inputs in the command, starting at zero. A small change in command order can therefore change which file 0 and 1 mean.
When you are working with a sequence of different fireplace clips rather than repeating one reusable clip, do not automatically use this method. Joining separate segments is a concat task, not simply an input-loop task. The FFmpeg FAQ describes concat approaches and the choice between re-encoding and stream copying; choose the method that matches whether you are repeating one input or joining different material.
Understand the main loop options
-stream_loop N repeats an input stream. A value of 0 means no looping, while -1 means infinite looping. Because it is an input option, place it before the -i that it controls. In a two-input command, treat the two input options independently.
The video loop filter is a different mechanism. It repeats video frames, and its loop=-1 setting is documented as infinite. It operates on video frames and does not establish an audio loop. For a normal file that already contains the paired fireplace picture and sound, input-level looping is the clearer first approach.
You do not need to combine the input loop and the video loop filter simply because both use the word “loop”. Combining them changes the processing path and may repeat frames in a way that does not match the sound. Start with the least complicated method that represents your source arrangement.
The official FFmpeg documentation is the right place to verify option behaviour for the build you are using. FFmpeg's documentation references are regenerated for the newest revision, so the locally installed documentation may be more relevant when your system has an older version.
Choose codecs and output settings
The example re-encodes the output rather than copying the input streams. Re-encoding gives the command a common way to create a new MP4 while applying the selected video and audio encoders, but it takes processing time and can change the result from the original source.
The example settings are:
| Part of the command | Example | What it controls |
|---|---|---|
| Input looping | -stream_loop -1 |
Repeats the following input indefinitely |
| Output duration | -t 01:00:00 |
Stops the written file at the selected duration |
| Video codec | -c:v libx264 |
Selects the H.264 video encoder if available |
| Video processing | -preset medium |
Chooses an encoder speed and processing trade-off |
| Video quality control | -crf 23 |
Sets an example constant-rate-factor value for the encoder |
| Audio codec | -c:a aac |
Selects AAC audio encoding if available |
| Audio bitrate | -b:a 192k |
Requests the example audio bitrate |
| Stream selection | -map |
Selects the intended streams from the inputs |
These values are starting points, not guarantees about quality, file size, compatibility, or encoder availability. A build may not include the requested encoder, and a playback target may have its own accepted formats. If FFmpeg reports an encoder error, check the installed build and its available encoders instead of assuming the command is wrong in every environment.
-c copy can pass streams through without re-encoding, but that does not make it the automatic choice here. Stream copying depends on the source codecs, the output container, and the operation being performed. It may be unsuitable when the source streams do not fit the output container or when the looping operation requires a new encoded output.
For a YouTube-bound file, test the finished MP4 in a local player before adding it to a longer workflow. If it plays correctly locally but fails after upload or broadcast, investigate the next stage separately. Readers preparing continuous playback can also compare this with the practical considerations in FFmpeg playlist streaming to YouTube from a VPS, while remembering that a playlist of different files is not the same as looping one file.
Check the finished file and its boundary
Do not judge the command only by whether it completes. Open the output and check the first seconds, the point where the source repeats, and the final seconds. Watch for a visible jump in the flame, a frozen frame, a black frame, a burst of noise, a click, a silence, or a change in loudness.
The loop boundary is the join between the end of one source pass and the beginning of the next. If the source ends at a different visual state from its beginning, repeating it will reveal that difference. If the audio waveform does not meet cleanly, the repeat may produce a click. Neither issue means that the input-loop option failed; it means the source itself needs attention.
Use a media player that lets you seek near the suspected boundary, and listen with headphones at a sensible volume. Check the same point more than once because a subtle issue can be easy to miss on the first pass. For a separate-input workflow, check both the picture and sound together, not only each file on its own.
If the join is abrupt, choose a source with a better ending and beginning, edit the seam before looping, or use an editing approach that deliberately blends the transition. Do not assume that adding another loop option will crossfade the content. The commands here repeat inputs; they do not promise a seamless transition.
Also check the output duration and stream selection. If the file ends early, confirm that -t is where you intended and that the output filename is the one you opened. If the audio is absent or incorrect, review -map and inspect the input streams. If the output never ends, confirm that a finite -t is present before the output name.
If audio and picture gradually lose alignment, compare the source files and consider whether their lengths, timestamps, or formats differ. The audio desync troubleshooting guide covers the wider streaming problem, but the first useful test remains the same: establish whether the mismatch is already present in the source or introduced by the later workflow.
Once the file passes these checks, run a longer test under the conditions you expect to use. A computer that will be switched off cannot keep a local FFmpeg process alive, so a cloud-based workflow can remove the need to leave your own machine running: StreamNeo lets you upload the prepared file, add your YouTube stream key, and have the channel run with automatic monitoring and restart if the broadcast drops.
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
Should I use -stream_loop or the video loop filter?
For a normal fireplace file that already contains its audio, start with -stream_loop -1 before the input. The video loop filter repeats video frames only and does not by itself create an audio loop, so it is a different tool for a different processing requirement.
Why does the command stop after one play?
Check that -stream_loop -1 appears before the correct -i. With separate video and audio files, add the option before each input that must repeat. Also confirm that you are running the command you edited rather than opening an older output file.
How do I make a fixed-length file?
Add an output-side -t before the output filename, such as -t 01:00:00. This limits the written output even when the input is looped indefinitely. Review the resulting file rather than relying only on the command completing.
Why is the loop audible or visible?
Repeating a file does not guarantee that its final frame and audio sample meet its first frame and sample cleanly. Inspect the boundary, then use a better-edited source or deliberately edit or blend the seam before repeating it.