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

Run FFmpeg in the foreground under a systemd service: systemd can start it at boot, restart it after an unexpected exit, and send its output to the journal. First make sure your FFmpeg command works interactively; then place that command in the service’s ExecStart= setting. The right FFmpeg command depends on your media source, output protocol, codecs, and destination, so there is no safe universal command for every bhajan stream.

Before creating the service

Set up and test the stream as the same Ubuntu user that will run the service. A service can fail even when a command worked in a terminal if it uses a different account, working directory, file permissions, environment, or credentials.

  • Check the installed build with ffmpeg -version. If an option is rejected, consult that installation’s local help and verify that the option is supported by its FFmpeg version. FFmpeg’s online documentation is regenerated nightly and describes the newest revision, which may differ from an older Ubuntu package.
  • Run the complete FFmpeg command interactively with the intended input, output, and credentials. Confirm that the destination receives media before putting the command in a unit.
  • Decide whether the input is a local recording, playlist, capture device, or network stream, and identify the output protocol and destination requirements.
  • Choose whether FFmpeg should copy already encoded streams or transcode them. Stream copy avoids encoding, but is suitable only when the destination accepts the existing codecs and container parameters. Transcoding requires compatible encoders and sufficient CPU capacity.
  • Keep stream keys and other credentials out of world-readable unit files and logs. Use a restricted service account and permissions appropriate to your setup.

Create a systemd unit

The following is an illustrative template, not a tested, universally suitable command. It assumes a local file, audio transcoding to AAC, and an RTMP-style output. Replace the paths and destination with values for your installation, and confirm the destination’s requirements and the installed FFmpeg encoders first. Do not use the example destination literally.

[Unit]
Description=FFmpeg bhajan stream
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=stream
WorkingDirectory=/srv/bhajan
ExecStart=/usr/bin/ffmpeg -re -stream_loop -1 -i /srv/bhajan/source-file -c:a aac -b:a 128k -f flv rtmp://STREAM-DESTINATION/APP/STREAM-KEY
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Adapt the command to the actual stream

  • User=stream and WorkingDirectory=/srv/bhajan are example account and path values. Create or choose an account with only the access the stream needs, and ensure it can read the media and any required configuration.
  • ExecStart= must contain the working FFmpeg command. Keep FFmpeg in the foreground: do not append &. Ubuntu Jammy’s systemd.service manual says shell constructs such as shell redirection and pipes are not supported directly in ExecStart=. Use journal logging or explicitly configure a wrapper if shell features are necessary.
  • -re, -stream_loop -1, AAC encoding, the bitrate, FLV muxer, and RTMP-style URL in this template are assumptions for the example, not universal settings. Use input and output options appropriate to the source and destination.
  • If the media is already encoded, stream copy may be an option instead of transcoding; verify that the destination accepts its codecs and container parameters.
  • Restart=on-failure asks systemd to restart the process after an unclean failure. RestartSec=5 is an example delay; choose a measured delay suitable for the service rather than allowing repeated immediate restarts.

Enable and manage the service

  1. Save the unit. Store the service definition as bhajan-stream.service in a systemd unit location appropriate to your Ubuntu setup.
  2. Have systemd reload unit definitions: sudo systemctl daemon-reload.
  3. Enable it at boot and start it now: sudo systemctl enable --now bhajan-stream.service.
  4. Check its state: systemctl status bhajan-stream.service.
  5. Follow its logs: journalctl -u bhajan-stream.service -f.
  6. Stop it when needed: sudo systemctl stop bhajan-stream.service.

