To run a playlist from Ubuntu to a YouTube live channel, install FFmpeg from Ubuntu’s package repositories, list your media files with its concat demuxer, and send the looped output to the RTMPS address shown in YouTube Live Control Room. The command can keep reading the playlist, but it does not by itself make the broadcast resilient or ensure that YouTube retains a full-day replay.
This guide covers a package-based setup and the decisions that matter before leaving it on: compatible media, encoding settings, private stream keys, monitoring, and YouTube’s archive-duration guidance. You will need an Ubuntu machine that can stay online and upload steadily for as long as you intend to broadcast.
Install FFmpeg from Ubuntu packages
Ubuntu’s package manager is the straightforward route for a normal desktop or server installation. Open a terminal and run:
sudo apt update
sudo apt install ffmpeg
The first command refreshes the package information for your enabled repositories; the second installs FFmpeg and its packaged dependencies. The version available depends on your Ubuntu release and configured repositories, so do not assume a command from a different release will install the same build.
Verify the installation with:
ffmpeg -version
This confirms that the executable is available and prints build information. If the shell reports that ffmpeg cannot be found, check that the install completed and that you are using the expected system account and path. Ubuntu’s release-specific FFmpeg documentation is useful for understanding the packaged tool; check documentation for the release you actually run rather than treating a Noble (24.04) manual as universal.
Keep the system reasonably current through Ubuntu’s normal package updates, but do not make a live channel depend on an untested upgrade at the moment you need it. If you manage a channel for a shop, temple, local station or study group, test a change during a planned maintenance window and confirm that FFmpeg still reads the files and reaches YouTube afterwards.
FFmpeg is only the sender and encoder in this setup. It will not choose the right files, resolve rights to music or footage, create a YouTube event, or watch the broadcast on your behalf. For the broader editorial decision behind using recorded material in a live slot, see why businesses use pre-recorded videos for live streaming.
Prepare a playlist with the concat demuxer
FFmpeg’s concat demuxer reads a text file whose entries point to media files, then presents those files in sequence as one input. Create a playlist text file, for example playlist.txt, in a directory where you can also access the video files. A simple list looks like this:
file '/home/channel/media/morning.mp4'
file '/home/channel/media/noon.mp4'
file '/home/channel/media/evening.mp4'
Use one file line for each item and keep the paths accurate. Absolute paths, as above, make it clear which files are meant even if the FFmpeg process starts from another working directory. Paths containing apostrophes need the escaping expected by the concat file syntax; if possible, choose uncomplicated filenames and test the list before going live.
The demuxer does not make unrelated files identical. Stream-copying them with -c copy avoids decoding and re-encoding, but it is suitable only when their streams are compatible. Differences in codecs, dimensions, frame rates, stream layout or timestamps can cause errors or awkward transitions. If your playlist mixes material from different sources, re-encoding to a consistent video and audio format is generally the more predictable approach, though encoding uses machine resources.
For a first check, run a short, non-public test and watch FFmpeg’s output for errors as it crosses from one file to the next. Listen for audio level changes and look for black frames, unexpected aspect ratios or pauses. Do not infer seamless playback just because all the entries are in one text file. The FFmpeg concat demuxer documentation describes the file-list format and its constraints.
If you are deciding between a command-line workflow and an application with a playlist interface, the practical comparison is covered in OBS media source or VLC playlist for a 24/7 rain stream. The right choice depends on what you need to change while live and which tools you can reliably operate, not on the word “automatic”.
Loop the playlist for continuous output
The FFmpeg input option -stream_loop -1 tells FFmpeg to repeat the input indefinitely. It must appear before the -i input it affects. FFmpeg applies many options to the next input or output, so the position of an option is meaningful rather than cosmetic.
A command outline for a compatible playlist using stream copy is:
ffmpeg -re -stream_loop -1 -f concat -safe 0 -i /home/channel/playlist.txt \
-c copy -f flv "<YOUTUBE_RTMPS_URL>/<PRIVATE_STREAM_KEY>"
This is a template, not a tested universal command. Replace the playlist path and the destination placeholders with the values for your setup; do not paste a real key into a public document or shared terminal recording. -f concat selects the concat demuxer, and -safe 0 permits the absolute paths shown in the example. -re reads media at a rate intended for real-time output, rather than sending the file as fast as possible. The RTMPS URL and key are supplied by YouTube, and the chosen output format and codecs must match the ingest settings you intend to use.
The example’s -c copy is only for compatible source streams. If files differ, replace stream copy with explicit encoding options, including the video and audio codecs and any needed scale or frame-rate choices. For example, selecting H.264 video and AAC audio is a common RTMP/RTMPS combination, but the bitrate, frame size and frame rate should be chosen for the actual content and YouTube’s current guidance. A re-encode is not a magic fix for every malformed file; inspect and test the output first.
An endless input loop is not the same thing as a managed 24/7 service. A closed terminal, system restart, full disk, network interruption or rejected ingest can end the transmission. Keep a way to see FFmpeg’s logs and YouTube’s live health information, and decide who will respond if the picture freezes or audio disappears. If you need to switch between scheduled programmes rather than replay one fixed list, see how to make a YouTube radio livestream switch between scheduled programmes.
Match encoding to YouTube guidance
A stream that reaches YouTube can still look or sound poor if the encoding does not fit the source or the available upload capacity. YouTube’s live encoder guidance recommends constant bitrate (CBR), a keyframe interval of about two seconds and no more than four seconds. It lists H.264, H.265/HEVC or AV1 video, with AAC or MP3 audio, for RTMP/RTMPS ingest. Check the current encoder settings guidance and the settings shown for your event before settling on an output command; platform support can change.
For H.264, YouTube’s published recommendations give useful reference points rather than guarantees. At 720p and 30 frames per second, its table lists 3 Mbps as a minimum and 8 Mbps as a recommended bitrate. At 1080p and 30 frames per second, it lists 5 Mbps minimum and 14 Mbps recommended. YouTube recommends 128 Kbps for stereo audio. These are figures from its guidance consulted in October 2026; use the current table when you publish, and do not treat the recommended number as proof your connection can sustain it.
| Output choice | YouTube H.264 reference | Practical consideration |
|---|---|---|
| 720p at 30 fps | 3 Mbps minimum; 8 Mbps recommended | A lower data rate may be more manageable on a limited connection, but check the resulting image for fine detail. |
| 1080p at 30 fps | 5 Mbps minimum; 14 Mbps recommended | More detail can require a stronger, steadier upload and more capacity for encoding. |
| Stereo audio | 128 Kbps recommended | Check that the source audio is present and that levels are not clipping or changing sharply between files. |
These figures describe YouTube’s recommendations, not measured results from your Ubuntu machine. Leave headroom beyond the video bitrate for audio and network variation, and consider the upload path’s sustained capacity rather than a brief speed-test peak. YouTube advises running a speed test; its stream health display is also important once the encoder is connected. A short test helps reveal whether the selected resolution and bitrate are sustainable before you make the event public.
Stream copy can reduce the work of encoding when your source media already has compatible properties. Re-encoding can standardise mixed files, but it asks more of the host and can introduce quality loss depending on settings. If the machine cannot encode smoothly at your chosen settings, reduce the output demand or use a host with appropriate capacity. For an always-on deployment, compare the cost and policy of a machine you control with a hosted system, including outbound bandwidth and what happens when it needs maintenance.
Publish to YouTube using RTMPS
Create or schedule the live event in YouTube Live Control Room and obtain the ingest URL and stream key from its settings. Prefer RTMPS when YouTube presents it: the encrypted transport protects the connection between your encoder and the ingest endpoint. Do not copy an endpoint from an old command or assume one URL suits every event. YouTube’s stream settings help explains where to find the server URL and stream key, including the option to reveal RTMPS details.
The template above shows where the destination belongs, but inserting a real key directly into a shell command can expose it in terminal history or to other users with access to the machine. A protected configuration method is preferable. At minimum, keep the real destination out of source-controlled files, screenshots, chat messages and public troubleshooting posts. If an example is needed, use placeholders, as this article does.
Start with an unlisted test event if that fits your channel plan. Confirm in Live Control Room that YouTube is receiving data and that the video and audio look as expected, then check the stream health messages before relying on it. Test a playlist transition as well as the opening file; an event can start correctly and still fail when the input changes. YouTube recommends testing before going live and monitoring stream health, not simply assuming that an active FFmpeg process means viewers are receiving a healthy picture.
Once the test is satisfactory, decide how you will start the process again after planned maintenance and who will check it during the broadcast. A script that loops media does not prove that a failed process will restart. If you do not want a local computer kept on, a cloud-based broadcast can remove the need to leave that computer running; StreamNeo is one way to avoid managing the FFmpeg process on your own Ubuntu machine when the specific problem is keeping your personal computer on overnight. It does not change YouTube’s stream-key responsibilities or archive rules.
Keep the stream key private
Treat the stream key as a credential, not as a harmless setting. YouTube describes stream keys as similar to a password and address for your stream. Anyone who obtains it may be able to send a feed to the associated event or channel, so do not show it in screenshots, publish it in a tutorial script, commit it to a public repository or send it to a group chat for convenience.
Use a placeholder when asking for help, and redact the key before sharing terminal output or configuration. If you use a private configuration file, restrict access to the account that runs FFmpeg and keep that file out of source control and backups that are shared broadly. Avoid putting a real key into an example that others might copy. YouTube provides controls in Live Control Room to manage stream settings; if you believe the key has been exposed, reset or replace it there and update the encoder using the new value.
The same care applies when another person maintains the channel. Give them the access they need through appropriate account permissions rather than passing around a key casually. Before a broadcast, verify that the command points at the intended event and that the destination has not been pasted into a public log. A securely handled key is part of operating the stream, not an optional technical refinement.
Understand the archive-duration caveat
A continuous 24/7 transmission should not be treated as an automatically retained 24-hour replay. YouTube’s encoder guidance says streams under 12 hours are automatically archived. That guidance does not establish that a single continuous broadcast longer than 12 hours will be archived in full, so plan separately if viewers need to watch missed material later.
If replay access matters, decide whether shorter live sessions fit your schedule and audience, or whether you need a separate recording and publishing workflow. Splitting a broadcast changes the viewer experience and requires you to manage event transitions; it is not a guarantee that every segment will be retained or available. Check YouTube’s current live streaming archive guidance before making a retention promise to viewers.
Keep the distinction clear in channel descriptions and schedules: “live all day” describes transmission, while an archive is a separate platform outcome. For a devotional channel, for example, viewers may be able to listen live while a later replay is unavailable or incomplete. Make a test with your intended session length and confirm what appears in the channel’s video list before relying on replay as a service to your audience.
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 FFmpeg restart after a failure?
No. It repeats the input while that FFmpeg process is running. It does not prove that the process will restart after a crash, host restart, network interruption or YouTube ingest problem, so arrange monitoring and a recovery plan separately.
Can I use -c copy with every playlist?
No. Stream copy is appropriate only when the files have compatible streams and properties. For mixed material, test the transitions and consider re-encoding to consistent video and audio settings, while accounting for the extra encoding load.
Is RTMPS different from RTMP?
RTMPS is RTMP over an encrypted connection, and YouTube recommends it for protected transport. Copy the exact URL shown for your event in Live Control Room rather than assuming an endpoint.
Will a 24/7 YouTube stream be archived automatically?
Do not assume so. YouTube’s guidance says streams under 12 hours are automatically archived; it does not promise a complete archive for one continuous 24/7 broadcast. Check the current official guidance and test the session length you plan to use.