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 an FFmpeg YouTube Playlist Stream in Docker

Run an FFmpeg playlist stream to YouTube Live from Docker with a Compose service, RTMPS settings, a protected stream key, and practical troubleshooting.

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

You can run an FFmpeg playlist stream in Docker by mounting the playlist and its media into a container, making FFmpeg the container’s foreground process, and sending its output to the server URL and stream key from YouTube Studio. The example below loops a local FFmpeg concat-demuxer playlist, transcodes it to H.264 and AAC, and uses Docker Compose’s unless-stopped restart policy. Check that your files are compatible and test the stream in YouTube Live Control Room before relying on it: a restart policy alone does not confirm that YouTube is receiving a healthy stream.

Before you start

  • A YouTube channel eligible to livestream. YouTube’s current guidance says the channel must be verified, have no live-streaming restrictions in the past 90 days, and belong to someone at least 16 years old. Check your account’s status in Live Control Room; eligibility is account-specific.
  • Docker Engine and the Docker Compose plugin on a computer or server that can stay online and has stable upload bandwidth. A VPS is optional, not a requirement.
  • Local video files and a playlist file describing them. This example uses FFmpeg’s concat demuxer; it is not a universal recipe for every playlist format.
  • A YouTube stream created in YouTube Studio, with its ingestion server URL and stream key.
  • Video and audio rights for every item in the playlist.

FFmpeg options and available encoders depend on the FFmpeg build. The commands below assume that the build includes libx264 and AAC encoding. Check your build with ffmpeg -encoders before using those codec names.

Choose output settings for YouTube

YouTube recommends RTMPS, a secure extension of RTMP. Its encoder guidance supports H.264, H.265/HEVC and AV1 video, AAC or MP3 audio, constant bitrate (CBR), up to 60 fps, and a recommended two-second keyframe interval (no more than four seconds). The example uses H.264 and AAC because those are widely supported choices, not because they are required for every stream.

For H.264, YouTube Help’s encoder table, accessed 2026-10-03, gives these recommended bitrates and minimums. They are platform recommendations, not guarantees of quality or a substitute for testing your 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.
Resolution and frame rate Recommended bitrate Minimum bitrate
720p at 30 fps 3 Mbps 2 Mbps
720p at 60 fps 8 Mbps 3 Mbps
1080p at 30 fps 14 Mbps 5 Mbps
1080p at 60 fps 17 Mbps 6 Mbps
1440p at 30 fps 21 Mbps 7 Mbps
1440p at 60 fps 34 Mbps 8 Mbps
4K at 30 fps 42 Mbps 11 Mbps
4K at 60 fps 50 Mbps 14 Mbps

Choose a resolution and frame rate your source can sustain, then make sure your stable upload capacity has room for the video, audio, and network variation. The sample command targets 720p at 30 fps and 3 Mbps video. Change its scale, frame-rate, bitrate, and keyframe settings together if you target another row in YouTube’s table.

Prepare a concat playlist and media folder

Arrange the files

Use a directory such as stream/ with this structure:

stream/
├── compose.yaml
├── Dockerfile
├── playlist.txt
└── media/
    ├── first.mp4
    └── second.mp4

Write paths in playlist.txt as paths inside the container. For this example, the list file contains:

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.
file '/media/first.mp4'
file '/media/second.mp4'

The concat demuxer works best when the listed files have matching streams and compatible codec parameters, such as the same video and audio codecs, dimensions, frame rate, and sample rate. Inputs that differ can cause timestamp, playback, or decoding problems. Validate the files and test the actual playlist. If your source is an M3U playlist or another format, use an FFmpeg input method appropriate to that format instead of assuming this list syntax applies.

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

Build the container and configure Compose

Create an FFmpeg image

This example builds a small Debian-based image and installs the distribution’s FFmpeg package. Package versions and enabled encoders vary by distribution release; check that the installed build has the encoders this command uses.

