October 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 PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
DocumentaryTube
FFmpeg

How to Set Up SRS on Ubuntu for YouTube Loop Streaming

Set up SRS on Ubuntu, loop a file into it with FFmpeg, and understand why the basic SRS example does not automatically relay to YouTube Live.

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

You can run SRS on Ubuntu and use FFmpeg to loop a prerecorded video into it, but the basic SRS example does not by itself send that video to YouTube. The documented loop command publishes to SRS; a YouTube broadcast needs a separate encoder connection to the RTMPS URL and stream key from YouTube Live Control Room. This guide shows the working SRS ingest setup, explains that boundary, and gives the simpler direct-to-YouTube option when you do not need SRS in the middle.

What SRS does—and what it does not do in this setup

SRS (Simple Realtime Server) is a media server. FFmpeg reads and publishes your video; SRS accepts that incoming stream and can provide local playback. YouTube Live is the destination platform. SRS’s upstream repository identifies version 8.0 and lists support for protocols and formats including RTMP, WebRTC, HLS, HTTP-FLV, SRT, MPEG-DASH, and GB28181; it recommends Docker as a way to run SRS. SRS upstream repository

The key distinction is that a stream arriving at SRS is not necessarily being forwarded from SRS to YouTube. The SRS getting-started example documents a file publisher sending to an SRS RTMP address, while YouTube’s setup guide describes an encoder sending to YouTube. Those instructions do not establish the version-specific SRS outbound-forward configuration needed to join the two steps. Do not treat the basic example below as a complete SRS-to-YouTube relay.

Choose the architecture before you configure anything

Path What it does Use it when
Direct FFmpeg-to-YouTube FFmpeg reads and loops the file, then publishes straight to the YouTube ingest URL. SRS is not involved. You want the fewest components and do not need SRS’s local ingest or playback. YouTube documents encoder-based streaming and provides its server URL and key in Live Control Room. YouTube encoder workflow
FFmpeg-to-SRS FFmpeg publishes to SRS; SRS accepts the stream and can serve local playback. A separate, explicitly configured outbound relay is still needed to reach YouTube. You need SRS in the media path and can configure and verify its outbound push for your selected SRS version.

This article gives you a documented SRS ingest and loop, plus a separate direct-to-YouTube route. It does not invent an SRS forwarding configuration where the cited SRS examples do not provide one.

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.
#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.

Start SRS on Ubuntu with Docker

The SRS getting-started guide gives this Docker example:

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

This is an upstream example, not a recommendation that the tag is the right or newest choice for every deployment. The current SRS repository README shows a different image tag and additional UDP ports. Check the upstream documentation and the image tag you intend to run before deploying. SRS getting started

For a local test

With the example container running, open http://localhost:8080/ on the same machine to check the example web endpoint. The guide also documents these local playback paths after a stream is published to SRS:

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

For a remote Ubuntu host

In the examples, localhost refers to the machine or network context where the command runs; it is not automatically the address of your remote server. Use an address reachable from the publishing process and account for Docker networking. SRS’s sample uses host.docker.internal, but that name is environment-dependent and should not be assumed to resolve on every Linux installation.

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.

For a durable server, select and verify an appropriate upstream image tag, configure restart behavior and persistent configuration as needed, and expose only the ports required for your design. The example maps RTMP port 1935, HTTP port 8080, and API port 1985; do not expose management or playback ports publicly unless you need them. These are deployment cautions, not a hardened production recipe supplied by the example.

Loop a video file into SRS with FFmpeg

The SRS guide’s FFmpeg example uses -stream_loop -1 to repeat a file indefinitely and publishes it to an SRS RTMP address. Its container-based example is:

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, not a video that will necessarily exist in your working directory. Replace it with a media file FFmpeg can read. The example hostname may need to be changed to one reachable from the FFmpeg container.

Run FFmpeg directly on the Ubuntu host

If SRS is listening on the same host and RTMP port 1935 is reachable from the host process, this adapts the documented SRS publisher URL and loop option:

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.
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 your file’s actual path. The -stream_loop -1 option repeats it indefinitely; -re reads it at its native rate; -c copy copies the audio and video streams rather than encoding them again. Copying only works if the source streams are compatible with the destination ingest. The command publishes to SRS—not to YouTube. SRS’s RTMP documentation shows the RTMP listener and publisher pattern; that page labels its v7 branch unstable, so do not treat it as a universal production configuration. SRS RTMP guide

To check local SRS playback, use one of the documented playback paths above. Successful local playback confirms that SRS is receiving and serving the stream; it does not prove that YouTube is receiving it.

Set up a direct FFmpeg connection to YouTube

