A 24/7 classroom stream can play a sequence of recorded lessons through YouTube Live using FFmpeg’s concat demuxer and its input-repeat option. Before you prepare the playlist, check that your channel can livestream and allow for first-time activation, which YouTube says may take up to 24 hours.
This approach gives you control over the order of the material and can keep the sequence repeating, but it does not guarantee uninterrupted playback. Your files, encoding process, computer, network and YouTube ingest all matter; test the setup and decide how you will respond if any part stops.
Check eligibility before preparing the stream
YouTube’s requirements should shape your schedule before they shape your command line. Its live-streaming overview says that a channel must be verified and must not have had a live-stream restriction during the preceding 90 days. It also says that enabling live streaming for the first time may take up to 24 hours. Check your own channel in YouTube Studio rather than assuming that an older upload or an existing scheduled stream proves live access is ready.
If this is the channel’s first live broadcast, start activation well before the planned classroom session. A delay at this stage cannot be fixed by changing an FFmpeg flag. If the channel has streamed before, still check its current status and confirm that the stream can be created and previewed before sharing a public viewing link.
Think separately about who should be able to watch. A public stream is discoverable and may appear on the channel; an unlisted stream is generally reached by people with its link; a private stream restricts access to selected accounts. These settings serve different purposes, and an unlisted URL can still be forwarded. Choose according to the material and your school’s or organisation’s sharing rules, and check YouTube’s current access controls before a real lesson.
A 24/7 feed also has an archive consideration. YouTube’s encoder guidance says that streams under 12 hours are automatically archived. Do not assume that one continuous day-long broadcast will produce one complete recording; confirm current Studio behaviour for your channel and plan a separate recording or archive workflow if the lesson archive matters.
Create an encoder stream in YouTube Studio
Once eligibility is clear, open YouTube Studio and create a live stream that uses streaming software or an encoder. YouTube’s encoder setup instructions describe creating the stream in Live Control Room and obtaining the connection details. Labels and layout can change, so use the current Studio interface and its prompts rather than relying on an old screenshot.
Keep the stream’s title, description, audience designation and visibility appropriate to the classroom. If students will be present, consider whether the stream should be public at all and follow the organisation’s safeguarding and privacy procedures. A test can use private or unlisted visibility, but test access is not a substitute for checking who is authorised to view the eventual lesson.
Before leaving Studio, identify the stream URL or ingest server and the stream key. They are separate pieces of connection information: the URL identifies where to send the feed, and the key associates that feed with the stream. Treat the key as a credential, not as a classroom setting. The protection steps later in this guide are part of the setup, not an optional clean-up after you have pasted it into a document.
You can create the stream ahead of the broadcast so that you have time to test. Make sure you know which scheduled stream the key belongs to; sending a feed to the wrong event can make the intended preview appear empty even if FFmpeg is running. Keep a written run sheet that names the stream and its visibility, but leave the actual key out of that sheet.
Prepare a compatible concat playlist
FFmpeg’s concat demuxer reads a text playlist and presents its files as a sequential input. For a small classroom loop, create a plain text file named classroom.ffconcat in a folder containing the lesson videos. Its first line must be exactly ffconcat version 1.0; list one video per file directive, for example:
ffconcat version 1.0
file 'lesson-01.mp4'
file 'lesson-02.mp4'
file 'break-screen.mp4'
Use the lesson order you actually want students to see. Relative filenames keep the playlist easier to move between folders or machines, and avoid path characters that would need special handling. The concat demuxer’s safe option defaults to 1, which rejects unsafe paths; the example command preserves that safer default. If you truly need absolute or otherwise unsafe paths, FFmpeg allows a different setting, but use it only with a playlist you control and understand.
The key compatibility requirement is not simply that every file ends in .mp4. FFmpeg expects the concatenated files to have the same streams, codecs and time bases. A lesson with one audio stream and a lesson with a different layout may not join cleanly. Similar formats and consistent export settings make the sequence easier to inspect and maintain. If the sources differ, normalise or transcode them to a common format before relying on them as one virtual sequence.
Timestamps and duration estimates can affect the joins. The demuxer adjusts timestamps so each listed file follows the previous one, but a wrong or estimated duration can lead to a gap or an artefact at the transition. FFmpeg documents a duration directive that can override a file’s duration when you know it accurately. Do not add guessed values just to make the playlist look complete; first inspect the file and test the joins. The concat demuxer documentation explains the format and its constraints.
Test a short representative sequence locally before building a long rotation. Watch and listen through each join, including a transition between a lesson and a break screen. Check for silent audio, unexpected black frames, clipped speech or a change in aspect ratio. A playlist that parses successfully is not proof that its classroom presentation is suitable.
Set FFmpeg to repeat the input
The option that repeats the playlist is -stream_loop -1. In FFmpeg, it is an input option: place it before the input it applies to. With the concat demuxer, a starting command can look like this:
ffmpeg -re -stream_loop -1 -f concat -safe 1 -i classroom.ffconcat \
-c:v libx264 -preset veryfast -pix_fmt yuv420p \
-r 30 -g 60 -keyint_min 60 -b:v 4000k -maxrate 4000k -bufsize 8000k \
-c:a aac -b:a 128k -ar 44100 \
-f flv 'rtmps://INGEST_SERVER/STREAM_KEY'
This is a template, not a command tested against your files or every FFmpeg build. Replace the final placeholder with the actual ingest URL and key from Live Control Room, without publishing them. The template encodes H.264 video and AAC audio, asks for 720p at 30 frames per second, uses a two-second GOP/keyframe interval and specifies a 4 Mbps video bitrate. Those values illustrate a command shape; they are not universal classroom recommendations.
YouTube’s live encoder settings guidance supports H.264, H.265 or AV1 video and AAC or MP3 audio for RTMP/RTMPS, permits up to 60 fps, and recommends a two-second keyframe interval that should not exceed four seconds. It lists 8 Mbps as the current recommended H.264 bitrate for 720p at 30 fps and 4 Mbps as the minimum. Choose settings for your actual resolution and a stable upload capacity rather than copying the illustrative bitrate. YouTube transcodes incoming live video for different playback formats, but that does not remove the need for a stable, correctly encoded input.
The -re option reads file input at its native rate rather than sending it as fast as possible. The video and audio codec options define the outgoing formats; the FLV muxer is used for the RTMP-family output. RTMPS encrypts transport and is recommended by YouTube. Match the options to the media and the current platform guidance, then check the FFmpeg output for errors instead of treating a running process as proof that viewers receive a healthy stream.
The loop repeats the input sequence; it does not inspect whether the teaching order remains useful, create a fresh archive, or restart FFmpeg after every possible failure. If the source layout is incompatible or timing behaves poorly, revise the media before trying to solve it with more command-line options. For other loop approaches and their failure modes, see this guide to checking loop settings when a playlist reaches its end.
Connect to the ingest URL and key
Copy the ingest server or stream URL and the key shown for the chosen event in YouTube Studio. Replace the placeholder destination in the command with the provided connection details. The example keeps them together in one quoted destination, but the exact string you receive from Studio is authoritative; do not invent a server path or reuse details from a different stream.
Start FFmpeg while the stream is still private or unlisted. Read the terminal output for connection or encoding errors, then look at Live Control Room to confirm that a signal arrives. If no preview appears, check that the command is using the correct event, that the full destination was copied and that the local upload connection is active. Avoid posting the key into a public support forum when asking for help; redact it from screenshots and logs.
Upload capacity is an ongoing constraint. The encoder sends a steady output, so leave headroom for ordinary network variation and other activity on the same connection. A speed test at one moment does not establish that an internet connection will remain stable overnight. If this is a home or school connection, test under the conditions in which the stream will actually run and check whether other users’ video calls or downloads compete for capacity.
For an always-on classroom channel, the machine must remain awake and the FFmpeg process must keep running. Decide who will notice a failure, how they will check whether it is the computer, connection or stream event, and what recovery action is appropriate. YouTube recommends monitoring stream health and reviewing messages during the event. A process supervisor or a documented manual restart can help with a process failure, but neither guarantees that the ingest or network will recover automatically. If you want to compare a computer-based process with a managed operating arrangement, consider the practical differences in monthly cloud streaming plans for a 24/7 channel.
Protect the stream key
A stream key is effectively a password for sending a broadcast to a specific stream. Anyone who obtains it may be able to send content in your place. Do not put it in the playlist, a lesson file, a shared classroom handout, a public code repository, a screenshot or a message thread that includes people who do not operate the stream.
The command above shows a placeholder, not a real key. When you run it, take care with shell history, terminal captures, saved scripts and logs. A script with the key embedded in plain text is convenient, but anyone with access to that file can read it. Restrict access to the machine and files, and use an appropriate secret-handling method for your operating system if more than one person administers the stream. Keep the key out of teaching materials and student-facing notes.
If you think the key has been exposed, use YouTube Studio’s current controls to reset or replace it, then update the legitimate encoder with the new value. Check the preview after changing it. Rotating a key can interrupt the existing connection, so plan the change rather than doing it during a lesson unless the exposure makes immediate action necessary.
If you need to send a diagnostic report, remove credentials first. The same caution applies when recording the setup process for another teacher: demonstrate the field with a placeholder, not the active key. For classroom responsibility, designate who can access the credential and who is permitted to start or stop the stream.
Test privately or unlisted and inspect preview
Run a test with the visibility and access controls you intend to use, while avoiding a public launch until the feed has been inspected. Private is suitable when the test should be limited to selected accounts; unlisted can be convenient for a small group with the link, but that link can be passed on. Confirm the current Studio behaviour and choose the least open setting that still lets the right people test.
Check the preview in Live Control Room for image, sound and stream health. YouTube’s stream health and troubleshooting guidance is a useful reference when Studio reports a problem. Confirm that speech is audible at a sensible level, slides are readable on a small screen, video is not cropped, and the stream’s title and audience settings are right. A classroom stream can be technically connected yet still be difficult to follow because a microphone is too quiet or a slide remains on screen after the audio moves on.
Inspect the playlist’s joins as well as its beginning. Let it play through a lesson boundary and, if practical, through the point where the last file returns to the first. The repeat option gives FFmpeg another pass through the input sequence; previewing the loop boundary helps reveal a jarring transition or unexpected silence. Make any edits to the media and test again before the public schedule.
Then rehearse recovery. Know how you will detect a stopped FFmpeg process, a lost connection or a stream-health warning, and who can respond at the time the channel is meant to run. YouTube does not promise uninterrupted playback for this setup, and concat itself cannot provide that guarantee. A recovery plan after a power cut is useful even if your likely interruption is a router or computer restart instead.
When the test passes, stop or transition according to the schedule you have arranged in Studio, verify the intended public event and begin the broadcast. Keep monitoring available rather than assuming that a good preview makes later checks unnecessary. For a classroom built from recorded tutorials, this homework-help stream setup guide covers adjacent planning considerations.
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 make the stream uninterrupted?
No. It tells FFmpeg to repeat its input indefinitely while the process is running, but it cannot prevent a computer, network, source file or YouTube ingest problem. Test the setup and plan who will monitor it and how failures will be handled.
Can I use files with different formats in one concat playlist?
The concat demuxer expects the files to have matching streams, codecs and time bases. If your lessons differ, normalise or transcode them to a consistent format and inspect the joins before streaming. A matching file extension alone is not enough to establish compatibility.
Should the classroom test be private or unlisted?
Use private when access should be limited to selected accounts; unlisted is more convenient for a small group, but anyone with the link may share it. Check YouTube’s current visibility and access controls and follow your organisation’s classroom privacy procedures.
Will a 24/7 broadcast create one complete YouTube archive?
Do not assume that it will. YouTube says streams under 12 hours are automatically archived, so plan for archive handling separately and verify current behaviour in Studio for your channel.