These commands assume that the unit is named bhajan-stream.service. Confirm the unit name, paths, and permissions for your installation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Bmax Mini PC Mini Desktop Computer Intel Celeron J3355 (Up to 2.5GHz) Win 11, 6GB RAM 128GB eMMC Support M.2 SSD Expansion (512GB/2TB), 4K Dual Display WiFi5& BT5.0 for Home/Office,Daily Use,B1 Plus
  • 𝐏𝐨𝐰𝐞𝐫𝐟𝐮𝐥 & 𝐄𝐟𝐟𝐢𝐜𝐢𝐞𝐧𝐭 𝐏𝐞𝐫𝐟𝐨𝐫𝐦𝐚𝐧𝐜𝐞: Powered by the Intel Celeron J3355 Processor (up to 2.5GHz), this Mini PC delivers a 25% performance boost over previous generations. Pre-installed with Windows 11 Home and supporting Linux/Ubuntu, it’s the ideal micro desktop for seamless web browsing, document editing, and efficient daily office tasks.
  • 𝐌𝐚𝐬𝐬𝐢𝐯𝐞 𝐒𝐭𝐨𝐫𝐚𝐠𝐞 & 𝐔𝐧𝐢𝐪𝐮𝐞 𝐄𝐱𝐩𝐚𝐧𝐬𝐢𝐨𝐧: Equipped with 6GB LPDDR3 RAM and 128GB onboard storage for fast boot-ups. Stand out with our dual M.2 SSD slot design (1x SATA + 1x NVMe), allowing you to easily expand storage up to 2TB without replacing the original drive. Perfect for managing large digital libraries and intensive multitasking.
  • 𝐒𝐭𝐮𝐧𝐧𝐢𝐧𝐠 𝟒𝐊 𝐃𝐮𝐚𝐥 𝐇𝐃𝐌𝐈 𝐃𝐢𝐬𝐩𝐥𝐚𝐲: Boost your productivity with Intel HD Graphics 500 and dual HDMI ports, supporting 4K @60Hz high-definition visuals. Connect two monitors simultaneously to streamline your workflow—ideal for home office setups, stock trading, or enjoying a theater-like 4K media experience.
  • 𝐔𝐥𝐭𝐫𝐚-𝐂𝐨𝐦𝐩𝐚𝐜𝐭 & 𝐒𝐩𝐚𝐜𝐞-𝐒𝐚𝐯𝐢𝐧𝐠 𝐃𝐞𝐬𝐢𝐠𝐧: Measuring only 4.2x4.1x1.4 inches and weighing just 0.49 lbs, this palm-sized mini computer fits anywhere. Use the included VESA bracket to mount it behind your monitor for a zero-clutter workspace. Features a smart silent fan and heat sink system for quiet, reliable 24/7 operation.
  • 𝐒𝐭𝐚𝐛𝐥𝐞 𝐂𝐨𝐧𝐧𝐞𝐜𝐭𝐢𝐯𝐢𝐭𝐲 & 𝐒𝐦𝐚𝐫𝐭 𝐑𝐞𝐜𝐨𝐯𝐞𝐫𝐲: Stay connected with Dual-Band WiFi (2.4G/5G), Bluetooth 5.0, and Gigabit Ethernet. Exclusive One-Click Restore feature (via F9 key) allows for quick system recovery in minutes. Backed by Bmax's 12-month warranty and lifetime technical support for a worry-free purchase.

Understand what recovery does—and does not do

There are two separate failure cases: FFmpeg exits, or FFmpeg stays alive while the media output has stalled. A systemd restart policy addresses process exits and some timeouts; it does not inherently detect a stream that remains running but is no longer delivering media. Repeated failures can also hit systemd’s unit start-rate limits, so inspect the unit state and rate-limit settings if restart attempts stop.

Match FFmpeg recovery options to the protocol

FFmpeg’s documented HTTP reconnection options apply to HTTP input handling. The FFmpeg FIFO muxer documentation demonstrates an RTMP output recovery approach. These solve different cases: select options based on the actual protocol and whether the failure is on the input or output side. Do not assume that an HTTP input option repairs an RTMP output, or that systemd alone repairs either kind of stalled connection.