FROM debian:stable-slim
RUN apt-get update 
    && apt-get install -y --no-install-recommends ffmpeg ca-certificates 
    && rm -rf /var/lib/apt/lists/*

Provide the stream key as a Docker secret

In the Compose project directory, create a file named youtube_stream_key.txt containing only the stream key. Restrict its permissions to the account that runs Docker, and add it to .gitignore so it is not committed. Compose secrets mount the file into the container; the command reads it at startup rather than putting the key in the image or Compose environment.

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.

Use this compose.yaml. Replace YOUR_YOUTUBE_INGESTION_HOST with the host from YouTube Studio, without the protocol prefix. YouTube’s server URL can vary; use the exact server and protocol shown for your stream. The example constructs an RTMPS destination from that host and appends the secret key.

services:
  playlist-stream:
    build: .
    restart: unless-stopped
    volumes:
      - ./playlist.txt:/playlist/playlist.txt:ro
      - ./media:/media:ro
    secrets:
      - youtube_stream_key
    command:
      - /bin/sh
      - -ec
      - |
        key="$$(cat /run/secrets/youtube_stream_key)"
        exec ffmpeg -hide_banner -loglevel warning 
          -re -stream_loop -1 -f concat -safe 0 -i /playlist/playlist.txt 
          -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2,fps=30" 
          -c:v libx264 -preset veryfast -b:v 3000k -minrate 3000k -maxrate 3000k -bufsize 6000k -g 60 -keyint_min 60 -sc_threshold 0 
          -c:a aac -b:a 128k -ar 44100 
          -f flv "rtmps://YOUR_YOUTUBE_INGESTION_HOST/live2/$$key"

secrets:
  youtube_stream_key:
    file: ./youtube_stream_key.txt

Here, -re reads the file at its normal playback rate rather than sending it as fast as possible. -stream_loop -1 asks FFmpeg to repeat the concat input indefinitely; test this behavior with your FFmpeg build and playlist. The video filter scales to fit 1280×720 while preserving the source aspect ratio, adds padding where necessary, and outputs 30 fps. The 60-frame GOP at 30 fps sets a two-second keyframe interval. The bitrate flags configure a 3 Mbps CBR-style target with a 6 Mbps buffer. If an input has no audio, or the files have incompatible streams, adjust the input or filtering strategy rather than expecting this command to handle every case.

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.

The stream key is still a sensitive credential even when stored as a secret. Do not bake it into an image, commit it, paste it into a public issue, or include it in diagnostic output. Docker documents secrets as the mechanism for sensitive values; environment variables are not a substitute for secret handling.

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

Create the YouTube stream and go live

  1. In YouTube Studio, create or open the intended live stream in Live Control Room.
  2. Copy the ingestion server URL and stream key shown for that stream. Use the RTMPS server when available, and put the key in youtube_stream_key.txt as described above.
  3. Build and start the service from the directory containing compose.yaml:
    docker compose up -d --build
  4. Open the YouTube Live Control Room preview and confirm that video and audio arrive and that stream health is acceptable. For a scheduled event, start the live event in Control Room when the preview is ready, as appropriate for that stream configuration.
  5. Run a representative test with motion and audio, then inspect the result before making a public stream dependent on it. YouTube recommends testing and monitoring stream health.

Keep the stream running and stop it deliberately

Docker Compose’s unless-stopped restart policy restarts the container after an exit unless you deliberately stopped it. Docker’s restart-policy documentation treats startup as successful for applying the policy once the container has been up for at least 10 seconds; after a manual stop, unless-stopped does not restart it when the Docker daemon restarts. This policy helps recover a failed FFmpeg process, but it cannot prove that YouTube is receiving a healthy stream or resolve every network problem.

To stop the encoder intentionally, run docker compose down from the project directory and check Live Control Room to confirm the event has ended. YouTube’s encoder workflow distinguishes stopping encoder content from using the control-room end-stream action, so complete the appropriate end action for your event.

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

Troubleshooting

  • The container exits immediately: Inspect the logs with docker compose logs --tail=100 playlist-stream. Check for a missing playlist or media mount, misspelled paths, malformed concat entries, an unreadable secret, or FFmpeg options unsupported by the installed build.
  • YouTube does not show an incoming stream: Confirm the server URL and stream key in Live Control Room, that the destination uses the expected RTMPS host and path, and that the key file contains no extra whitespace or accidental characters. Treat the key as a password; rotate it in YouTube Studio if it has been exposed.
  • The preview is black, silent, or distorted: Check that each playlist entry points to a decodable file and that the files have compatible streams. Confirm that audio is present and that the selected encoder exists in the FFmpeg build. Test a single source file before testing the complete playlist.
  • The stream buffers or health is poor: Compare the chosen bitrate with YouTube’s recommendation for the selected H.264 resolution and frame rate. Test stable upload capacity and lower resolution, frame rate, or bitrate if the connection cannot sustain the output.
  • The playlist does not repeat cleanly: Confirm the concat demuxer syntax, input paths, and stream compatibility. Looping behavior depends on playlist type, FFmpeg build, and media characteristics; a restart policy is not a substitute for correcting input or loop configuration.
  • The container restarts but the stream still fails: Review FFmpeg logs and YouTube stream health separately. Docker can restart a process that exits, but it does not guarantee recovery from a connection or ingestion problem while the process remains running.

Copyright and monetization are separate checks

YouTube scans live streams for third-party content. A detected match can replace the stream with a placeholder, and continued use can interrupt or terminate the stream. If you have a licence for third-party content, the rights holder may need to add your channel to its Content ID allowlist. Clear rights for both video and audio before streaming; YouTube’s livestream terms require the provider to have the necessary rights.

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.

Technical success does not establish monetization eligibility. YouTube’s Partner Program policy applies to live streams; its July 15, 2025 clarification renamed “repetitious content” as “inauthentic content” and says monetized content should be original and authentic. Mass-produced or repetitive content may be ineligible. A playlist loop’s treatment depends on its content and presentation, so automation is not a guarantee of monetization.

Or let it run in the cloud

If you do not want to maintain a Docker host, StreamNeo is a cloud option for keeping a YouTube channel live from uploaded videos: upload your recording or build a playlist, add your YouTube stream key, and go live. Nothing has to stay on at home. It streams uploaded files—not a camera feed—and supports any quality up to 4K 60fps as uploaded, at one flat price per slot. It can automatically recover if YouTube drops the stream. The first day is free with no card; the monthly option is $9.99 per month. UPI and cards are available in India; card checkout is available worldwide.

Learn about StreamNeo, or start your free first 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
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver 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.