Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
DocumentaryTube
Admit one · Blog

How to Configure FFmpeg on Ubuntu for a 24/7 Gurbani YouTube Stream

A practical Ubuntu guide to looping authorized Gurbani media to YouTube Live with FFmpeg, RTMPS, tested encoder settings, and systemd supervision.
Opened Runtime8 min Written byDocumentaryTube Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To run a prepared Gurbani video continuously on YouTube from Ubuntu, install FFmpeg, test a looped stream to YouTube Live using the channel’s RTMPS URL and stream key, then run the proven command under a supervisor such as systemd and monitor its logs and YouTube stream health. A supervisor can restart a failed FFmpeg process, but it cannot prevent every interruption or fix an invalid source, revoked key, network outage, or YouTube-side issue.

Before you begin

  • An Ubuntu machine that can remain powered on and connected to the internet, or an Ubuntu VPS. A local machine depends on its power and home or office connection; a VPS shifts those dependencies to the host and its network.
  • A prepared video file, or authorized audio and video sources that you have tested locally. Decide whether audio and picture are in one file or separate inputs before building the command.
  • A YouTube channel with access to YouTube Live Control Room and a stream URL and key available there. Account eligibility, activation delays, and duration limits are not established by the encoder documentation; check the current Live Control Room for your channel.
  • Permission for every recording, arrangement, performance, and visual asset in the stream. The fact that a work is Gurbani does not establish rights to a particular recording or video.

The examples below use placeholders rather than a real key. Do not put a working stream key in a public script, repository, screenshot, or article.

Install and verify FFmpeg on Ubuntu

Ubuntu distributes FFmpeg through its package archive. First identify your Ubuntu release, because package versions vary. The Ubuntu Packages listing for Ubuntu 24.04 LTS (noble) showed FFmpeg version 7:6.1.1-3ubuntu5 in the universe component; that version should not be assumed for another release or a later package update. See Ubuntu Packages: FFmpeg for noble.

  1. Check the release and configured repositories: lsb_release -a and apt policy ffmpeg.
  2. Refresh package metadata and install the available package: sudo apt update, then sudo apt install ffmpeg.
  3. Verify the installed build: ffmpeg -version. If an encoder or protocol is unavailable, inspect the build configuration and local help rather than assuming every Ubuntu package has identical capabilities: ffmpeg -buildconf, ffmpeg -encoders, and ffmpeg -protocols.

Ubuntu’s older release-specific FFmpeg manual page may not match the installed version. For protocol syntax, consult the FFmpeg Protocols Documentation and the manual installed on your target machine.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Prepare the source and choose output settings

Check your media before streaming

Play the complete source locally before sending it live. Confirm that the picture, audio, duration, and intended repeat point are correct. If audio and video are separate, test that both inputs remain available and synchronized; a command for a combined file should not be reused unchanged for separate feeds. Use only media you are authorized to broadcast.

For a simple one-file stream, choose output dimensions and frame rate that the source and machine can sustain. Do not upscale a low-resolution recording merely to claim a higher output resolution. Software encoding also consumes CPU; if considering hardware encoding, first confirm that the hardware and installed FFmpeg build provide the encoder you intend to use.

Match YouTube’s encoder guidance

YouTube’s encoder settings specify RTMP or RTMPS ingest; H.264, H.265/HEVC, or AV1 video; up to 60 frames per second; constant bitrate (CBR); a recommended two-second keyframe interval with a maximum of four seconds; and AAC or MP3 audio. Its listed H.264 bitrate recommendations include:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
H.264 output Minimum bitrate Recommended bitrate
720p30 3 Mbps 6 Mbps
1080p30 5 Mbps 10 Mbps

