You can run a continuous YouTube Live feed from Docker by looping a rights-cleared video through FFmpeg and publishing it to YouTube’s RTMPS ingest endpoint. Docker can restart an exited container, and FFmpeg can retry some temporary output failures—but neither guarantees that video is still moving, YouTube is receiving it, or the stream will never go down. A dependable 24/7 operation needs preflight checks, monitoring, an archive plan, and a tested recovery path.
What you need before you start
This setup is for a prerecorded video feed, not a camera broadcast. You need a YouTube channel eligible to livestream, a host that can run Docker, FFmpeg in the container, a video file that FFmpeg can read, and an internet connection with enough sustained upload capacity.
- YouTube eligibility: YouTube’s live-stream help says the channel must be verified and must not have had live-stream restrictions in the previous 90 days.
- A source you may stream: Use media you own or are authorized to broadcast. A video being available online does not by itself establish permission to rebroadcast it.
- Stable host and network: The Docker host must remain powered on and connected. A UPS battery backup can help with brief power interruptions, and an Ethernet cable may suit a fixed installation; neither prevents internet or YouTube-side failures.
- Capacity: Check upload speed, not just download speed, and leave bandwidth for normal variation and other traffic.
Configure the YouTube live event
- In YouTube Studio, open Create → Go live to reach Live Control Room. Create or select the event and configure its title, visibility, audience, and other details.
- In the stream settings, obtain the server URL and stream key. The key authorizes an encoder to send video to your channel: keep it secret, do not commit it to source control, and do not include it in screenshots or public logs. If it is exposed, reset it in Live Control Room and update your encoder configuration.
- Set the audience accurately. For child-directed content, select the appropriate “made for kids” setting; do not choose based on which features you would prefer to have.
- Start the encoder before starting or scheduling the event. Wait for YouTube’s preview and stream-health indicators, then confirm the picture and sound before going live.
YouTube’s encoder workflow says streams under 12 hours are automatically archived. Do not assume that one continuously open 24/7 event will produce a complete, intact replay. Plan shorter event segments, check current archive behavior in Studio, and decide how recordings will be verified and retained.
Choose settings the connection can sustain
YouTube’s encoder guidance recommends RTMPS, constant bitrate (CBR), a two-second keyframe interval (not more than four seconds), and supported video and audio codecs. It lists H.264, H.265/HEVC, or AV1 for video, frame rates up to 60 fps, and AAC or MP3 for audio. H.264 is a practical baseline when the installed FFmpeg build can encode it; use another supported codec only if your host and workflow have been tested with it.
#1 Best Overall
- 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.
| Decision | How to choose |
|---|---|
| Resolution and frame rate | Choose a profile that suits the material and that the host can encode continuously. Higher resolution or frame rate uses more processing and upload capacity. |
| Bitrate | Use YouTube’s current range for the selected codec, resolution, and frame rate. For 1080p30 H.264, YouTube lists 5 Mbps minimum and 14 Mbps recommended; that is not a universal bitrate for other profiles. |
| Keyframes | Set an interval of two seconds where possible and never exceed four seconds. At 30 fps, two seconds corresponds to 60 frames. |
| Audio | Use a supported codec such as AAC and verify the source actually has an audio stream if your command maps audio. |
| Codec | H.264, H.265/HEVC, and AV1 are listed by YouTube; availability and sustainable encoding speed depend on your FFmpeg build and host hardware. |
YouTube’s network guidance recommends leaving 20% upload headroom. Account for the primary stream and any backup stream as well as that margin. For example, a 14 Mbps stream alone calls for at least 17.5 Mbps of usable upload capacity under a 20% headroom calculation, before accounting for other simultaneous traffic. Use sustained upload tests and real-world checks; a short speed-test result is not a guarantee of continuous capacity.
Build a small Docker service
The example below uses a local Docker build based on Debian Bookworm, installs its packaged FFmpeg, mounts one media file read-only, and publishes 1080p30 H.264 over RTMPS. It assumes the source includes audio and that the host can encode the video in real time. Review the image and package versioning strategy for your own deployment; this example is not a tested image for every host or file.
1. Create the working files
Make a directory with these files. Put the authorized video in the same directory as children-loop.mp4, or change the mount and input path consistently.
Rank #2
- 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.
Dockerfile
compose.yaml
.env
children-loop.mp4
Dockerfile:
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg ca-certificates
&& rm -rf /var/lib/apt/lists/*
.env (substitute the server URL and key shown for your event in Live Control Room; do not share this file):
YOUTUBE_RTMPS_URL=rtmps://your-server-url-from-live-control-room
YOUTUBE_STREAM_KEY=your-private-stream-key
For an RTMPS endpoint whose server URL already includes a path, enter that complete URL as provided. The command below appends the stream key, matching the usual encoder pattern; check the exact endpoint format shown in your Live Control Room rather than guessing it.
2. Define the container and encoder command
compose.yaml:
services:
stream:
build: .
restart: unless-stopped
env_file: .env
volumes:
- ./children-loop.mp4:/media/children-loop.mp4:ro
command:
- sh
- -c
- >-
exec ffmpeg -hide_banner -nostdin -re -stream_loop -1
-i /media/children-loop.mp4
-map 0:v:0 -map 0:a:0
-c:v libx264 -preset veryfast -b:v 14M -maxrate 14M -bufsize 28M
-r 30 -g 60 -keyint_min 60 -sc_threshold 0
-c:a aac -b:a 128k -ar 44100
-f fifo -fifo_format flv -attempt_recovery 1 -recovery_wait_time 1
"$${YOUTUBE_RTMPS_URL%/}/$${YOUTUBE_STREAM_KEY}"
The command reads the file at real-time speed (-re) and loops it (-stream_loop -1). It encodes H.264 at the 1080p30 recommended bitrate cited above, fixes the frame rate at 30 fps, and uses a 60-frame GOP for a two-second keyframe interval. AAC audio is encoded at 128 kbps. The FFmpeg FIFO muxer is configured to attempt recovery after temporary output failures, waiting one second between attempts. These are example settings, not a guarantee that the source, encoder, connection, or YouTube ingest will remain healthy.
Rank #3
- 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.
If the video is not 1080p, is not 30 fps, contains variable frame rate, or lacks audio, adapt and test the mapping and encoding settings rather than assuming this profile is suitable. Confirm that the container’s CPU can sustain the encode; a process that falls behind real time is not a successful 24/7 stream. FFmpeg options can vary by build, so check the installed FFmpeg help and logs if an option is rejected.
3. Build and start, then verify the whole path
- From the directory containing the files, run
docker compose build. - Start the service with
docker compose up -d. - Inspect startup output with
docker compose logs -f stream. Resolve input, codec, authentication, or connection errors before proceeding. - In Live Control Room, confirm that the preview appears and that YouTube reports a healthy incoming stream. Check the actual watch page and a mobile playback path before treating the setup as ready.
- After testing, schedule or start the event using YouTube’s controls. Keep observing the host, FFmpeg logs, and YouTube stream health.
To stop the service intentionally, use docker compose down. Because this Compose service uses unless-stopped, a manual stop remains stopped after Docker restarts. Use docker compose up -d when you intend to start it again.
Recommended Free Tools
What restart and retry settings do—and do not—recover
Docker’s unless-stopped policy can start the container after it exits and after a Docker daemon restart, except when an operator has manually stopped it. The always policy also restarts an exited container and starts it when the daemon restarts, including after a manual stop once the daemon restarts. Choose according to the operational meaning of “stop” for your team. Docker documents that restart-policy monitoring activates after successful startup, defined as the container running for at least 10 seconds.
Rank #4
- 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
A restart policy reacts to container exit. It does not detect frozen video, silence, a bad source file, an expired or changed key, an FFmpeg process that remains alive but is no longer making progress, or a feed YouTube rejects. FFmpeg’s FIFO output recovery can retry certain temporary network failures; it does not make every failure recoverable or promise gapless playback. Input reconnection flags apply to some network inputs and are a separate matter from recovering an RTMPS output connection.
For more critical service, use monitoring that checks actual media progress and YouTube ingest health, not only whether the container is “up.” Decide who receives alerts, who may restart the service, and when a failed recovery must be escalated.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Plan for children’s content, rights, and interaction limits
Accurately designate whether the stream is made for kids. YouTube says that designation disables or restricts features including live chat and live chat donations, comments, the notification bell, and personalized advertising; it also lists limits on features such as cards and end screens, Super Chat, and Super Stickers. Contextual ads may still appear. Do not make an operating plan depend on chat, chat moderation, or personalized-ad revenue being available.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsBest Value
- 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.
Before scheduling, confirm that you have rights to every video, music track, image, and other element in the feed. A long loop does not make copyrighted or otherwise unauthorized material safe to broadcast, and this technical setup does not determine whether a stream complies with YouTube policies or local law. The platform-feature guidance described here does not settle an operator’s legal obligations, which can depend on location, data practices, and the content itself.
Make 24/7 operation a monitored service
YouTube recommends setting up and testing encoders well before an event, checking the preview, testing a backup encoder, and monitoring audio and video during the stream. Treat the following as launch criteria, not one-time setup chores.
- Preflight: Run the full path with the actual source, RTMPS endpoint, stream key, host, and network. Confirm preview, audio, video, and watch-page playback.
- Capacity: Verify sustained upload capacity with the stream running and leave the recommended headroom. Include backup-stream bandwidth if a second encoder may be used.
- Observability: Watch FFmpeg logs and container state alongside YouTube’s stream-health display. Alert on stalled frames, missing audio, failed ingest, and unexpected restarts where your monitoring system can detect them.
- Recovery: Document who checks the feed, how to restart the container, how to refresh a compromised key, and when to switch to the backup encoder or contact the responsible operator.
- Backup: Test the backup encoder by deliberately stopping the primary encoder or interrupting its network path in a controlled test. A backup that has never been exercised is not a proven recovery plan.
- Archives: If recording locally, monitor storage growth and verify that recordings are playable. Plan event segmentation and archive checks separately from the continuous transmission.
YouTube warns that a connectivity disruption can break a stream. The host itself is also a dependency: Docker cannot keep the service online through a host shutdown, power loss, or unavailable network.
Troubleshoot common failures
| Symptom | Likely checks and response |
|---|---|
| Container exits immediately | Run docker compose logs stream. Check YAML syntax, the mounted file path, permissions, FFmpeg option support, and that the source file can be opened. |
| Container is running but preview is absent | Check the RTMPS server URL and stream key against Live Control Room, confirm outbound network access, and inspect FFmpeg’s output logs. Reset an exposed or invalid key and update .env. |
| YouTube preview appears, but the feed is unstable | Measure sustained upload while streaming, reduce the output profile or bitrate if capacity is insufficient, and preserve the 20% headroom recommendation. Check for competing traffic or intermittent network loss. |
| Video freezes or audio disappears while Docker says “up” | A running container is not proof of media progress. Inspect FFmpeg logs, source decoding, CPU load, and YouTube stream health; restart only after identifying whether the fault is the source, encoder, connection, or ingest. |
| FFmpeg cannot encode fast enough | Check host CPU load and real-time progress in the logs. Test a less demanding resolution, frame rate, or encoder preset, then verify the resulting profile and bitrate against YouTube’s current guidance. |
| Feed stops after changing the key or manually stopping it | Update the secret in the environment file and recreate the service as needed. A manual stop with unless-stopped is intentional and will not automatically resume after daemon restart; start it again explicitly. |
| Expected replay is missing or incomplete | Check the event and archive in YouTube Studio. Do not assume a single 24/7 event will be archived as one complete replay; plan shorter events and verify current archive behavior. |
Costs and operational trade-offs
Docker and FFmpeg are the core software components in this approach, but the setup still has operating costs: a host that runs continuously, power, enough upload bandwidth, storage if you keep local recordings, and time for monitoring and recovery. A second encoder or a separate network path can improve recovery options, but adds equipment, configuration, and testing work. No one configuration is best for every host, source format, or connection.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Or let it run in the cloud
If your goal is a prerecorded YouTube feed rather than operating the encoder yourself, StreamNeo is a cloud alternative: upload the video or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home; it streams the upload as made, up to 4K 60fps, at one price per slot with no quality tiers; and it automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly billing is $9.99 per month. Each slot includes 10 GB storage (pooled across active slots), looping and playlists, and StreamNeo team support; it streams to YouTube, not from a camera. Start the free first day with StreamNeo.
Quick Recap
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.




