Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
VGSources
Docker

How to Set Up SRS on Ubuntu for YouTube Loop Streaming

SRS can receive an FFmpeg video loop on Ubuntu, but that alone does not broadcast to YouTube. Learn the Docker setup, loop command, encoder settings and relay boundary.

By VGSources Team 7 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can use SRS on Ubuntu to receive a prerecorded video loop, but the documented SRS example only publishes the video to SRS—it does not, by itself, send it on to YouTube. The simplest complete route is FFmpeg directly to YouTube Live. Use SRS as an intermediate server only when you also have a separately configured outbound relay to YouTube.

What SRS does—and where YouTube fits

SRS (Simple Realtime Server) is a media server that can receive and serve streams. FFmpeg reads and publishes your video file; Docker is the upstream-recommended way to run SRS; YouTube Live is the destination for viewers. SRS’s repository identifies version 8.0 and lists support for RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH and GB28181. The separate SRS v7 RTMP guide is marked unstable, so do not treat its version label as a stable production recommendation.

The key architectural distinction is the connection destination: an FFmpeg command publishing to SRS is not publishing to YouTube. The SRS getting-started example documents local ingest and playback, while YouTube documents an encoder connecting to YouTube. The cited setup guides do not establish a version-specific SRS configuration that relays an incoming stream to YouTube.

Choose an architecture before installing

Path What it does Best fit
Direct FFmpeg to YouTube FFmpeg reads the looped file and connects to YouTube using the Live Control Room server URL and stream key. SRS is not needed. You want the fewest components and do not need an SRS-local stream.
FFmpeg to SRS, then onward to YouTube FFmpeg publishes to SRS. A separately configured SRS outbound relay must then push to YouTube. You specifically need SRS as an intermediate server or need its local playback outputs. The SRS-to-YouTube relay details are not established by the cited setup examples.

For a self-hosted loop, consider whether SRS local playback is useful, whether the host’s upload connection can carry the chosen stream, whether the media codecs suit YouTube ingest, and whether you can configure and verify the outbound relay. If you do not need SRS, use the direct path below rather than assuming the basic SRS example completes the YouTube connection.

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.

Run SRS on Ubuntu with Docker

The SRS getting-started guide gives this sample server command:

docker run --rm -it -p 1935:1935 -p 1985:1985 -p 8080:8080 ossrs/srs:5

This is an upstream example, not a guarantee that the image tag is current or appropriate for every deployment. The SRS repository README shows a different image tag and additional UDP ports. Verify the tag and configuration you choose against the upstream documentation before relying on them.

Plan the host and ports

  • Port 1935 is used by the example RTMP listener; 1985 and 8080 are also published by the sample command.
  • Do not expose management or playback ports publicly unless your setup requires them. Configure the host firewall and Docker port publishing deliberately.
  • The sample uses --rm and interactive mode; it is a getting-started command, not a durable restart policy. For a continuing service, plan restart behavior and persistent configuration as needed.
  • For a command running on the same host, 127.0.0.1 refers to that host. Inside a container, localhost refers to that container’s network context. Use an address reachable from the publishing process, accounting for Docker networking.

Check the local SRS web endpoint

With the sample ports published, the getting-started guide’s lightweight check is to open http://localhost:8080/ on the machine running SRS. The guide also gives these example playback paths after a stream is available:

  • HLS: http://localhost:8080/live/livestream.m3u8
  • HTTP-FLV: http://localhost:8080/live/livestream.flv

For remote access, substitute an address reachable from the client and ensure the relevant port is intentionally exposed. Docker networking and firewall rules vary by host; a local success does not prove remote reachability.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Loop a video into SRS with FFmpeg

The SRS guide’s Docker-based example uses FFmpeg’s -stream_loop -1 option to repeat a file indefinitely:

docker run --rm -it ossrs/srs:encoder ffmpeg -stream_loop -1 -re -i doc/source.flv 
  -c copy -f flv rtmp://host.docker.internal/live/livestream

doc/source.flv is a sample file from the SRS source repository; replace it with a file readable by FFmpeg. The hostname host.docker.internal is environment-dependent and is not guaranteed to work on every Linux installation. Make sure the encoder container can reach the SRS listener using your Docker networking setup.

If FFmpeg runs directly on Ubuntu and SRS is listening on the same host at port 1935, this adapted command publishes to the SRS RTMP input:

ffmpeg -stream_loop -1 -re -i /path/to/video.mp4 -c copy -f flv rtmp://127.0.0.1:1935/live/livestream

