Skip to content
streamneo.
Use Cases13 min read

How to Run a 24/7 Bhajan Stream with FFmpeg Concat Files

Build and test an FFmpeg concat playlist for a bhajan stream, then plan for YouTube ingest, audio transitions, rights and recovery.

sn.
StreamNeoPublished 5 October 2026
Worth sharing?

To run a 24/7 bhajan stream with FFmpeg concat files, create a playlist of compatible tracks, feed it to FFmpeg in real time, and send the encoded output to YouTube Live. The playlist can repeat, but it cannot guarantee that your computer, network, FFmpeg process or YouTube event will stay live continuously.

The concat demuxer is most straightforward when every file has matching audio streams and timing characteristics. You will also need a visual if your YouTube setup expects video, a tested ingest configuration, and a plan for rights, monitoring and recovery.

Prepare compatible audio files and a concat list

The concat demuxer reads a text manifest and opens each listed file in sequence. It does not make unlike audio sources identical: FFmpeg expects the files to expose matching streams, including compatible codecs and time bases. Start by collecting the tracks you have permission to broadcast, then check whether they share a format, sample rate, channel layout and codec.

A simple manifest called bhajans.ffconcat could look like this:

ffconcat version 1.0
file '/srv/media/bhajan-01.mp3'
file '/srv/media/bhajan-02.mp3'
file '/srv/media/bhajan-03.mp3'

The first line identifies the concat script format. Keep the file directives in the order you want listeners to hear the tracks. Use explicit paths rather than relying on whichever directory happens to be current when the job starts. That makes it easier to run the same command from a terminal, a scheduled job or a service manager.

If your tracks are already compatible, stream-copying their audio may reduce processing compared with re-encoding. But compatibility with one another is not enough: the output must also be accepted by the destination. A mixed folder of MP3, WAV and AAC files may not work reliably as a single stream-copy playlist, even if each track plays normally by itself.

When sources differ, normalise them before building the final playlist or use a filter-based workflow that decodes and re-encodes the sequence. Normalising in advance gives you a chance to listen to transitions and confirm each output file before an overnight run. Choose a common codec, sample rate and channel layout that suit your source material and YouTube output; there is no single preset that is right for every archive.

FFmpeg's concat demuxer documentation describes the matching-stream requirement and how the listed files are placed in sequence. Its concat FAQ also explains the filter approach when sources need re-encoding. For a wider setup checklist, see the FFmpeg settings for 24/7 YouTube streaming.

Check file paths and list syntax

The manifest is a script, so a small syntax error can stop the whole input from opening. Save it as plain text in a compatible encoding, keep the ffconcat version 1.0 line at the very beginning, and put one file directive on each subsequent line. Do not add a heading, bullet markers or explanatory text unless it uses valid concat syntax.

Paths with spaces or special characters need correct quoting and escaping. A path such as /srv/media/Morning Bhajan.mp3 should be enclosed in quotes in the directive. If the file itself has an apostrophe or unusual characters, check FFmpeg's escaping rules rather than guessing. A useful first check is to create a tiny manifest with two tracks and verify that FFmpeg can read it before preparing a long rotation.

Relative paths are interpreted in relation to the process working directory, which may differ when FFmpeg is launched automatically. Absolute paths reduce that uncertainty. If you must use relative paths, document the expected working directory and ensure the scheduled job starts there. Also check filename capitalisation and mounted-drive availability; a track that is present on your desktop may not be visible to a process running under another account.

The concat demuxer has safe-path checks. Do not switch them off indiscriminately just to make a manifest work, particularly if the manifest or paths come from an untrusted source. Prefer a clean manifest containing only the files you intend to play, stored somewhere the streaming account can read. Keep the manifest separate from public repositories and logs if it contains private path information.

When a list fails, test its first entries with FFmpeg before adding the whole library. This catches malformed quotes, misspelled paths and files that cannot be decoded. A successful open is not proof that the hand-off sounds right, but it separates list problems from output or YouTube problems.

Build and test the FFmpeg command

For a compatible list going to an RTMP-family destination, this is an illustrative starting point:

ffmpeg -hide_banner -re -stream_loop -1 -f concat -i bhajans.ffconcat \
  -c:a aac -b:a 128k -ar 44100 -ac 2 \
  -c:v libx264 -tune stillimage -vf "color=c=black:s=1280x720:r=30" \
  -shortest -f flv "rtmps://INGEST_URL/STREAM_KEY"

The placeholders are not literal values: replace the destination with the exact server address and stream key supplied in YouTube Live Control Room. Treat the key as a password. Do not put a real key in a public script, repository or support screenshot.

