Short answer
- Clear the music: your own, commissioned, or a license that allows 24/7 streaming.
- Crossfade the tracks into one long WAV, and crossfade the last track into the first too, so the file has no seam where it restarts.
- Add a looping visual and, if you like, a "now playing" caption, then export one video file.
- Enable live streaming on the channel (the first time "may take up to 24 hours") and create a custom stream key.
- Send the file 24/7 from your PC, a rented server or a hosted service.
Settings from YouTube Help. Commands tested with ffmpeg 7.0.2 on the same day.
What you are building
Every 24/7 lofi stream has the same four pieces. Only the last one has to run around the clock.
If you also publish uploaded mixes, our lofi channel hub covers the upload side, with its own tested upload workflow. This guide is about the file that plays on the live stream, which has different settings and one problem uploads do not have: it never ends.
1. Clear the music first
A 24/7 stream plays every track dozens of times a day, and YouTube checks live streams for copyrighted material while they run. If it finds some, "a placeholder image may replace your live stream", and that can happen even with a license: "If your channel isn't added to their allowlist, your live stream can be interrupted even if you've licensed the third-party content." YouTube's advice is to "ask the owner of the content to add your channel to their allowlist through Content ID" (YouTube Help, copyright issues with live streams).
Free music is often ruled out for this use by name. Chillhop, for one, runs a creators program for YouTube videos and streams, but its terms say: "Please do not use our music to create your own 24/7 music stream. If this happens, it will be taken down." (Chillhop, use our music).
The safe sources are music you made, music you commissioned with streaming rights in writing, and licenses that name 24/7 or continuous streaming. Our guide to where lofi channels get their music quotes the terms of the main labels and libraries. Keep a list of every track, its source and its license; you will need it for the description, for the "now playing" caption in section 3 and for any dispute.
2. Decide how long the mix is
The mix length decides how often a regular listener hears the same track. Here is the arithmetic for a day of streaming:
| Mix length | Times it plays per day |
|---|---|
| 30 minutes | 48 |
| 1 hour | 24 |
| 2 hours | 12 |
| 3 hours | 8 |
| 4 hours | 6 |
Longer is better for listeners and for YouTube's repetitive content review, which we cover in inauthentic content and 24/7 channels. If you have enough music for several hours, our 24/7 playlist guide shows how to order it so the same artist does not come round too soon. The limit is file size. If your sender caps uploads (Loopcast takes videos up to 4 GB), the file's bitrate decides how long the mix can be:
| File bitrate | Longest file |
|---|---|
| 2 Mbps | 4 h 26 min |
| 4 Mbps | 2 h 13 min |
| 6 Mbps | 1 h 28 min |
| 8 Mbps | 1 h 6 min |
Which bitrate your file needs depends on whether the sender re-encodes it, which section 3 measures.
3. Build the stream file (tested)
Viewers join at random points, and the one moment they should never notice is where the file ends and starts again. Three rules apply whatever tool you use:
- Crossfade between tracks, and make the last track fade into the first, not into silence.
- No logo sting or outro at the end. On a loop it plays every pass, forever.
- Match the loudness of every track, so no track change makes someone reach for the volume.
Any audio editor can do this. If you prefer the command line, these are the commands we ran with ffmpeg 7.0.2. They start from a folder norm/ of WAV files at one loudness, named in play order. Step 1 of our upload workflow makes that folder with ffmpeg's loudnorm filter; it is the same for a stream, so we do not repeat it here. For the test we made three tracks of generated tones and pink noise, 41.5, 36.5 and 31.5 seconds long, each ending in about 3 seconds of silence, as many exported tracks do.
Keep the audio as WAV until the very last step. Our playlist guide found gaps of 26 to 51 ms when MP3s were joined directly, and our seamless loop guide found the same kind of gap with AAC.
Step 1: cut the silence off the end of each track
A crossfade over 3 seconds of silence is a fade into nothing. This removes the silence at the end of each track (it reverses the track, trims the start, and reverses it back) and keeps the start untouched:
mkdir -p trim
for f in norm/*.wav; do
ffmpeg -hide_banner -loglevel error -i "$f" \
-af "areverse,silenceremove=start_periods=1:start_threshold=-50dB,areverse" \
"trim/$(basename "$f")"
done
Our three tracks came out at 38.45, 33.45 and 28.45 seconds: about 3.05 seconds of silence gone from each. ffmpeg's manual warns that areverse "requires memory to buffer the entire clip". For a single track that is fine: a 4-minute stereo track at 48 kHz is about 92 MB in memory, by our arithmetic (240 s x 48,000 samples x 2 channels x 4 bytes).
Step 2: crossfade the tracks, then wrap the end into the start
The first command crossfades every track into the next. The second is the "wrap": it takes the first 4 seconds of the mix off the front and crossfades them onto the end, so the last track fades into the first exactly as every other track change does. The result starts 4 seconds into the first track and ends at that same point, so when the file restarts, the first track simply continues.
D=4
files=(trim/*.wav)
args=(); for f in "${files[@]}"; do args+=(-i "$f"); done
g="[0:a]anull[m0]"
for ((i=1; i<${#files[@]}; i++)); do
g="$g;[m$((i-1))][$i:a]acrossfade=d=$D[m$i]"
done
ffmpeg -hide_banner -loglevel error "${args[@]}" -filter_complex "$g" -map "[m$((${#files[@]}-1))]" mix.wav
ffmpeg -hide_banner -loglevel error -ss $D -i mix.wav -t $D -i mix.wav \
-filter_complex "[0:a][1:a]acrossfade=d=$D" stream.wav
D=4is the crossfade length in seconds. ffmpeg's manual: "The cross fade is applied for specified duration near the end of first stream."- The loop chains the crossfades two tracks at a time. The current ffmpeg manual also shows a one-line version,
acrossfade=n=3, to "Concatenate multiple inputs with cross fade between each", but our ffmpeg 7.0.2 rejected it ("Option not found"). The chain works in both. - In the second command,
-ss $D -i mix.wavis the mix without its first 4 seconds and-t $D -i mix.wavis only those 4 seconds. - Each crossfade makes the file 4 seconds shorter. Our test: mix.wav was 92.347 seconds and stream.wav 88.347 seconds, exactly the three tracks minus two and then three crossfades.
Step 3: check the loop point
Play the file twice in a row and let ffmpeg's silencedetect filter look for gaps. It "logs a message when it detects that the input audio volume is less or equal to a noise tolerance value" for long enough:
ffmpeg -hide_banner -stream_loop 1 -i stream.wav -af silencedetect=n=-50dB:d=0.1 -f null - 2>&1 | grep silence_
If it prints nothing, there is no stretch of 0.1 seconds or more below -50 dB anywhere in two passes, including the loop point. For comparison we built the same test two other ways and measured the sound level in 100 ms steps:
- Tracks joined as they are: silencedetect found 3.0 seconds of silence at every track change and at the loop point.
- Crossfades between tracks, no wrap: no silence of 0.1 seconds, but the last track fades out and the first fades in, so the level drops to -45 dB at the loop point. It sounds like an ordinary track change with a pause, once per pass.
- Crossfades plus the wrap: the quietest 100 ms anywhere in two passes was -19.9 dB, against a typical -16.0 dB. Every track change, including the one at the loop point, is the same 4-second crossfade.
To look at the picture side of the join as well, our seamless loop guide has a frame-difference test.
Step 4: a "now playing" caption from your track list
A caption with the current track title answers the most common question in a music stream's chat, and it credits the artist on screen. Write the titles in a text file, one line per track, in the same order as the files:
printf '%s\n' "First Light" "Late Bus" "Window Seat" > titles.txt
This turns the track lengths and titles into a subtitle file. Each title changes in the middle of its crossfade, and the last entry is the first track again, for the wrapped part at the end:
D=4
for f in trim/*.wav; do
ffprobe -v error -show_entries format=duration -of csv=p=0 "$f"
done | paste - titles.txt | awk -F'\t' -v D=$D '
function ts(x) { ms = int(x * 1000 + 0.5)
return sprintf("%02d:%02d:%02d,%03d", ms/3600000, (ms/60000)%60, (ms/1000)%60, ms%1000) }
{ len[NR] = $1; name[NR] = $2 }
END {
t = 0; total = 0
for (k = 1; k <= NR; k++) total += len[k]
T = total - NR * D
for (k = 1; k <= NR; k++) {
start = (k == 1) ? 0 : t - k * D + D / 2
end = (k == NR) ? T - D / 2 : t + len[k] - (k + 1) * D + D / 2
printf "%d\n%s --> %s\nNow playing: %s\n\n", k, ts(start), ts(end), name[k]
t += len[k]
}
printf "%d\n%s --> %s\nNow playing: %s\n", NR + 1, ts(T - D / 2), ts(T), name[1]
}' > nowplaying.srt
On our test files, nowplaying.srt came out as:
1
00:00:00,000 --> 00:00:32,449
Now playing: First Light
2
00:00:32,449 --> 00:01:01,898
Now playing: Late Bus
3
00:01:01,898 --> 00:01:26,347
Now playing: Window Seat
4
00:01:26,347 --> 00:01:28,347
Now playing: First Light
Each change sits 2 seconds into a 4-second crossfade, which is where the next track becomes the louder one. Use the same D as in step 2, and put "Artist - Title" in titles.txt if you want the credit on screen.
Many guides use ffmpeg's drawtext filter for this. Our ffmpeg build did not have it: the manual says it needs ffmpeg built "--enable-libfreetype and --enable-libharfbuzz". The subtitles filter, which needs libass, was there, so we used that. Run ffmpeg -filters to see which of the two your build has.
Step 5: put the mix, the loop and the caption into one file
LEN=$(ffprobe -v error -show_entries format=duration -of csv=p=0 stream.wav)
ffmpeg -stream_loop -1 -i loop.mp4 -i stream.wav -map 0:v -map 1:a -t "$LEN" \
-vf "subtitles=nowplaying.srt:force_style='Fontname=DejaVu Sans,Fontsize=11,Alignment=1,MarginL=20,MarginV=16'" \
-c:v libx264 -preset veryfast -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -pix_fmt yuv420p \
-b:v 5M -minrate 5M -maxrate 5M -bufsize 10M -x264-params nal-hrd=cbr \
-c:a aac -b:a 128k -ar 44100 -ac 2 -movflags +faststart stream.mp4
-stream_loop -1repeats the short visual loop ("loop -1 means infinite loop", in the ffmpeg manual) and-t "$LEN"stops at the exact length of the mix. The hub guide found that-shortestovershot by a second; use-t.force_stylesets the caption's look:Alignment=1is bottom left, and the sizes are subtitle units that scale with the video height, so the same values work at 720p and 1080p.-g 60 -keyint_min 60 -sc_threshold 0at 30 fps gives a keyframe exactly every 2 seconds, YouTube's "Recommended 2 seconds". The bitrate options make the video constant bitrate (CBR) at 5 Mbps, YouTube's minimum for H.264 at 1080p30, and the audio is YouTube's 128 kbps stereo at 44.1 kHz.- You only need the CBR options if your sender copies the video as it is, like the ffmpeg command in section 6. If it re-encodes (OBS does, and so do hosted services that convert your upload), use
-crf 20in place of the five bitrate options and the file is often far smaller; see the table below.
We checked the result with ffprobe: H.264 High at 1920 by 1080 and 30 fps, a keyframe every 2.0 seconds, video at 5.0 Mbps, AAC at 128 kbps and 44.1 kHz, and the caption correct in frames taken at 10, 40, 70 and 87.5 seconds. The 88-second file encoded at 3.0 times real time on our server.
Step 6: keep the loop point clean after encoding
The WAV had no gap at the loop point. The MP4 did. When ffmpeg looped stream.mp4, whether it copied the stream into a live-style FLV file or decoded it, there were about 10 to 15 ms of near-silence at the loop point. That is AAC's padding, the same effect our seamless loop guide measured with a test tone. With the wrap, the loop point is in the middle of a track, so that is a short dropout in the music once per pass. A PCM WAV inside a MOV file and FLAC inside an MKV file both looped with no gap in the same test.
If you send the stream yourself with ffmpeg, keep the audio lossless in the file and let the sender encode it to AAC as it goes. This copies the picture from stream.mp4 and takes the sound from the WAV:
ffmpeg -i stream.mp4 -i stream.wav -map 0:v -map 1:a -c:v copy -c:a flac stream.mkv
The sender then copies the video and encodes only the audio, which costs little: section 6 has the command and what we measured. If your sender only accepts MP4, you have two options: accept a dropout of about a hundredth of a second once per pass (8 times a day with a 3-hour file), or skip the wrap so the loop point falls between a fade-out and a fade-in, where it cannot be heard.
| Test | Result |
|---|---|
| Tracks after step 1 | 38.45, 33.45 and 28.45 seconds, about 3.05 seconds of silence cut from each |
| stream.wav, step 2 | 88.347 seconds, exactly the tracks minus three 4-second crossfades |
| stream.wav played twice, step 3 | No silence; quietest 100 ms at -19.9 dB |
| Same tracks joined as they are | 3.0 seconds of silence at every track change and at the loop point |
| nowplaying.srt, step 4 | Changes at 32.449, 61.898 and 86.347 seconds; right title in every frame we checked |
| stream.mp4, step 5, grain scene | Video 5.0 Mbps CBR: 2.32 GB an hour; encoded at 3.0 times real time |
| Same, scene without grain | Video 4.99 Mbps: 2.31 GB an hour (CBR keeps the bitrate up even when the picture needs less) |
With -crf 20 instead of CBR, no grain | Video 41 kbps: about 80 MB an hour |
With -crf 20, grain scene | Video 21.9 Mbps: about 9.9 GB an hour |
| stream.mp4 looped by ffmpeg | About 10 to 15 ms of near-silence at the loop point |
| stream.mkv (FLAC) looped by ffmpeg | No gap at the loop point |
The grain result is the one to remember: a film-grain or noise layer is random in every frame, so the encoder cannot reuse anything between frames. Our grain layer alone took the CRF file from 41 kbps to 21.9 Mbps of video. If your scene has grain and your file is limited to 4 GB, make the grain finer or lighter before you export.
A sender that copies the file sends its bitrate around the clock, so the bitrate also sets how much data the stream uses:
| Video bitrate | Per hour | Per day | Per month |
|---|---|---|---|
| 4 Mbps (AV1 or H.265 minimum) | 1.86 GB | 44.6 GB | 1.34 TB |
| 5 Mbps (H.264 minimum) | 2.31 GB | 55.4 GB | 1.66 TB |
| 10 Mbps (AV1 or H.265 recommended) | 4.56 GB | 109.4 GB | 3.28 TB |
| 14 Mbps (H.264 recommended) | 6.36 GB | 152.6 GB | 4.58 TB |
Our 5 Mbps test file matched the table: 2.32 GB an hour measured, 2.31 GB by arithmetic. If you rent a server, check its monthly transfer allowance against the last column. A lossless audio track (step 6) makes the file bigger but not the stream, because the sender encodes it to 128 kbps AAC.
4. The visual
The picture is what makes a lofi channel recognisable, and it is also where rights mistakes happen.
- Use art you made or commissioned, with the right to use it in a monetized stream. Images found online are not free to use because they are easy to download.
- Studio Ghibli's 2020 permission covers its film stills, to be used "within the bounds of common sense" (our translation), not animated clips or a channel built on its films. Our lofi channel hub has the details.
- AI-generated visuals are allowed, and YouTube's monetization policy lists "using AI to [...] generate a unique background visual" among its allowed examples. Disclose realistic AI content, and AI music that is the main focus.
- Keep the motion gentle. Rain on a window, a moving cursor, a cat's tail: enough to show the stream is live, not so much that the eye tires. If you want real movement from a real place, a camera on a bird feeder or a fish tank is a different kind of 24/7 stream, covered in how to live stream a bird feeder or aquarium. For more formats that can run around the clock, with the rights each one needs, see our 24/7 live stream ideas.
- Make the visual loop seamless on its own: its last frame should lead into its first. Our seamless loop video guide has tested methods for animation and filmed footage, and our guide to ambient videos for YouTube has a tested ffmpeg crossfade.
- Leave room for the caption. If you add the "now playing" line from section 3, keep that corner of the art calm, so the text stays readable on a phone.
5. Set up the stream on YouTube
Before the first broadcast, verify the channel and turn on live streaming. YouTube: "To live stream, you need to have no live streaming restrictions in the past 90 days and you need to verify your channel." You must be at least 16 (YouTube Help, get started with live streaming). "Enabling a live stream for the first time may take up to 24 hours. Once enabled, your stream can go live instantly." (YouTube Help, create a live stream with an encoder).
Then create a custom stream key. A default key belongs to one stream; with a custom key you can stop and restart without re-entering anything. YouTube: "To reuse the same stream key, create a custom stream key." (YouTube Help, stream keys and settings).
YouTube's encoder recommendations for a 1080p lofi stream:
| Setting | YouTube's recommendation |
|---|---|
| Video codec | H.264, H.265 (HEVC) or AV1 |
| Bitrate, H.264 at 1080p30 | Minimum 5 Mbps, recommended 14 Mbps |
| Bitrate, AV1 or H.265 at 1080p30 | Minimum 4 Mbps, recommended 10 Mbps |
| Keyframe frequency | "Recommended 2 seconds", "Do not exceed 4 seconds" |
| Bitrate encoding | CBR |
| Audio | AAC or MP3; 128 Kbps stereo at 44.1 KHz |
| Protocol | RTMP or RTMPS; YouTube recommends RTMPS |
More settings matter for an unattended stream:
- Latency: Normal. YouTube calls it "the highest quality setting for viewers since it has the lowest amount of viewer buffering", and nobody is there to chat with (YouTube Help, live streaming latency).
- Auto-start and auto-stop. YouTube: "When these settings are on, you can start or stop streaming from your encoder." With them on, a sender that restarts also starts the broadcast again without anyone opening YouTube Studio (YouTube Help, manage live stream settings).
- Mid-roll ads: automatic, if the channel is monetized. Manual breaks need someone to press the button; see do lofi channels make money.
- The 12-hour line. "All streams under 12 hours will be automatically archived" (YouTube Help 2907883), and "If your stream exceeds 12 hours, it may not be captured at all" (YouTube Help, archive live streams). The archive also matters for claims: "Content ID claims are only made after you complete your live streams, if you decide to archive the video." Decide between one endless stream and planned restarts; our guide to live stream time limits weighs both.
- Chat. A stream that runs for months collects spam at hours when nobody is watching. Our guide to moderating YouTube live chat on a 24/7 stream covers the settings that work unattended.
6. Keep it running: three ways
The file is ready; now something has to play it to YouTube around the clock.
| Compared | Hosted: Loopcast (our pick) | Your own PC with OBS | A rented server (VPS) with ffmpeg |
|---|---|---|---|
| How the loop is set | Upload the file once | Media Source with Loop ticked (it is off by default) | -stream_loop -1 with -re to read at the file's frame rate |
| What has to stay on | Nothing on your side | Your computer and home connection | A server you set up and maintain |
| Restart after a drop | Automatic | You, or a script you write | A script you write |
| Output | 1080p at 30 fps, H.264 at a constant 6,000 kbps, keyframe every 2 s, 128 kbps AAC stereo | Whatever you set | Whatever you set |
| Cost | $0.72 per 24 hours, prepaid | Electricity and wear | Monthly server rent with enough transfer (section 3), plus your time |
| Platforms | YouTube, Kick and Steam only | Any | Any |
OBS documents its loop option as: "Specifies whether the file play again once playback has completed", default Off (OBS Knowledge Base, Media Source). In ffmpeg, -re means "Read input at native frame rate", which is what you want when sending a file as if it were live (ffmpeg documentation). Our guide to looping a video in OBS walks through the OBS route step by step, including the reconnect setting.
For the server route, try the sender on a file before you point it at YouTube. This plays stream.mkv from step 6 on repeat in real time for 2 minutes, which crosses the loop point once, copies the video and encodes the audio to YouTube's AAC settings:
ffmpeg -re -stream_loop -1 -i stream.mkv -t 120 -c:v copy -c:a aac -b:a 128k -ar 44100 -f flv test.flv
It took 120.8 seconds and used about 2% of one CPU core on our server, because only the sound is encoded. Then check the result for gaps:
ffmpeg -hide_banner -i test.flv -af silencedetect=n=-50dB:d=0.002 -f null - 2>&1 | grep silence_
Ours printed one silence of 6 ms at 0 seconds, the start of the AAC stream, and nothing at the loop point at 88.3 seconds. Keyframes stayed 2 seconds apart, with one shorter interval of 0.35 seconds where the file restarts, inside YouTube's 4-second limit. To go live, remove -t 120 and replace test.flv with the stream URL and key from YouTube Studio, in quotes.
Loopcast's own guides on choosing a source video and on whether looping is allowed on YouTube are worth reading whichever setup you choose.
Before you go live
- Every track is on your list with its source and license, and the description credits them.
- Your music source has added your channel to its Content ID allowlist, if it uses one.
- You ran the silencedetect check on two passes of the file (or listened to the join on headphones), and found no gap.
- The "now playing" caption shows the right title at each track change.
- The title and description say it is a 24/7 stream. Do not imply someone is there answering chat if nobody is.
- Live streaming is enabled and the encoder or service uses a custom stream key.
- Latency is Normal; mid-rolls are automatic if the channel is monetized.
- You know your plan for the 12-hour archive limit: one endless stream, or planned restarts.
FAQ
How long should a 24/7 lofi mix be?
As long as your file size allows. A 1-hour mix plays 24 times a day, a 4-hour mix 6 times. If your sender caps uploads at 4 GB, a file at 2 Mbps can run about 4 hours 26 minutes.
What bitrate should a 24/7 lofi stream use?
YouTube recommends 14 Mbps for H.264 at 1080p and 30 fps, with a minimum of 5 Mbps, or 4 to 10 Mbps for AV1 and H.265. Use CBR and a keyframe every 2 seconds. At 5 Mbps the stream sends about 2.31 GB an hour, or 55.4 GB a day, by our arithmetic.
How do I make the loop point seamless?
Crossfade every track into the next, then crossfade the end of the mix into its first few seconds (the wrap in section 3), so the file ends where it starts. Keep the audio as WAV until the end. In our test, AAC in an MP4 added 10 to 15 ms of near-silence at the loop point; FLAC in an MKV added none.
How do I show the song title on a 24/7 lofi stream?
Burn a caption into the video file. Our script in section 3 turns your track lengths and a list of titles into a subtitle file, and ffmpeg's subtitles filter draws it on the picture, changing in the middle of each crossfade.
Can I make a 24/7 lofi stream for free?
Yes, if you own the music and art and stream from your own PC with OBS: the cost is electricity and your connection. The music is the usual problem; free tracks rarely come with a license for 24/7 streaming, and some free catalogues, Chillhop's among them, rule it out by name.
Do I need to keep my computer on?
Only if you stream from it. A rented server or a hosted service such as Loopcast sends the stream instead, so your computer can be off.
Sources
- YouTube Help: live encoder settings, bitrates and resolutions, create a live stream with an encoder, stream keys and settings, live streaming latency, get started with live streaming, archive live streams and copyright issues with live streams.
- YouTube Help: channel monetization policies.
- Chillhop: use our music.
- ffmpeg documentation and ffmpeg filters (acrossfade, areverse, silenceremove, silencedetect, subtitles, drawtext). Commands tested with ffmpeg 7.0.2.
- OBS Knowledge Base: Media Source.
- Loopcast for YouTube, Loopcast pricing and Loopcast's YouTube encoder settings.