October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
DocumentaryTube
FFmpeg

How to Rotate a Folder of Videos in an NGINX RTMP YouTube Stream

NGINX RTMP does not automatically turn a folder into a looping playlist. Use playlist logic with FFmpeg, then configure NGINX and YouTube Live for a tested continuous stream.

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

To rotate videos from a folder on YouTube Live, use a playlist or script to choose and sequence the files, use FFmpeg to publish a continuous stream, and use NGINX RTMP as an ingest or relay point if your setup needs it. NGINX RTMP’s documented VOD playback is not the same as a folder-watching playlist: its play feature does not, by itself, establish a policy for cycling through arbitrary files. The exact playlist mechanism and recovery behavior depend on your operating system, FFmpeg build, media files, and configuration.

How the folder-to-YouTube pipeline works

Think of the setup as separate jobs rather than asking NGINX to discover and rotate files:

  1. Select and order files. A playlist or script decides which videos play, in what order, whether the sequence repeats, and what to do when a file is missing.
  2. Make one continuous feed. FFmpeg reads the selected files and emits a stream. If files differ in codecs, dimensions, frame rates, aspect ratios, or audio layout, simply copying their streams may not work; encoding may be necessary. Check the actual files and test transitions.
  3. Ingest or relay the feed. NGINX RTMP can receive or relay an RTMP feed. Its documented features include VOD playback, external program execution, and pushing streams to remote destinations, but those features do not guarantee a particular folder-rotation implementation. The module README describes the RTMP URL shape as rtmp://host/app/name, where app corresponds to an application block in the configuration. See the nginx-rtmp-module README.
  4. Send the stream to YouTube. Use the server URL and stream key from YouTube Live Control Room in the publishing encoder. You can publish from FFmpeg directly or route through NGINX, depending on your design.

For a small library that changes infrequently, a static playlist is often simpler to reason about than a folder scanner. That is an implementation choice, not a behavior guaranteed by NGINX RTMP: test end-of-file transitions, missing files, and what happens when you edit the playlist while the stream is running.

Choose where FFmpeg runs

FFmpeg publishes; NGINX receives or relays

In this arrangement, the playlist mechanism launches FFmpeg as the publisher. FFmpeg sends its output to an NGINX RTMP application, and NGINX can relay or push the stream onward if configured to do so. This keeps playlist sequencing in the component responsible for selecting the files.

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.

Plan process supervision explicitly: decide how FFmpeg starts, how you detect an exit, and whether a failure should restart the process or require operator action. Neither the reviewed NGINX module documentation nor the general feature descriptions establish reliable handling for every bad file, folder change, or restart scenario.

NGINX launches FFmpeg with an external-program directive

The nginx-rtmp-module README documents external program execution, including FFmpeg processing examples. This can place process launch under NGINX’s control, but it does not make NGINX a playlist manager. The external command still needs a playlist or script with defined ordering and error handling. The module’s README also says Windows support is limited and exec is unsupported there, so do not assume an exec ffmpeg configuration will work on a Windows build. See the module documentation.

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.

For NGINX Plus, F5 documents a separate dynamic-module installation and configuration path; it is not interchangeable with building the community module against open-source NGINX. Follow the instructions for the exact distribution and module you installed in F5’s NGINX RTMP documentation. Where appropriate, validate a configuration with nginx -t before applying it. F5’s page describes nginx -s reload in its NGINX Plus module workflow; do not treat that as a universal installation recipe for every community build.

Prepare YouTube Live and the stream key

  1. Get the destination details. In YouTube Live Control Room, obtain the server URL and stream key for the stream. Enter those values in the encoder or relay destination you have configured.
  2. Prefer RTMPS when supported. Use the RTMPS URL provided by YouTube and confirm your encoder supports it. YouTube recommends RTMPS for encrypted transport. Its guidance says: “We recommend streaming to YouTube Live with RTMPS, a secure extension to the popular RTMP streaming video protocol.” See YouTube’s encoder settings guidance.
  3. Protect the key. Treat the stream key like a password. Do not put it in a public playlist, shared screenshot, or public repository. If it is exposed, YouTube documents resetting it in Live Control Room; see Manage live stream settings.