Rank #2
Sale
KAMRUI Essenx E2 Mini PC, AMD Ryzen 5 3500U(4 Cores, 8 Threads, Up to 3.7GHz), 16GB DDR4(Expandable) 256GB M.2 SSD Micro PC, HDMI+DP Dual 4K@60Hz Display Home/Business/Office Mini Desktop Computers
  • 【Ryzen 5 3500U Processor】KAMRUI Essenx E2 Mini PC is equipped with AMD Ryzen 5 3500U (4-cores/8-threads, up to 3.7GHz) with integrated Radeon Vega 8 Graphics(1200MHz, 8 Core). The 3500U CPU operates at a base frequency of 2.1 GHz and a Boost frequency of 3.7 GHz. This DDR supports upgradable up to 32GB, SSD supports up to 2TB.(NOT INCLUED), KAMRUI E2 3500U Mini PC is ideal for light office work and home entertainment. KAMRUI E2 3500U is more than 35% more powerful and smoother in operation than the Intel N150, 33% faster than Intel N95, 28% performance boost over Intel i3-10110U, and 42% stronger processing power than AMD Ryzen 3 3200U.
  • 【16GB DDR4 & 256GB SSD】The KAMRUI E2 mini computers is equipped with 16GB DDR4(Expandable up to 32GB) for faster multitasking and smooth application switching. 256GB M.2 SSD ensures fast startup times,fast file transfers and plenty of storage space,eliminating slow loading times and ensuring fast responsiveness.Storage space can RAM supports up to 32 GB, SSD supports up to 2TB (Not included)make file storage easier.
  • 【4K Dual Display & USB 3.2 Type-A Port】KAMRUI E2 3500U mini desktop pc is equipped with an HDMI 2.0+DP 1.4 interfaces for faster transmission, Support Dual 4K@60Hz Display, E2 mini desktop computers is ideal for visual home entertainment, home office, conference rooms, etc. USB3.2 Gen1 Type-A Port×2 with a transfer speed of up to 5Gbps (10 times faster than USB 2.0) for efficient data transfer. The RJ45 1000M Gigabit Ethernet Port ensures a stable network connection.
  • 【WiFi+Bluetooth stable connection】The Kamrui E2 micro pc have reliable and stable wireless connection, open websites in seconds, watch movies without buffering and download files smoothly, connect your monitor from WiFi or Ethernet, use a wireless keyboard and mouse through bluetooth, which will be powerful workstation for you.
  • 【Versatile Ports】This KAMRUI E2 Small pc is equipped with HDMI 2.0×1(4K@60Hz)、DP1.4×1(4K@60Hz)、Gigabit Ethernet Port (RJ45, 10/100/1000Mbps) ×1、USB3.2 Gen1 Type-A Port×2(5Gbps)、USB2.0 Type-A Port×2、3.5mm Audio Jack ×1、DC In ×1、Power Button ×1

Test a controlled failure

Before relying on unattended operation, stop and restart the service deliberately. Review systemctl status bhajan-stream.service and journalctl -u bhajan-stream.service, then verify at the destination that it is receiving media again. This is a recommended operational check, not a guarantee that every network or destination failure will recover automatically.

Troubleshoot common failures

Symptom Likely area to check What to do
The service exits immediately or fails to start. Command syntax, unsupported options, executable path, account, working directory, or file permissions. Read the unit status and journal; run the command interactively as the service account; check ffmpeg -version and the local help for options that may not exist in the installed build.
It works in a terminal but not as a service. The service may run as a different user or from a different directory, or lack access to the media or credentials. Make User=, WorkingDirectory=, paths, and permissions consistent with the tested command. Keep secrets protected rather than making the unit broadly readable.
The process restarts repeatedly. The FFmpeg command is failing, or systemd’s start-rate limit has been reached. Inspect systemctl status and the journal to find the underlying error. Fix the command or access problem; review restart delay and unit rate-limit behavior instead of allowing a tight restart loop.
The service is active but the destination is not receiving media. A stalled input or output may leave FFmpeg running; Restart=on-failure is not a general stall detector. Verify media reception at the destination. Choose protocol-specific FFmpeg recovery for the relevant input or output side, then test recovery with a controlled failure.
The stream reaches the destination but media is rejected or unusable. Codec, container, or destination compatibility may not match; the example’s RTMP, FLV, and AAC assumptions may not apply. Confirm the destination’s requirements and the source’s encoding. Choose stream copy only if the existing media is accepted; otherwise use a supported transcoding path.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When a cloud service is a better fit

If the goal is to keep uploaded bhajan videos playing as a YouTube live stream without maintaining an Ubuntu machine, StreamNeo is a cloud alternative: upload a recording or build a playlist, add your YouTube stream key once, and go live. It loops uploaded videos from the cloud; it does not stream from a camera. The DIY systemd approach gives you control over the FFmpeg process and host, while a cloud service avoids needing your own computer to remain on.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Mini PC Stick Fanless, Micro Desktop Computer Win 10 Celeron J3455, 4GB RAM 64GB eMMC, Gigabit Ethernet, 4K@60Hz Output, WiFi BT 5.0 for Industrial IOT, Business, Office & Digital Signage
  • 【Fanless Design for Uninterrupted Stability】Perfect for noise-sensitive environments and 24/7 operation. This mini PC delivers completely silent performance with an efficient cooling system that prevents overheating. It reliably runs office software and HD video without slowdowns, making it ideal for focused offices, home theaters, and demanding industrial IoT applications
  • 【Ultra-Portable & Ready for Any Screen】Extremely compact and lightweight, this is a full Windows 10/Ubuntu computer that fits in your pocket. It's the ultimate plug-and-play solution for business presentations on a projector, digital signage in classrooms, or entertainment on your home TV. Achieve true "work from anywhere" flexibility with one device for all scenarios
  • 【Stunning UHD 600 Graphics】Experience vibrant, fluid visuals with 4K @ 60Hz output. Powered by Intel UHD 600 Graphics, this mini PC is your perfect home entertainment center for streaming movies, attending online classes, or hosting video conferences. It turns any display into a sharp, high-definition visual experience
  • 【Versatile Ports for Easy Expansion】Tackle multiple tasks with ease using our comprehensive selection of ports. Connect storage, keyboards, monitors, and more simultaneously with 2x USB 3.0 ports, a Gigabit LAN port, and a TF card reader. With convenient USB-C charging, it becomes the effortless control center for your office or home setup
  • 【Pre-Installed & Ready to Go】Get started immediately with the genuine Windows 10 Pro operating system pre-installed. Paired with 4GB LPDDR4 RAM and 64GB eMMC storage, it's fully equipped for everyday office tasks and HD content right out of the box. This hassle-free setup is perfect for businesses, schools, and users who want a simple, ready-to-run computer

