To broadcast a prerecorded video as a YouTube Live event, run FFmpeg in a Docker container, pace the file in real time with -re, and send it to the RTMPS ingest URL and stream key from YouTube Studio. The audience sees a live broadcast event, but the source is a recording. This walkthrough assumes you have permission to broadcast the video and live streaming is enabled on your channel.
What you need before starting
- A YouTube channel with live streaming enabled. YouTube says initial enablement may take up to 24 hours.
- A prerecorded video file you have the right to broadcast.
- Docker and an FFmpeg container image suitable for your deployment. Pin a specific image version rather than relying on a moving tag.
- A stable outbound connection with enough upload capacity for the selected video and audio bitrate.
You do not need a capture card or physical encoder when the source is already a file. FFmpeg reads and sends the media; Docker supplies its runtime environment.
Create the YouTube event and get its ingest details
- In YouTube Studio, select Create → Go live. Create a stream or open Manage to schedule one.
- Set the title, audience designation, privacy, and other event details. Check the selected privacy setting before broadcasting.
- Open the stream settings in Live Control Room and copy the stream URL and stream key. Prefer the RTMPS URL YouTube provides; do not assume an endpoint from an older tutorial.
- Treat the stream key like a password. Do not publish it, commit it to source control, bake it into an image, or place it in logs.
Prepare the video and choose FFmpeg behavior
Use stream copy only when the source is compatible
Stream copy with -c:v copy -c:a copy avoids decoding and re-encoding. It is efficient, but works only when the source streams and container can be muxed appropriately for the YouTube ingest connection. FFmpeg does not convert incompatible codecs merely because they are sent to an RTMPS endpoint. Inspect the file with FFmpeg tools such as ffprobe; if the codecs or container are unsuitable, encode the video and audio to supported formats instead.
Read the file at real-time speed
Put -re before the input option -i. FFmpeg documents it as reading input at its native frame rate (a read rate of one). Without pacing, a file can be processed faster than real time, which is not the intended behavior for a live-like feed.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minute#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.
Use YouTube’s current encoder recommendations
YouTube’s encoder settings guidance supports H.264, H.265/HEVC, and AV1 over RTMP/RTMPS, frame rates up to 60 fps, constant bitrate (CBR), and AAC or MP3 audio. For RTMP/RTMPS, 5.1 audio is supported only with AAC. YouTube recommends a 2-second keyframe interval and says not to exceed 4 seconds. Select bitrate based on codec, resolution, and frame rate rather than treating one value as universal.
| Example output mode | YouTube-listed minimum ingest bitrate | YouTube-listed recommended ingest bitrate |
|---|---|---|
| 1080p30, H.264 | 5 Mbps | 14 Mbps |
| 1080p30, AV1 or H.265/HEVC | 4 Mbps | 10 Mbps |
These are recommendations on YouTube’s encoder settings page, not guarantees of picture quality or stream stability. Keep the total outgoing bitrate within the capacity of your connection.
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.
Run FFmpeg in Docker
The following is a template, not a tested command for a particular image. Replace YOUR_PINNED_FFMPEG_IMAGE with a pinned image that includes FFmpeg and supports the required RTMPS protocol. This example uses stream copy, so use it only if the input codecs and muxing are compatible.
docker run --rm
--mount type=bind,src="$PWD/video.mp4",dst=/media/video.mp4,readonly
--env YOUTUBE_RTMPS_URL
--env YOUTUBE_STREAM_KEY
YOUR_PINNED_FFMPEG_IMAGE
sh -c 'ffmpeg -re -i /media/video.mp4 -c:v copy -c:a copy -f flv "$YOUTUBE_RTMPS_URL/$YOUTUBE_STREAM_KEY"'
- Save the authorized video as
video.mp4in the current directory, or change the mount’s source path. The mount makes it available inside the container as/media/video.mp4and is read-only. - Provide
YOUTUBE_RTMPS_URLandYOUTUBE_STREAM_KEYthrough protected runtime configuration or your deployment’s secret mechanism. In this shell form,--env NAMEpasses a variable from the Docker client’s environment; ensure it is set securely before running the command. - Replace the image placeholder with your chosen pinned FFmpeg image. Confirm that its FFmpeg build supports RTMPS and that the image has the shell used in the example.
- Run the container and check its output for connection or media errors. Do not echo the key or enable logging that prints the full destination URL.
The endpoint/key arrangement can vary with the values shown in Live Control Room. Confirm whether the provided URL should be combined with the key as shown in the template. FFmpeg’s protocols documentation describes RTMPS and gives a real-time file-to-live-server example. The FLV output muxer in this template is for the RTMP/RTMPS ingest workflow; a different ingest protocol would need a different output setup.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteRank #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 you need to re-encode
When stream copy is incompatible, replace it with explicit encoding options appropriate to your source and YouTube’s current settings. A typical H.264/AAC shape is shown below, but set the bitrate, frame rate, resolution, and keyframe interval deliberately for your chosen mode; the example values are not universal:
ffmpeg -re -i /media/video.mp4
-c:v libx264 -preset veryfast -b:v 5M -maxrate 5M -bufsize 10M
-r 30 -g 60 -keyint_min 60 -sc_threshold 0
-c:a aac -b:a 128k -ar 44100
-f flv "$YOUTUBE_RTMPS_URL/$YOUTUBE_STREAM_KEY"
At 30 fps, a GOP of 60 frames corresponds to 2 seconds. The illustrative 5 Mbps video rate is the minimum YouTube lists for 1080p30 H.264, not its recommended rate, and should not be reused for other resolutions, frame rates, or codecs without checking YouTube’s current table. Verify that your FFmpeg build includes the selected encoder, such as libx264. Use audio settings suitable for the source and channel requirements.
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
Start, monitor, and end the broadcast
- Start the container and wait for the incoming stream preview in Live Control Room.
- For a scheduled event, starting FFmpeg does not necessarily make the event public. When the preview and stream health are satisfactory, select Go live in Live Control Room.
- When finished, end the event in Live Control Room and stop the containerized sender. A finite input reaches end-of-file and FFmpeg exits; that is expected for a one-pass file.
YouTube Help states: “All streams under 12 hours will be automatically archived.”
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Keep the stream key out of the image
Do not put a live key in a Dockerfile’s ENV instruction: Docker documents that ENV values persist in the resulting image. Docker’s ARG is a build-time value and is not available in the final container, but it is not a substitute for a deployment secret. Use a secret facility appropriate to your deployment or protected runtime injection, and limit who can inspect runtime configuration. Mechanisms differ by environment, so check the documentation for the orchestrator or platform you use. If the key is exposed, reset it in Live Control Room and update the runtime configuration.
Best 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.
Make it repeat only if you intend to
The command above sends the file once and exits at EOF. Repeating a video changes the editorial character of the broadcast and may make the stream effectively continuous; do not assume a one-pass command loops automatically. If you choose to configure looping, verify the exact FFmpeg option and behavior for your selected build, monitor the event, and make sure you have the rights to rebroadcast the material for the planned duration. Avoid leaving an unattended broadcast running without a clear end condition.
Copyright, audience settings, and channel rules
Only broadcast media you own or are authorized to use, including music, footage, narration, and any embedded third-party material. A prerecorded file still goes through YouTube’s live ingest and platform checks; permission to use one component does not establish rights to the rest. Set the audience designation and privacy accurately when you create the event, and review YouTube’s current policies and any applicable rights restrictions before scheduling a long broadcast. This Docker workflow does not bypass copyright enforcement or YouTube’s channel rules.
Troubleshoot common failures
| Symptom | Likely cause | What to check or change |
|---|---|---|
| No preview in Live Control Room | Wrong URL or key, blocked network path, or FFmpeg build without RTMPS support | Re-copy the RTMPS URL and key from the event settings, check outbound connectivity and container logs without exposing credentials, and verify protocol support in the selected image. |
| Preview appears but the event is not public | The scheduled event has not been manually started | When ready, select Go live in Live Control Room. |
| YouTube rejects or destabilizes audio/video | Incompatible source codec or muxing, unsuitable bitrate, or keyframe interval outside guidance | Inspect the input streams, re-encode if necessary, and match codec, bitrate, frame rate, audio, and keyframes to YouTube’s current encoder recommendations. |
| Container exits when the video ends | The finite input reached EOF | This is normal for a one-pass command. Configure a deliberate repeat workflow only if that is the intended broadcast behavior. |
| Stream key may have been exposed | Credential included in an image, logs, shell history, or shared configuration | Reset the stream key in Live Control Room and replace the protected runtime value. |
What Docker and FFmpeg do—and what they do not
Docker packages the runtime; it does not guarantee that the host computer or remote server stays available. FFmpeg handles pacing, optional encoding, and delivery; it does not manage the YouTube event’s privacy, start button, rights, or audience settings. Running on a local computer uses that computer’s network and power, while a remote host can keep the sender separate from your desk but adds hosting configuration and cost. Choose based on how much control you need and who will monitor the event.
Or let it run in the cloud
If your goal is an always-on YouTube channel rather than operating a Docker sender, StreamNeo is a cloud service that plays uploaded videos or playlists, loops them to YouTube, and does not require your computer or home connection to stay on. Upload your recording, add your YouTube stream key once, and go live. There is no FFmpeg container to maintain. Each slot supports the uploaded quality up to 4K 60fps at one flat price per slot, with automatic recovery 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. See StreamNeo, then start the free day.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →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.