Match the encoder settings to YouTube

YouTube’s current RTMP/RTMPS encoder guidance lists H.264, H.265/HEVC, or AV1 video; frame rates up to 60 fps; AAC or MP3 audio; and constant bitrate (CBR) encoding. It recommends a 2-second keyframe interval and says not to exceed 4 seconds. These are platform recommendations, not a guarantee that a particular source file or server will perform correctly. Check the current Live Control Room settings and stream-health feedback before relying on the setup. The guidance includes bitrate recommendations by resolution, frame rate, and codec; use the applicable row there rather than assuming one bitrate suits every file or output format: Choose live encoder settings, bitrates, and resolutions.

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.

If all files have compatible streams, a stream-copy approach may avoid another encoding step; if their video or audio properties differ, a normalized output may require encoding. Confirm the result with representative files, including a transition between two different videos. Set the output frame size, frame rate, audio format, bitrate mode, and keyframe interval to a combination supported by your encoder and accepted by YouTube.

Build and validate the rotation before going public

  1. Confirm the installed components. Verify that the NGINX build actually includes the RTMP module and that the FFmpeg executable and any playlist mechanism are available on the host. Community-module builds and NGINX Plus module installations follow different paths.
  2. Define playlist behavior. Specify order and repeat behavior, and decide what the process should do if a file is absent, unreadable, or ends unexpectedly. Decide whether additions or edits should apply immediately or only after restarting or reloading the playlist process; dynamic folder watching is not established by the module documentation.
  3. Check the NGINX configuration. Run nginx -t where applicable and address errors before starting the publisher. Use the configuration and reload procedure appropriate to your NGINX distribution.
  4. Run a private or short test. Include movement and audio, and let at least one file transition occur. Confirm that playback continues, audio remains present, and the intended sequence repeats.
  5. Monitor YouTube stream health. Check the Live Control Room’s stream-health feedback and the encoder’s output while testing. YouTube itself recommends testing with representative motion and audio before going live.

Troubleshoot common rotation failures

Symptom Likely area to check What to do
The stream plays one video but never advances. The playlist or script may not be configured to move to the next file or repeat. Check the sequencing mechanism separately from NGINX VOD playback. Test a short playlist through an end-of-file transition.
The stream stops at a file boundary. The publisher may exit or fail to open the next file; the output may also change incompatibly between files. Inspect the FFmpeg process and playlist handling, test the exact adjacent files, and determine how the supervisor responds to an exit.
New files do not appear in rotation. A static playlist may not rescan the folder. Verify whether your playlist mechanism scans dynamically. If not, regenerate or reload it using the procedure your setup supports.
NGINX rejects the RTMP configuration or URL. The module may be absent, the application name may not match, or the configuration may not suit the installed distribution. Confirm the module is present, match the URL’s application component to the configured application block, and run nginx -t where appropriate.
YouTube does not receive a healthy stream. Check the destination URL, stream key, supported protocol, codec, bitrate mode, keyframe interval, and audio/video output. Use the current values from Live Control Room, prefer the supplied RTMPS URL when supported, and review YouTube’s stream-health feedback.
An exec example fails on Windows. The community module README describes Windows support as limited and says exec is unsupported there. Do not assume the Linux-oriented external-process arrangement applies to your Windows build; select a supported way to run and supervise FFmpeg.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or let it run in the cloud

If your goal is a YouTube channel that keeps uploaded videos playing without maintaining this server pipeline at home, StreamNeo is a cloud option: upload a recording or build a playlist, add your YouTube stream key once, and go live. It plays uploaded videos, not a live camera feed, and sends to YouTube only.

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
  • Your computer and home connection do not have to stay on.
  • Each slot streams the uploaded file as made, up to 4K 60fps, at one flat price per slot rather than quality-based tiers.
  • StreamNeo automatically recovers if YouTube drops the stream.
  • The first day is free with no card; one free day is available per account.

Monthly: $9.99 per month. See StreamNeo for the service details, then start the free day.

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.

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 the Screening Room

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
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.