Replace /path/to/video.mp4 with the actual file path. The -c copy option copies the input streams without re-encoding; it works only when the source codecs and stream format are compatible with the destination ingest. If YouTube or the receiving service rejects the media, inspect FFmpeg’s output and the platform’s stream-health information. The cited sources do not establish a tested transcoding command for an arbitrary input file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Connect an encoder to YouTube Live

  1. In YouTube Studio, create or schedule a live stream and open Live Control Room.
  2. Under Stream settings, copy the server URL and stream key provided for that stream. YouTube recommends RTMPS. To reveal its RTMPS URL, use the lock icon under Stream settings; YouTube says RTMPS adds TLS/SSL encryption to RTMP.
  3. Enter both the server URL and key in the encoder that will actually publish to YouTube. Treat the key as a password: do not paste it into public logs, screenshots or shared configuration.
  4. Start the encoder and check the Live Control Room preview and stream-health indicators before relying on the broadcast.

YouTube’s instructions describe an encoder connecting to YouTube. They do not turn the SRS-local publishing command above into a YouTube relay. To use SRS in between, configure and validate a separate outbound push to the exact RTMPS endpoint and key from Live Control Room; the sources cited here do not provide that version-specific SRS configuration. Do not copy the local SRS command and assume the video will appear on YouTube.

Set YouTube encoder quality appropriately

YouTube’s encoder guidance lists RTMP/RTMPS ingest, H.264, H.265/HEVC or AV1 video, frame rates up to 60 fps, AAC or MP3 audio, and CBR bitrate encoding. It recommends a two-second keyframe interval and says not to exceed four seconds. It recommends RTMPS for secure ingest.

The following are examples from YouTube’s recommended bitrate table; the page does not state a publication year. These are platform recommendations, not measured audience outcomes:

Output Video codec Minimum bitrate Recommended bitrate
1080p at 30 fps H.264 5 Mbps 14 Mbps
1080p at 30 fps AV1 or H.265 4 Mbps 10 Mbps
720p at 30 fps H.264 3 Mbps 8 Mbps

Choose a bitrate for the actual resolution, frame rate and codec rather than applying one example to every stream. YouTube recommends testing upload bitrate and testing with representative audio and video motion. Leave headroom on the host’s upload connection for network variation and any other traffic, then monitor stream health while testing.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot the connection and loop

YouTube does not show the video

  • Confirm where FFmpeg is publishing. A destination such as rtmp://127.0.0.1:1935/live/livestream is the SRS listener, not YouTube.
  • If using SRS as an intermediary, verify that a separate outbound relay is configured and that it uses the current YouTube RTMPS URL and stream key. The basic SRS example does not establish that relay.
  • If publishing directly, check the server URL and key against Live Control Room, then review the preview and stream-health status.

RTMPS reports an SSL or connection problem

Check that the configured server uses the RTMPS URL revealed in Live Control Room rather than assuming a default RTMP address. YouTube says to try port 443 if needed and compatible with the provided URL.

The stream works locally but not from another machine

Check that the client is using the Ubuntu host’s reachable address, that Docker publishes the required port, and that firewall rules permit the intended traffic. A container’s localhost is not automatically the Ubuntu host. Do not assume host.docker.internal resolves on every Linux setup.

The loop starts but playback or ingest fails

Inspect FFmpeg’s output for file-reading, timestamp or muxing errors, and check YouTube’s stream health if the encoder reaches YouTube. With -c copy, incompatible input codecs or stream details are not corrected. Test with the intended file and representative content; the cited documentation does not verify every file or encoding combination.

The stream stops after a host or process interruption

The sample Docker and FFmpeg commands demonstrate how to start services and loop media; they do not establish a production restart or recovery policy. For self-hosting, define how both processes start after reboot, how failures are detected, and how you will confirm the YouTube broadcast has resumed.

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.

Copyright and YouTube live eligibility

Only loop video and audio you own or are licensed to use for this kind of public, continuous stream. A prerecorded file being technically streamable does not grant rights to its music, footage or other included material. Review YouTube’s current live-stream rules and the rights for every component before broadcasting; reused or unlicensed material can create platform and rights-holder problems. A continuous loop is not a workaround for copyright or monetization requirements.

Or let it run in the cloud

If your goal is simply to keep uploaded videos looping on a YouTube channel, StreamNeo avoids maintaining an Ubuntu host, FFmpeg process and outbound SRS relay. Upload a recording or build a playlist, add your YouTube stream key once, and go live. StreamNeo loops the uploaded video from the cloud; it does not broadcast from a camera.

  • Nothing has to stay on at home; the stream runs in the cloud.
  • Any uploaded quality up to 4K 60fps streams as made, at one flat price per slot, with no re-encode or quality tiers.
  • Automatic recovery if YouTube drops the stream.
  • The first day is free with no card, one free day per account.

Monthly pricing: $9.99 per month. 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.

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

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 Patch Notes

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.