These are YouTube’s published encoder values, not a guarantee that a particular internet connection can sustain them. Leave upload headroom for network variation; a listed minimum is not a robust 24/7 target. Check the current YouTube live encoder settings, bitrates, and resolutions before deployment because recommendations can change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Create the YouTube broadcast and protect its key

  1. Open YouTube Live Control Room and create or select the broadcast and stream configuration appropriate for your channel.
  2. Copy the current stream URL and stream key shown by YouTube. Prefer RTMPS, YouTube’s secure streaming option. Google describes RTMPS as RTMP carried through an SSL connection; see Delivering Live YouTube Content via RTMPS and YouTube’s RTMPS encryption instructions.
  3. Keep the key out of version control and limit access to any file or environment configuration that contains it. A key should be treated like a password: if it is exposed, replace or reset it in YouTube’s interface before continuing.

YouTube may adjust interface labels or workflow. Use the URL and key currently shown for the specific broadcast rather than copying an old endpoint from a sample.

Test a looped FFmpeg stream interactively

Build and test the command in a terminal before making it a background service. For a local file containing both picture and sound, an adaptable H.264/AAC example is:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

ffmpeg -re -stream_loop -1 -i "/path/to/authorized-video.mp4" -c:v libx264 -preset veryfast -b:v 6M -maxrate 6M -bufsize 12M -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -c:a aac -b:a 128k -f flv "rtmps://YOUR-INGEST-URL/YOUR-STREAM-KEY"

This example targets 720p30 H.264 at YouTube’s 6 Mbps recommendation, with a two-second GOP at 30 fps. It does not resize the source; add an appropriate scale filter only if you have decided to resize. The example also assumes the installed FFmpeg build includes libx264 and supports RTMPS. If either is unavailable, check ffmpeg -encoders and ffmpeg -protocols, then adapt to a supported encoder and protocol. FFmpeg’s protocol documentation includes RTMP-family publishing syntax: FFmpeg Protocols Documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Replace the destination placeholder with the current RTMPS destination assembled from YouTube’s displayed URL and key; never publish the resulting command with the real key. Because secrets in command-line arguments can be visible to other users on a shared machine, use a protected configuration approach for a long-running service and restrict permissions. Test the installed FFmpeg’s exact options locally; command behavior can differ by build.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2Ă— USB C male to USB A female adapters and 2Ă— USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Looping separate audio and video

If you have separate inputs, do not use the combined-file command as-is. Each input needs a deliberate loop or repeat strategy, and the outputs must stay synchronized. Validate the input streams with ffprobe and test a short run before switching to an unattended process. FFmpeg input and filter behavior depends on the media formats and their durations, so there is no safe universal separate-input command without those details.

What to watch during the test

  • FFmpeg opens the media and emits audio and video without repeated decode, timestamp, or encoder errors.
  • Your upload connection sustains the selected bitrate with capacity left for variation.
  • The broadcast appears in YouTube’s preview and its stream-health panel reports a usable signal.
  • Audio remains audible and synchronized with picture through the intended loop boundary.
  • The key is not exposed in logs, shared terminal history, source control, or public configuration.

YouTube recommends testing before a live event with representative audio and motion, and monitoring stream health and messages. Do not treat a process that starts successfully as proof that the channel is reliably live.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Run the tested command under systemd

Once the interactive test works, run it under a supervisor so the process can be restarted after a crash or host reboot. The following is an implementation pattern, not a guarantee of uninterrupted broadcasting. Put the actual command in a root-readable script or protected environment file; avoid embedding a real key in a world-readable unit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
  1. Create a service account if appropriate for your machine, and place the media and protected configuration where that account can read them.
  2. Create a script containing the tested FFmpeg command, with the destination and key supplied from a permission-restricted configuration. Ensure the script is executable and owned appropriately.
  3. Create a systemd unit such as /etc/systemd/system/gurbani-stream.service that runs the script and specifies a restart policy, for example Restart=always with a delay such as RestartSec=5. Choose a delay appropriate to your environment so a persistent error does not cause rapid repeated launches.
  4. Load and start the service: sudo systemctl daemon-reload, then sudo systemctl enable --now gurbani-stream.service.
  5. Inspect operation with systemctl status gurbani-stream.service and journalctl -u gurbani-stream.service -f. Confirm that logs do not reveal credentials.
  6. Deliberately test a failure and recovery while monitoring YouTube. Confirm that systemd restarts the process, FFmpeg reconnects successfully, and the broadcast becomes healthy again.