-re paces the input at approximately its normal playback rate rather than reading the playlist as fast as possible. -stream_loop -1 requests repeated playback of the concat input. The audio options encode the result as AAC with a specified bitrate, sample rate and stereo channel layout. The video options illustrate a generated static background, because a live video destination may require a video stream even when your programme is audio.

This command is a starting pattern, not a universal tested recipe. In particular, the generated colour source and -shortest need careful validation: depending on the FFmpeg build and how inputs are arranged, the shortest input can end the output rather than leave the visual running while audio loops. For a more controlled static visual, use a looping image or video input and design the filter graph so its duration and the audio loop are handled deliberately. Confirm the behaviour with your installed FFmpeg version and a private or unlisted test event before using it for a public broadcast.

If stream-copying, replace the audio re-encoding options only after confirming that every source and the destination support the same audio stream. If the tracks differ, normalise them or re-encode the concatenated output instead of assuming FFmpeg will smooth the differences automatically. Re-encoding costs processing capacity, so test the host under the intended load.

Make a short test with several different tracks, not just one. Listen across each transition, inspect FFmpeg's output for timestamp or decoding warnings, and verify that the destination receives the expected audio and visual. Check the end of the playlist as well as the start so you know the loop returns to the first track as expected. For guidance on keeping playback between playlist items, the article on keeping a YouTube Live stream active between playlist videos covers a related operational problem.

Send the audio stream to YouTube Live

In YouTube Live Control Room, create or select the live event and obtain its current ingest URL and stream key. The encoder settings page is the authority for your account's current choices. YouTube recommends RTMPS for secure transport; use the address it supplies rather than assuming a fixed endpoint.

YouTube's encoder settings guidance lists accepted audio formats for RTMP/RTMPS, recommends constant bitrate, and specifies a recommended two-second keyframe interval for video. Its advanced guidance includes stereo AAC at 44.1 kHz and 128 kbps. Those are platform recommendations, not a reason to use a video resolution or bitrate your upload connection cannot sustain. Select settings compatible with both the chosen event and the connection available to the encoder.

If the channel is audio-led, decide what the viewer will see. A still image with the channel name, a restrained visual loop, or a simple title card can provide the video component without making a visual programme out of the stream. Check that you have rights to any artwork, and ensure text is legible on a phone. Audio-only ingest behaviour depends on the destination's current settings, so do not assume that every live configuration accepts audio without video.

YouTube's encoder setup instructions explain how to enter the server URL and stream key. The same guidance says streams under 12 hours are automatically archived. That does not establish that a single event lasting 24 hours or longer will be archived in full, or that a full-day broadcast is supported indefinitely. If the recording matters, plan a separate local recording where practical and check YouTube's current guidance rather than relying on the live event archive.

Before going public, test the actual playlist, audio encoding, visual, key and network path together. YouTube recommends leaving bandwidth headroom; its streaming tips advise that upload capacity should exceed the total streaming bitrate, with 20% headroom recommended. A connection that barely carries the selected bitrate may fail when other devices upload or the connection fluctuates. If your location has limited upstream capacity, the low-bandwidth bitrate guide can help you think through conservative settings.

Troubleshoot gaps, timestamps and audio changes

A gap or click at a transition can come from the media, not just the network. Tracks may end with silence, start with a clipped waveform, or have different loudness. Listen to the join between each pair in a test playlist. If the source recordings themselves have a gap or abrupt ending, changing the concat syntax will not repair the music; edit or prepare those files before using them live.

Timestamp problems are a common cause of concat artifacts. The demuxer uses durations to place later files, and an incorrect duration can make the next track start at the wrong point. Variable or unusual media timing, container metadata, or files with different stream properties can make a sequence less predictable. Re-encoding to a common set of properties is often easier to validate than trying to stream-copy a collection assembled from unrelated sources.

A sudden change in loudness is not necessarily an encoding fault. Older devotional recordings, live recordings and studio tracks can differ substantially in level and tone. Normalise or edit the sources in advance, then listen on speakers and headphones. Avoid applying aggressive processing blindly to a whole archive; a setting that helps a quiet recording can distort a louder one.

If the output stops after a track or fails near the loop point, reduce the playlist to the two files around that transition and reproduce the issue. Check FFmpeg's messages for decode errors and compare the files' streams with a probe tool. If a pair does not match, normalise those sources or use the concat filter to decode and re-encode them in a common format. This is more diagnostic than repeatedly changing YouTube settings when the input itself is the cause.

