Use FFmpeg to publish a video into a MediaMTX path, then configure MediaMTX to forward that path to YouTube Live. In Docker, keep MediaMTX’s YAML configuration on the host, expose only the listener FFmpeg needs, and use YouTube’s currently displayed stream URL and key. This setup can relay a looped file, but it does not guarantee the broadcast survives every container, network, or YouTube failure.
How the Docker setup fits together
The flow is video source → FFmpeg → MediaMTX path → YouTube Live ingest. FFmpeg reads and publishes the media; MediaMTX acts as the server and proxy that receives it and forwards it onward. MediaMTX can also serve configured paths when a publisher is offline, but that capability alone does not keep a YouTube broadcast live through an upstream or account failure.
MediaMTX describes RTSP as its recommended method for FFmpeg publishing. It also documents RTMP and other publishing protocols. The examples below show the RTSP path; use a service name or reachable host address—not localhost—if FFmpeg runs in a different container from MediaMTX.
Prepare Docker and a persistent configuration
Choose the host and network
Run the containers on a machine that can remain online and reach YouTube. FFmpeg must be able to reach the MediaMTX listener for the protocol you choose. The official Docker example publishes RTSP on port 8554 and RTMP on 1935, among other ports; publish only the listeners required by your design. If both processes share a Docker network, they can generally address each other by service name rather than exposing an ingest port publicly.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
- Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
Keep configuration outside the container
MediaMTX’s Docker guide shows downloading mediamtx.yml into a local directory and mounting that directory into the container as its working configuration. This lets you edit and retain configuration independently of the container. You can also configure MediaMTX with MTX_-prefixed environment variables or its Control API; nested map settings use underscores and list settings can use numeric positions. Configuration changes are hot-reloaded without disconnecting existing clients whenever possible.
Choose an intentional image tag and record it with your deployment. The configuration reference consulted identifies MediaMTX v1.21.1; that is version context, not a claim that a floating Docker tag resolves to that build. Validate your configuration before startup with MediaMTX’s --validate-conf option.
Rank #2
- Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
Configure the YouTube forwarding path
- Retrieve current YouTube details. In YouTube’s Go Live interface, obtain the current Stream URL and stream key for the broadcast. Do not assume an endpoint copied from an older example is still current.
- Add a MediaMTX path and destination. Configure the path that FFmpeg will publish to and its YouTube forwarding destination, following MediaMTX’s forwarding guide. The guide documents separating the destination URL and key with
#. Treat the key as a credential: do not put it in public examples, screenshots, or version control. - Prefer encrypted transport, then verify it. MediaMTX recommends changing
rtmp://tortmps://for encryption in transit. Its example endpoint and certificate fingerprint are explicitly time-sensitive; the documentation reported a certificate issue when it was last checked. Verify the endpoint and certificate behavior before relying on any sample fingerprint. - Validate before starting. Run the configuration validation command, correct any reported errors, then start the container with the mounted configuration.
The exact YouTube ingest URL and certificate fingerprint can change. Use the endpoint YouTube currently displays and check the current MediaMTX guidance rather than treating example values as permanent.
Publish a looping file with FFmpeg
MediaMTX documents this RTSP publishing pattern for a file that loops indefinitely:
Rank #3
- CanaKit Raspberry Pi 5 Essentials Starter Kit
ffmpeg -re -stream_loop -1 -i file.mp4 -c copy -f rtsp rtsp://mediamtx:8554/mystream
Replace file.mp4 with the actual file path and mediamtx with the MediaMTX service name or reachable hostname. The path, here mystream, must match the path configured for forwarding. The command uses -re to read at the media’s intended real-time rate and -stream_loop -1 to repeat the input. The documented example uses -c copy, which copies the input streams rather than encoding them; it is suitable only if the source’s streams are usable by the full delivery path. The cited example does not establish which codecs or profiles YouTube will accept in your case.
Rank #4
- All-in-One Complete Kit: This SANOOV RPi 5 bundle comes with Raspberry Pi 5 4GB RAM single board, active cooler, durable ABS case and screwdriver. No extra parts needed, ready to use right out of the box for beginners and hobbyists
- Powerful Single Board Computer: Equipped with 4GB RAM and high-performance processor, delivers fast running speed for 4K playback, AI projects, programming and daily computing tasks. SANOOV for raspberry pi 5 4GB is equipped with broadcom 64 quad-core Arm Cortex A76 processor with gigabit ethernet and upgraded with IEEE 802.11ac Wi-Fi, Bluetooth 5.0 dual-band 2.4Ghz and 5Ghz and Power Over Ethernet (POE). Upgrading delivers 2-3 x speed vs Pi 4, redefining the experience
- Efficient Active Cooler: Effectively lowers operating temperature and prevents performance throttling. Runs quietly even under long-time heavy load, ensures stable operation all day long. SANOOV RPi 5 4GB kit offer an active cooler, which combines an aluminium heatsink with a high-performance PWM fan. Active cooler is fully compatible with the Pi OS, which can effectively reduce the temperature of RPi5 and ensure its good performance during long-term high load operation
- Sturdy ABS Protective Case: Well-fitted for Raspberry Pi 5 board, can be secured with 4 screws to effectively protect the Pi 5 motherboard from damage, reserves full access to all ports and buttons. SANOOV uses ABS material to produce the case, which has a softer texture and feel. Meanwhile, SANOOV case adopts a layered design for easy disassembly and installation. (Tip: The Case cannot install M.2 HAT Add on Board and Solid State Drive!)
- Wide Application & Full Compatibility: Seamlessly compatible with official OS and mainstream peripheral accessories for Raspberry Pi 5. Whether you are a beginner, student, electronics hobbyist or professional developer, this all-in-one kit meets your diverse needs. It excels in IoT projects, robotics design, retro gaming devices, home media servers and other DIY creations. Backed by a large global community, you can easily find guides, technical support and shared projects online
If you choose RTMP instead, MediaMTX documents the corresponding publishing form as ffmpeg -re -stream_loop -1 -i file.mp4 -c copy -f flv rtmp://mediamtx:1935/mystream. RTSP is the method MediaMTX recommends for FFmpeg publishing; neither example establishes a universal latency or quality advantage.
Check audio and video tracks
MediaMTX’s YouTube forwarding guidance warns that YouTube requires both a video and an audio track, and that video-only streams are silently rejected. Confirm that the source has both tracks. If it does not, configure FFmpeg to provide a valid audio track appropriate to the program; the requirement is for an audio track, not necessarily audible program material.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteBest Value
- 【What you Get】You will get 1*Pi 5 8GB Single Board,1*RasTech Case,1*Active Cooler,1*Screwdriver,1*Installation instructions,12-month free warranty, lifetime service, 24-hour prompt and friendly response.
- 【More Connectors】There are two USB 3.0 ports(5Gbps simultaneously) and two USB 2.0 ports, which triple total bandwidth ,support any combination of up to two cameras or displays. Peak SD card performance is doubled through support for the SDR104 high-speed mode. It provides a smooth desktop experience for you. Offer Gigabit Ethernet and a PCIe interface, along with dual-band Wi-Fi and Bluetooth 5.0/BLE wireless capability. The RasTech Pi 5 Kit use the new 27W 5.1V 5A USB-C power connector.
- 【 Support Dual 4Kp60 Display 】Each of the two microHDMI sockets can control a 4K display at 60 Hertz, now support HDR, offering super HD video for media streaming projects. RPi 5 is the first RPi model that comes with a PCI Express port (PCIe 2.0 x1 with 500 MB/s) to attach SSDs (requires separate M.2 HAT).
- 【 Excellent Chips And Applications】Pi 5 is a full-size Pi computer using silicon built in-house at Pi. The RP1 “southbridge” provides the bulk of the I/O capabilities for Pi 5. Pi 5 is more friendly and convenient in the development of Internet of Things, Web development, machine identification, automatic control and other electronic equipment applications and network.
- 【 Faster CPU, Better GPU 】 Pi 5 features a Broadcom BCM2712 64-bit quad-core Arm Cortex-A76 processor running at 2.4GHz, it delivers a 2–3× increase in CPU performance relative to RaspberryPi 4. The 800MHz VideoCore VII GPU is compatible to OpenGL ES 3.1 and Vulkan 1.2, substantial uplift in graphics performance. Pi 5 Offers lightning-fast CPU speed, a PCI Express interface, a Real Time Clock (RTC) and a power button and runs significantly cooler than Pi 4.
Verify the broadcast and keep it running
- Start MediaMTX with the validated configuration and confirm the container is running.
- Start FFmpeg and check its output for publishing or connection errors. Confirm that it is publishing to the expected MediaMTX path.
- Check MediaMTX logs and, if useful for your setup, its metrics to diagnose whether the publisher and forwarding connection are present.
- Use YouTube’s live preview and status to verify that the stream arrives with both audio and video before relying on it.
- For recovery after a process or host restart, arrange for your container runtime or host service manager to restart the relevant processes, and confirm that the source file and configuration remain available. This is operational guidance; the documentation cited here does not establish a complete monitoring procedure or uptime guarantee.
Common problems and fixes
- FFmpeg cannot connect to MediaMTX: Check that the listener is enabled and reachable on the selected port. In separate containers, use the MediaMTX service name on their shared Docker network instead of
localhost; if connecting across hosts, verify the address and firewall rules. - YouTube does not receive a broadcast: Confirm the current YouTube Stream URL and key, the configured MediaMTX destination, and that the incoming publication uses the path MediaMTX is forwarding. A stale endpoint or key can invalidate an otherwise correct setup.
- The stream is silently rejected or has no usable preview: Check that both audio and video tracks reach the forwarding path. The MediaMTX forwarding guide specifically warns about video-only streams.
- Stream copy fails or the output is unsuitable: The example’s
-c copydoes no transcoding. Inspect the input streams and determine whether they are appropriate for the destination; the cited examples do not provide a universal codec recipe or YouTube bitrate, resolution, frame-rate, or keyframe settings. - Encrypted forwarding fails certificate checks: Verify the current endpoint and certificate behavior. Do not blindly copy a fingerprint from the MediaMTX example, which the documentation identifies as a workaround for an issue seen at its last check.
- Configuration changes do not take effect: Confirm the host configuration directory is mounted where the container expects it, validate the YAML, and inspect MediaMTX logs. Hot reload is supported where possible, but not guaranteed for every change.
What this setup does—and does not—specify
The cited MediaMTX and FFmpeg guidance establishes the relay workflow and looping command, but it does not establish YouTube’s current recommended bitrate, resolution, frame rate, keyframe interval, codec profile, account eligibility rules, or activation delays. Do not infer those values from an FFmpeg example. Check YouTube’s current live-stream guidance for the requirements applicable to your account and stream.
No deployment or performance test is represented here. Your results depend on the source media, FFmpeg build, container networking, host, and current YouTube ingest details.
Or let it run in the cloud
If your goal is a YouTube channel supplied by uploaded videos, StreamNeo is a simpler alternative to maintaining an FFmpeg-and-MediaMTX host: upload a recording or build a playlist, add your YouTube stream key once, and go live. StreamNeo loops uploaded video in the cloud, so nothing has to stay on at home. It streams the uploaded quality up to 4K 60fps at one price per slot, automatically recovers if YouTube drops the stream, and the first day is free with no card. Monthly pricing is $9.99 per month.
Quick Recap
See StreamNeo or start the 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.
Free tools Windows power users keep installed
One-click scans. No signup required.

