A 24/7 lofi stream is three things: a looping video scene, a playlist of music you have the rights to, and ffmpeg sending both to YouTube's live ingest server without stopping. You can run it from any computer that never sleeps, or from a cheap server. Below is a working command, the settings YouTube expects, and what we learned keeping our own streams on air, first from a Mac and now from a Windows PC.
What you need
- A scene loop: a 1920 × 1080 video, 30 frames a second, that loops seamlessly. 10 seconds to a few minutes is plenty.
- Music you're allowed to stream, ideally all levelled to the same loudness so no track jumps out. We level ours to −14 LUFS with ffmpeg's
loudnormfilter. - ffmpeg, the free command-line video tool.
- A YouTube stream key from YouTube Studio: Create, Go live, Stream.
- Upload bandwidth: around 6 Mbps, continuously.
The simplest working command
Put your tracks in a text file called playlist.txt, one line each:
file 'tracks/01-first-track.mp3'
file 'tracks/02-second-track.mp3'
Then:
ffmpeg -re -stream_loop -1 -i loop.mp4 \
-re -stream_loop -1 -f concat -safe 0 -i playlist.txt \
-map 0:v -map 1:a \
-c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k \
-pix_fmt yuv420p -g 60 -r 30 \
-c:a aac -b:a 192k -ar 44100 \
-f flv "rtmp://a.rtmp.youtube.com/live2/YOUR-STREAM-KEY"
What the parts do:
-stream_loop -1loops the scene and the playlist forever.-resends both at real-time speed, which a livestream needs.-b:v 4500kis a comfortable bitrate for 1080p lofi visuals that barely move.-g 60puts a keyframe every 2 seconds at 30 fps, which YouTube expects.-c:a aac -b:a 192kis good-quality stereo audio.
Keep your stream key out of scripts you share and out of logs. Ours is stored in a private settings file and stripped from the log automatically.
How ours is built
We started with one radio running from a Mac. Since October 2026 we run four owl streams instead (study, late-night coding, rainy café and sleep), from a Windows PC.
Then: one radio from a Mac. It added a few things on top of that command:
- A separate "feeder" program plays the tracks in a weighted order, so popular ones come round more often, and sends the audio to ffmpeg through a pipe.
- A "now playing" card drawn on top of the video, re-rendered on every track change.
- A watchdog script that restarts ffmpeg whenever it exits, waits for the network if the connection is down, and reconnects the moment it's back.
- Apple's hardware encoder on the Mac instead of
libx264, which keeps the computer cool. - The website showed what was playing. The feeder told the site on every track change.
Now: four streams from a Windows PC.
- Each stream is one long, ready-made video: the room's owl loop with every song of that room once, and a music bar with the song's name, rendered once on the PC's NVIDIA graphics card.
- ffmpeg sends each file on repeat with
-c copy, which re-encodes nothing, so four streams at once barely use the processor. - They start by themselves when the PC boots, so a restart or a power cut doesn't need anyone at the keyboard.
- The website shows what's playing. The PC tells the site which song is on, so each room page and the radio page show it next to the stream.
Lessons from keeping it on air
- Computers want to sleep. In the first three days our Mac slept 113 times, mostly from the lid being closed, and most of our reconnects came from that. On a Mac,
sudo pmset -a disablesleep 1fixes it; laptop lids and energy settings matter more than anything in ffmpeg. - Use a cable. Our drops happened on Wi-Fi.
- Turn off automatic updates on the streaming machine; an overnight restart kills the stream.
- Plain RTMP can be more reliable than RTMPS on some ffmpeg builds. Ours failed with a secure-connection error on macOS and has run fine on plain RTMP.
- Check which channel your key belongs to. For almost two weeks, our stream went to a different YouTube channel than the one we thought, because the key had been copied from the wrong account. Look for the stream in Studio on the right channel after you go live.
- In YouTube Studio, choose Normal latency rather than Low, and turn on DVR so people can rewind.
Before you start: the music
A 24/7 stream plays a lot of music, so rights matter even more than for a single video. Use your own, licensed music, or music whose owner allows streams; our catalog is free to stream with a credit line. The same rules apply on Twitch: lofi for Twitch. And if you're deciding whether a stream is even the right format for a new channel, read how to start a lofi YouTube channel first.
Written by Suman Kumar with AI help and checked before publishing. Numbers about our own music come from our Spotify for Artists and DistroKid exports; other sources are linked in the post.