If the audio is clean locally but YouTube reports a health issue, examine the outgoing bitrate, network stability and event configuration. YouTube's health messages and FFmpeg's logs answer different questions: one reports what the platform receives, while the other reports what the encoder is doing. Keep the timestamps of any failures so you can correlate the two. For network-related recovery approaches, see how to restart an FFmpeg YouTube stream after a network outage.

Plan monitoring and recovery for continuous playback

An indefinitely repeating input is not an indefinitely reliable broadcast. -stream_loop -1 can keep asking FFmpeg to replay a list while the process remains healthy, but it cannot restore power, repair a disconnected router, renew invalid credentials or undo a YouTube-side event termination. Treat “24/7” as an operational goal that requires monitoring and recovery, not a property of a command line.

Decide what someone will check, and how they will know when the stream is no longer reaching viewers. Monitor the FFmpeg process and its output, host CPU and memory, available disk space, network connectivity and YouTube's live health indicator. If the channel has an audience that depends on the stream overnight, arrange an alert that reaches a person who can respond. A log file no one reads is not a monitoring plan.

A process supervisor or scheduled restart policy can help recover from an FFmpeg crash, but test the restart behaviour deliberately. Confirm that a restart does not leave two encoders publishing to the same event, and that the process can retrieve the manifest and credentials after a host reboot. Protect any stored stream key, and document how to rotate it if it is exposed. A remote restart can help with a software failure; it cannot solve a physical power or network failure at the host.

FFmpeg's documentation includes an RTMP FIFO output pattern that can attempt recovery after temporary output errors. That can help with some transient delivery failures, but it is not a substitute for checking the current documentation and testing the options with your output. Recovery at the output stage does not address a dead computer, a full disk, a broken source file or a platform-side interruption.

If running your own computer is the part most likely to fail overnight, a managed approach can remove the need to leave that computer on and to restart its local process after every interruption. StreamNeo can help with that specific burden when your prepared file and YouTube channel are ready; it does not remove the need to check your content rights, event health or recording requirements. If you prefer to retain control of the encoder, a second-encoder plan may be more appropriate, as discussed in backing up a 24/7 YouTube devotional stream.

Check music rights and recording limitations

A bhajan's devotional subject does not by itself establish that you can broadcast a particular recording. Consider the composition and the specific performance or recording separately. A traditional melody may be paired with a modern arrangement, a commercial recording or a recording made by another devotee; being able to find it online does not grant permission to rebroadcast it.

Keep a record of where each track came from and what permission or licence covers your intended use. Check whether that permission includes continuous livestreaming, use on YouTube, any accompanying image, and the possibility that the platform may retain or process a recording. If the terms are unclear, seek permission from the relevant rights holder or use material whose licence clearly covers the planned broadcast. Do not treat a claim-free test as proof that you hold the necessary rights.

Recording is a separate operational question. YouTube says streams under 12 hours are automatically archived, but that is not a promise that a 24/7 event will be fully preserved. Decide whether you need your own recording, how much local storage it requires, who can access it and how long you will keep it. A full-day recording can consume substantial space; test the recording process and storage policy before relying on it.

A local recording can also add load and create another failure mode. Check that the chosen format, available disk space and rotation or deletion policy are suitable, and verify that a finished file can actually be played. If preserving every song is not necessary, retaining selected programme segments may be more manageable, provided that approach matches your rights and audience needs.

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

Can FFmpeg loop an audio playlist indefinitely?

Yes. The concat demuxer can read a list in order, and -stream_loop -1 requests repeated playback. This keeps the input cycling only while the process, host, network and destination remain functional; it is not a guarantee of uninterrupted service.

Why does FFmpeg concat fail between files?

The files may expose different streams, codecs or time bases, or the manifest may contain a path or quoting error. Incorrect duration information can also produce timestamp artifacts. Test the smallest failing pair, inspect the input properties, and normalise or re-encode incompatible sources.

Do I need to leave a computer on for this setup?

With a local FFmpeg workflow, the computer running the encoder needs to remain available, along with a working network connection and power. A restart policy may help after a process failure, but it cannot fix every outage. If leaving a computer on is the problem, compare a managed workflow with an encoder you operate yourself.

Will YouTube archive the whole 24/7 stream?

Do not assume so. YouTube's encoder setup guidance says streams under 12 hours are automatically archived, which does not promise a complete archive of a longer continuous event. Check the current official guidance and make a separate recording plan if preservation matters.

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 Use Cases guides ↗ · All topics ↗