October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Add a Static Overlay to an Nginx RTMP YouTube Stream with FFmpeg

Read an RTMP feed and a static image with FFmpeg, composite them with the overlay filter, then publish to YouTube using the current ingest settings.
Length7 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To add a static logo or other image to an Nginx RTMP stream, have FFmpeg read the incoming RTMP feed and the image, combine them with its overlay filter, encode the composited video, and publish the result to YouTube using the ingest URL and stream key shown in your YouTube live setup. The command below is a starting pattern, not a tested, universal recipe: check your FFmpeg build, local RTMP address, image-loop behavior, and YouTube settings before broadcasting.

How the overlay pipeline works

Nginx-RTMP receives the original stream; FFmpeg reads that stream along with a static image, composites the image over the video, then sends the processed output to YouTube. The FFmpeg filter reference explains that the first input is the main video and the second is placed over it. A transparent PNG works well for a logo because transparent areas leave the picture visible. FFmpeg Filters Documentation

Because the video frames change when the overlay is composited, the output video must be encoded. -c:v copy cannot preserve an overlay. Audio can sometimes be copied, but only if its codec and parameters are accepted by YouTube; the example encodes it as AAC instead.

Prepare the image and stream settings

  • Use an image file that the account running FFmpeg can read. Check its dimensions, transparency, and legibility at the output resolution.
  • Choose a position that does not obscure important game action, subtitles, or other on-screen information. The example uses a fixed position ten pixels from the top and left.
  • Confirm the local RTMP input URL and application name in your Nginx-RTMP configuration, and obtain the current ingest URL and stream key from YouTube’s live setup. Do not publish or expose the key.
  • Make sure FFmpeg includes the overlay filter and the encoder you plan to use, such as libx264. Check the installed binary and its logs rather than assuming every package or build has the same options.

Run FFmpeg as a separate process

For a straightforward setup, publish your source to Nginx-RTMP, then run FFmpeg separately to pull that local stream, add the image, and send the result directly to YouTube. Replace every example address, path, key, and encoding value with the settings for your installation.

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.
ffmpeg 
  -i 'rtmp://127.0.0.1:1935/live/STREAM' 
  -loop 1 -i '/path/to/logo.png' 
  -filter_complex '[0:v][1:v]overlay=10:10[v]' 
  -map '[v]' -map '0:a?' 
  -c:v libx264 -preset veryfast -tune zerolatency 
  -pix_fmt yuv420p -g 60 
  -c:a aac -b:a 128k 
  -f flv 'rtmp://a.rtmp.youtube.com/live2/STREAM_KEY'
  1. Replace rtmp://127.0.0.1:1935/live/STREAM with the local Nginx-RTMP URL for the incoming publish.
  2. Replace /path/to/logo.png with the readable image path. The example uses -loop 1 to keep a still-image input available, but looping and end-of-file behavior can vary by demuxer or build. Check ffmpeg -h demuxer=image2 or the installed manual, then test locally.
  3. Adjust overlay=10:10 to set the image’s x/y position. For a transparent logo positioned ten pixels from the lower-left corner, FFmpeg documents an expression-based example; consult the filter reference for supported expressions. If input timestamps do not align, FFmpeg advises considering setpts=PTS-STARTPTS; verify timestamp behavior against your live source.
  4. Set the frame rate, video bitrate, audio options, and GOP for your stream profile. In this example, -g 60 corresponds to a two-second keyframe interval only when output is 30 fps.
  5. Replace the destination with the ingest URL and stream key from your current YouTube live setup. YouTube recommends RTMPS, a secure extension to RTMP; use the currently provided destination and verify the platform’s settings before a production broadcast. YouTube live encoder guidance

Keep the stream key private. Avoid placing it in screenshots, public examples, shell history, or configuration readable by other users. If you run FFmpeg as a service, manage the key and logs so they are not exposed to unintended users.

Choose bitrate, frame rate, and keyframes for YouTube

YouTube’s live encoder guidance currently lists RTMP/RTMPS ingest; H.264, H.265, or AV1 video; up to 60 fps; constant bitrate (CBR); AAC or MP3 audio; and a recommended two-second keyframe interval, with a four-second maximum. It recommends RTMPS. These platform recommendations can change, so check the official page again before a broadcast. The ranges below are YouTube’s H.264 recommendations as shown on the page accessed in 2026:

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.
Output profile YouTube H.264 recommended video bitrate
1080p at 30 fps 5–14 Mbps
1080p at 60 fps 6–17 Mbps
720p at 30 fps 3–8 Mbps
720p at 60 fps 3–8 Mbps

Choose a point within the relevant range based on resolution, frame rate, encoding behavior, and stable available upload bandwidth. Set a two-second GOP in frames: for example, 60 frames at 30 fps or 120 at 60 fps. The sample command’s -g 60 is not a two-second interval at every frame rate. If you change output frame rate, recalculate and verify the keyframe interval. Configure CBR as appropriate for your encoder and inspect the actual output; the sample command is intentionally a starting point, not a complete profile for every stream.