If you do not need SRS between FFmpeg and YouTube, use YouTube as the publishing destination instead. In YouTube Studio, create or schedule a live stream, open Live Control Room, and copy the server URL and stream key shown in the stream settings. YouTube recommends RTMPS. To reveal its RTMPS URL, use the lock icon under Stream settings; copy the URL provided there rather than assuming a default RTMP address. RTMPS is RTMP secured with TLS/SSL. Keep the stream key secret. YouTube: Encrypt your stream using RTMPS

  1. Prepare the loop. Use -stream_loop -1 with the path to your prerecorded file.
  2. Use YouTube’s supplied destination. Set the publishing destination to the exact RTMPS server URL and stream key from Live Control Room. Do not publish to rtmp://127.0.0.1:1935/live/livestream if you intend to send directly to YouTube; that address is the local SRS listener.
  3. Check the media and ingest settings. Use a compatible container and codecs, set the required video and audio encoding options, and confirm that the upload connection can sustain the chosen bitrate. YouTube’s guidance below gives its recommended settings, but the correct command depends on your file and the server URL/key supplied to your account.
  4. Start and verify. Start the encoder, check that the stream appears in Live Control Room, and monitor YouTube’s stream health before relying on the loop.

The available setup pages do not establish a tested, copy-and-paste FFmpeg command for every file and YouTube stream configuration. In particular, do not substitute the SRS ingest URL for YouTube’s RTMPS URL or expose your private stream key in a public script, log, or shared screenshot.

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

Choose YouTube encoder settings

YouTube’s encoder guidance lists RTMP/RTMPS protocols; H.264, H.265/HEVC, and AV1 video options; frame rates up to 60 fps; AAC or MP3 audio; and constant bitrate (CBR) encoding. It recommends RTMPS, a two-second keyframe interval, and no more than four seconds between keyframes. Bitrate depends on resolution, frame rate, and codec. The retrieved guidance does not state a publication year. YouTube: Choose live encoder settings, bitrates, and resolutions

Example output Video codec YouTube-listed minimum YouTube-listed recommended bitrate
1080p at 30 fps H.264 5 Mbps 14 Mbps
1080p at 30 fps AV1 or H.265/HEVC 4 Mbps 10 Mbps
720p at 30 fps H.264 3 Mbps 8 Mbps

These are YouTube’s published encoder recommendations, not measured audience results. Select settings for the codec, resolution, and frame rate you will actually send rather than copying a bitrate from a different format. YouTube recommends testing upload capacity with a speed test, testing with representative audio and video motion, and monitoring stream health.

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

Common problems and what to check

  • YouTube reports an SSL or connection problem: Confirm that you copied the RTMPS URL from Live Control Room and are using its secure scheme, not an RTMP address. YouTube says to try port 443 if needed and compatible with the provided URL. YouTube RTMPS guidance
  • The video plays from SRS, but no stream appears on YouTube: Identify which connection is active. FFmpeg publishing to SRS and an encoder publishing to YouTube are separate steps. Local SRS playback alone is not an outbound relay.
  • The publisher cannot reach SRS on a remote host: Check which machine or container runs FFmpeg, whether the chosen address resolves from that context, whether the RTMP listener is reachable, and whether Docker port mapping and firewall rules match your setup.
  • Local playback works, but remote playback does not: Use the actual server address instead of a loopback address, and check that the required ports are reachable from the remote client. Docker networking and firewall behavior vary by deployment.
  • FFmpeg reports errors, or YouTube rejects the stream: Check FFmpeg’s output for input, timestamp, and codec issues, then inspect YouTube stream health. If the source codecs are incompatible, stream copy will not fix them; transcoding may be necessary. The cited setup pages do not establish a tested transcoding command for a particular input file.
  • The video does not repeat: Confirm that -stream_loop -1 is present before the input option and that FFmpeg is still running. The SRS example documents that option for indefinite looping, not automatic recovery from a stopped process.

Copyright and channel-policy checks before looping

A technical loop does not grant permission to rebroadcast a recording. Before putting a prerecorded video on a public live stream, confirm that you hold the necessary rights to the video, music, and any other included material, and review YouTube’s current rules for live streaming and monetization. Do not assume that repeating a file changes its copyright status or makes reused material eligible for monetization. Use YouTube’s Live Control Room and channel notices to check for restrictions or stream-health problems.

For a pre-stream review, use the copyright safety checklist; it is a preparation aid, not permission or a guarantee against claims.

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.

Or let it run in the cloud

If your goal is simply to keep uploaded video playing on a YouTube channel, StreamNeo is a hosted alternative to maintaining an Ubuntu server and an SRS relay. Upload a recording or build a playlist, add your YouTube stream key once, and go live. StreamNeo loops uploaded videos from the cloud, so your computer and home connection do not have to stay on. Each slot streams the uploaded quality up to 4K 60fps at one flat price per slot, with no re-encode or quality tiers; it can automatically recover if YouTube drops the stream. The first day is free with no card, one free day per account. Monthly pricing is $9.99 per month. StreamNeo is for YouTube streams of uploaded videos, not camera broadcasts. See StreamNeo, or start the free first day.

Frequently Asked Questions

Does the SRS Docker example by itself stream to YouTube?

No. It starts SRS and accepts a publisher stream; the documented example does not configure an outbound relay to YouTube.

Do I need SRS to loop a prerecorded video on YouTube Live?

No. You can publish from an encoder directly to the RTMPS URL and key supplied in YouTube Live Control Room. SRS is relevant if you specifically need its intermediate-server or local-playback role.

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 the Screening Room

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.