A supervisor can relaunch a process; it cannot repair a broken input, invalid or revoked stream key, lost network, exhausted disk, unavailable host, or YouTube ingest problem. A third-party 24/7 YouTube Stream setup and operations example illustrates a systemd-and-looping approach, but it is not official Ubuntu or YouTube guidance.

Troubleshoot common failures

Symptom Likely cause What to check or do
FFmpeg says an encoder is unknown The installed build lacks the requested encoder, such as libx264. Check ffmpeg -encoders and the build configuration. Install or select a compatible build or encoder; do not assume package capabilities across Ubuntu releases.
Connection fails or YouTube does not receive the stream Wrong endpoint, key, protocol support, or network access. Copy the current URL and key from Live Control Room, use the RTMPS option, verify ffmpeg -protocols, and check the host’s outbound connectivity. Replace an exposed key.
YouTube reports poor stream health Bitrate too high for upload capacity, unstable connection, unsupported profile, or encoding trouble. Check YouTube’s health messages, measure sustainable upload capacity, reduce output demands if needed, and use the current encoder settings guidance.
Audio or video stops at the end of the file The source was not configured to loop, or the loop option does not suit the input. Confirm the tested command includes the intended loop behavior; verify the file is readable and examine FFmpeg output at the end boundary.
Stream repeats but audio and picture drift or break at the join Unequal source durations, timestamp issues, or separate inputs not synchronized. Inspect durations with ffprobe, test the loop locally, and adjust the media or input strategy before enabling automatic restarts.
systemd repeatedly restarts FFmpeg without restoring the live broadcast Persistent configuration/input error, rejected key, failed network, or an ingest-side issue. Read journalctl, resolve the underlying error, then test a manual start and observe YouTube health before relying on the service.
Stream stops after a host restart or outage The machine or VPS was unavailable; process supervision only works while the host is up. Check power, boot and network reliability, service enablement, storage, and host-provider status. Test recovery after a reboot.

Keep the stream sustainable and compliant

For a 24/7 channel, verify the recording and visual rights for the entire playlist, not just its first item. YouTube’s technical encoder settings do not grant rights, establish channel eligibility, or guarantee that a broadcast will remain available. Reused-content and copyright outcomes depend on the actual material and channel circumstances; check YouTube’s current policies and the account’s Live Control Room before launching a continuous program.

Also plan for the operational costs of a machine running continuously, power and bandwidth, storage, and any VPS charge. The appropriate choice depends on whether your home connection and machine can remain available and whether you can monitor and recover the service. No setup eliminates host, network, source, credential, or platform failure.

Or let it run in the cloud

If you do not want an Ubuntu computer or home connection to stay on, StreamNeo is a cloud service for keeping an uploaded video or playlist live on YouTube: upload your recording, add your YouTube stream key once, and go live. It loops from the cloud, supports your upload as made up to 4K 60fps at one flat price per slot, and automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly service is $9.99 per month. For Indian users, UPI and cards are supported.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start your free StreamNeo day.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Screening Room

  1. How to Send a YouTube Live Stream to a Premiere—and What “Premiere Playlist” Can’t DoAdmit one · BlogHow to Send a YouTube Live Stream to a Premiere-and What “Premiere Playlist” Can't DoOpened04 OCT 2026Runtime6 min
  2. How to Run a YouTube Live Playlist from a Raspberry PiAdmit one · BlogHow to Run a YouTube Live Playlist from a Raspberry PiOpened04 OCT 2026Runtime4 min
  3. How to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootAdmit one · BlogHow to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootOpened04 OCT 2026Runtime6 min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.