Let Nginx-RTMP start FFmpeg on publish

Instead of supervising FFmpeg as its own service, you can configure Nginx-RTMP’s exec_push in the application receiving the source. The module documentation says it runs a command for each published stream, supports $app and $name substitutions, and can be used for FFmpeg transcoding and republishing. The child process is terminated when publishing stops. nginx-rtmp directives

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.

This is a lifecycle choice, not a different compositing method: the FFmpeg command still needs to read the source, apply the overlay, encode the video, and publish to YouTube. Use the full FFmpeg binary path where practical, confirm the Nginx process can execute it and read the image, and inspect logs and restart behavior. Nginx normally clears its environment, which may affect executable lookup through PATH. Commands in configuration are process arguments; quote paths and filter expressions for the syntax of your installation, then validate configuration with nginx -t and test on a controlled stream. The directive wiki describes module behavior, but packaged builds and forks can differ, so verify against the version actually installed.

When an Nginx relay is involved

If FFmpeg sends the processed stream to another Nginx-RTMP application, that output application can use the push directive to publish it to a remote server. push forwards a stream; it does not add the image. The module documents push_reconnect as the delay used when reconnecting after a disconnect. Confirm the destination address and key from your current YouTube stream setup rather than relying on old examples.

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

A historical module issue shows a YouTube push example, but it is a user discussion from 2016, not current YouTube ingest guidance. Treat it only as an illustration of relay structure. nginx-rtmp issue #781

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

Test and monitor before going live

  1. Run a short controlled test with the same resolution, frame rate, audio, and motion you expect to broadcast. YouTube recommends pre-event testing with similar content and monitoring stream health. YouTube live encoder guidance
  2. Check FFmpeg output for missing image files, unavailable filters or encoders, RTMP connection errors, timestamp warnings, and dropped frames.
  3. Confirm the logo appears in the intended position, the picture is not cropped unexpectedly, and audio remains continuous.
  4. Watch CPU use and available upload bandwidth while encoding. Re-encoding video takes processing capacity; leave headroom for the chosen resolution and frame rate.
  5. Confirm YouTube receives the stream and reports healthy status before relying on it for a longer broadcast.

Troubleshooting common overlay failures

Symptom Likely cause What to check or change
FFmpeg cannot open the logo The path is wrong, permissions prevent reading, or the service user sees a different filesystem location. Check the exact path and confirm the user running FFmpeg can read the image.
The image appears briefly or disappears The still-image input is not being looped as expected by the installed demuxer/build. Verify -loop 1 using the local image2 demuxer help or manual, then test a short run.
No overlay or filter error The FFmpeg build may lack the filter, the filter graph may be malformed, or input streams may differ from expectations. Check the installed FFmpeg filter list and logs; verify the two input indexes and filter expression.
Video reaches YouTube but is rejected or unhealthy The output settings, ingest address, key, or connection may not match the current live setup. Recheck YouTube’s ingest details and current encoder guidance, including codec, bitrate, CBR, frame rate, and keyframe interval.
Audio is missing or incompatible The source may not contain audio, or its stream format may not be accepted downstream. The optional map 0:a? permits no audio stream; for audio that must be compatible, encode to an accepted format such as AAC and check logs.
FFmpeg stops when the source disconnects The input ended or Nginx-RTMP terminated a managed child after publishing stopped. Check process logs and supervision or reconnect behavior. If relying on module directives, confirm them for your installed version.
Frames drop or the stream becomes unstable under load The server may lack CPU capacity for the selected encode, or upload bandwidth may be insufficient or inconsistent. Monitor CPU, dropped frames, and network capacity during a representative test; adjust the output profile to available resources.

Or let it run in the cloud

If your goal is to keep a YouTube channel live with uploaded videos rather than add an overlay to an incoming camera or game feed, StreamNeo is a different option: upload a recording or build a playlist, add your YouTube stream key once, and go live. It loops uploaded videos from the cloud, so nothing has to stay on at home. It does not process a live camera feed or add an overlay to this Nginx-RTMP workflow.

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.
  • No home computer or connection has to stay on.
  • Any uploaded quality up to 4K 60fps streams as made, at one flat price per slot.
  • It automatically recovers if YouTube drops the stream.
  • The first day is free with no card.
  • Monthly: $9.99 per month.

See StreamNeo, or start the free 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.

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 quests from Patch Notes

  1. How To Create Custom Stickers & Shoutouts In Monster Hunter WildsMonster Hunter WildsBlog20min
  2. How to Get XL Gogoat in Pokemon Legends Z-A (An Extra-Large Gogoat)Pokemon Legends Z-ABlog20min
  3. How to Get Rotting Lightbringer in Diablo 4Diablo 4Blog17min
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.