Or let it run in the cloud

StreamNeo keeps the YouTube stream running from the cloud, so nothing has to stay on at home. Any quality up to 4K 60fps is streamed as uploaded, at one price per slot; automatic recovery is included if YouTube drops the stream. The first day is free with no card. Monthly pricing is $9.99 per month. In India, UPI works; card checkout is available worldwide. Learn more at StreamNeo, or start the free first day.

Best Value
Getorli Mini PC AMD Ryzen 5 3501U (4C/8T, Max 3.7GHz) Small Desktop Computer 16GB DDR4 RAM 512GB NVMe SSD Budget Micro Compact PCs 4K HD Dual HDMI WiFi 6 BT5.3 Prebuilt OS-Home Office Gaming Streaming
  • 【Great power in a small computer】Get fast performance from the AMD Ryzen 5 3501U ​CPU (2.1GHz-3.7GHz, 4 Cores 8 Threads) inside this mini pc, TDP 15W up to 25W. It's perfect for all your home office​ and business use, like daily computing, web browsing, and smooth media streaming. This small desktop computer​ handles everyday tasks easily and quietly.
  • 【Work on many things at once with lots of storage】This mini PC comes with 16GB of fast DDR4 RAM (expandable up to 32GB), allowing you to smoothly run multiple programs, dozens of browser tabs, and large files all at once. It also features a spacious 512GB NVMe SSD that provides ample storage and delivers dramatically faster boot-ups, app launches, and file transfers compared to a traditional hard drive.
  • 【See everything clearly on one or two 4K screens】Connect one or two monitors for more space to work or play. Dual HDMI ports​ on this mini pc​ support super sharp 4K Ultra HD​ video. It's great for doubling your work area for business​ or watching movies in high definition.
  • 【Fast modern connections in a tiny box】Enjoy a better and more stable internet connection with the latest WiFi 6. Use Bluetooth 5.3​ to connect wireless headphones, keyboards, and mice without wires. This small pc​ is very compact​ to save desk space and has extra USB ports (USB 2.0×2, USB 3.0×2, Type-c 2.0×1, Type-c 3.2 full featured×1, HDMI×2) for your printer, webcam, or other computer accessories.
  • 【Reliable Warranty and Support】We provides 1 year warranty for each Mini computers. So you don't need to worry about any product problems. If you have any questions about the product, please contact our customer service, we will provide 24-hour professional technical support and serve you at any time.
Rank #4
Glorlin Mini PC - Ryzen 5 3501U (up to 3.7GHz), 16GB DDR4 512GB SSD, Mini Desktop Computer with Triple 4K Display Support, WiFi 6 Bluetooth 5.3, Small Micro PC for Work, Study & Multitasking
  • 【Smooth Performance for Daily Work】Powered by Ryzen 5 3501U(4 cores, 8 threads, up to 3.7GHz), this mini PC handles everyday tasks smoothly. It works well as a small computer for office work, browsing, and multitasking.
  • 【16GB Memory for Better Responsiveness】With 16GB DDR4 RAM and a 512GB SSD, this mini computer runs multiple apps and tabs more smoothly. A reliable small PC for users who need consistent performance.
  • 【Expand Your Workspace Easily】Supports up to three displays through HDMI and USB-C connections. This mini desktop computer setup helps improve workflow when working across multiple screens.
  • 【Flexible Connectivity Options】Includes WiFi 6, Bluetooth 5.3, USB ports, Ethernet, and audio connections. This micro PC integrates easily into different desktop computer setups.
  • 【Compact Alternative to Larger Systems】Compared with traditional desktop computers, this small PC saves space while providing the functions needed for daily computing. Suitable for users considering mini computers.

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.