Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober 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 Now×
Skip to content
DocumentaryTube
FFmpeg

How to Shuffle Videos in a Nonstop YouTube Livestream Using FFmpeg

Randomize a concat playlist, repeat it with FFmpeg, and send the output to YouTube Live—while avoiding compatibility, key, and bitrate mistakes.

By DocumentaryTube Team 7 min read

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To shuffle local videos in a nonstop YouTube livestream, randomize their order in an FFmpeg concat script, then repeat that script as an input and send the output to YouTube Live. Shuffling sets the order; looping repeats it. The files must have compatible streams for concat, and FFmpeg must keep running on a computer with a stable internet connection.

What you need before you start

  • FFmpeg installed on a computer that can remain on and connected while streaming. The commands below use the FFmpeg command-line interface; shell syntax for creating a random list differs by operating system.
  • A folder of video files you have the rights to stream. YouTube’s copyright rules still apply to live streams, and random playback does not make copyrighted material safe to broadcast.
  • A YouTube channel with live streaming enabled, plus the current ingest URL and stream key from YouTube Live Control Room.
  • Enough upload bandwidth for the chosen output resolution and frame rate. Use YouTube’s current encoder table to choose the bitrate for that output.

The FFmpeg documentation describes rolling current development-version behavior, so check the documentation and your installed FFmpeg version if an option behaves differently.

Prepare and shuffle the file list

Choose how the order should work

A shuffle is a one-time random ordering, not a guarantee that every video plays exactly once before any video repeats. Create a fresh randomized list before you start FFmpeg. If FFmpeg later restarts and you want the same order, retain that concat script; if you want a new order, regenerate it before restarting.

Create an FFmpeg concat script

The concat demuxer reads a text file of entries such as file '/path/to/video-one.mp4', treating them as one virtual input. Put one entry per video, in the randomized order you want. Follow FFmpeg’s documented concat-script syntax for paths and escaping: spaces, apostrophes, backslashes, and unusual characters can require special handling, and filenames containing newlines are especially awkward. Do not assume that quoting rules are interchangeable between shells or operating systems.

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.

To make the shuffle, enumerate only the videos you intend to broadcast, randomize that list with a tool or short script appropriate to your operating system, then write the resulting paths in concat format. Avoid a universal copy-and-paste shuffle command: command syntax and safe filename handling vary across shells. Review the generated script before streaming to catch missing, duplicated, or incorrectly quoted entries.

Check that the videos can be concatenated

FFmpeg’s concat documentation says: “All files must have the same streams (same codecs, same time base, etc.).” In practice, clips with different stream layouts or incompatible technical properties may fail or produce artifacts at transitions. The concat demuxer can use duration information, and incorrect durations can also cause artifacts.

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.
  • Inspect the files: confirm they have compatible video and audio streams, codecs, and time bases before relying on stream copy.
  • Use stream copy only when inputs are compatible: -c copy avoids decoding and re-encoding, but it does not convert mismatched files or repair incompatible streams.
  • Normalize incompatible clips: re-encode them to a consistent set of stream properties before building the playlist. Choose a shared resolution, frame rate, codec, audio format, and time base suitable for your channel and bandwidth.

Stream copy generally reduces encoding work because it does not re-encode the media; re-encoding is the conversion path when inputs need normalization. The required computer resources depend on the files and encoding settings, so there is no single CPU or GPU requirement established here.

Repeat the shuffled playlist and stream to YouTube

Understand the input and output order

In FFmpeg, options apply to the next input or output, so placement matters. The concat script is an input; the YouTube ingest address is an output. Use the installed version’s documentation to confirm the loop option and its placement for repeating the concat input. Test the behavior with a short run before leaving it unattended: confirm that the playlist reaches its end and starts again, and that the stream remains valid at the transition.

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.

There is no single official end-to-end FFmpeg command documented for “shuffle, repeat forever, stream to YouTube.” The concat demuxer, input looping, encoding options, and YouTube output are separate building blocks. A reliable setup therefore depends on the target shell, installed FFmpeg release, clip compatibility, and output configuration. Avoid treating an untested command assembled for one environment as portable.

Configure YouTube Live output

  1. Open YouTube Live Control Room and copy the current ingest URL and stream key for the stream. YouTube supports reusable custom stream keys.
  2. Configure FFmpeg’s output to use the ingest URL and key, and select RTMPS where available. YouTube recommends the encrypted RTMPS variant for the documented RTMP workflow.
  3. Set the output codec, resolution, frame rate, bitrate, and keyframe interval to match YouTube’s current guidance. Confirm the stream appears in Live Control Room before making it public or scheduling it.
  4. Keep the key private. Treat it like a password: do not publish it in a command screenshot, shared script, public repository, or support post. If it is exposed, replace or reset it in YouTube’s stream settings.

YouTube’s encoder settings page lists H.264, H.265/HEVC, and AV1 video; AAC or MP3 audio; and constant-bitrate encoding. Its keyframe-frequency guidance is “Recommended 2 seconds Do not exceed 4 seconds.” Match the bitrate to the codec, resolution, and frame rate in the current YouTube table rather than using one number for every stream. For examples only, YouTube’s H.264 recommendations include 14 Mbps at 1080p30 and 8 Mbps at 720p30. Those figures are tied to those specific output modes, not universal targets. YouTube transcodes live streams into different viewer formats.

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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Keep the stream operating

FFmpeg is the process that reads the playlist and sends the stream. If FFmpeg exits, the computer shuts down, or the network connection fails, this basic playlist setup does not by itself provide process supervision or guarantee a restart. Arrange a way to monitor the process and restart it if needed; exact supervision and reconnection behavior depends on the operating system and implementation, so verify it rather than assuming a dropped connection will recover automatically.

Before relying on a long broadcast, test a full playlist cycle, inspect transitions, verify the stream key and ingest destination, and observe what happens after a brief network interruption. A longer playlist can take a long time to return to the same item, but a short test will not establish unattended reliability.

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.

Troubleshooting common failures

Symptom Likely cause What to check
FFmpeg cannot open a listed file A path is wrong, a filename was quoted incorrectly, or the process lacks access to the file. Open the concat script, verify each path against the actual filename, check escaping for the host shell and concat syntax, and confirm read permissions.
Playback fails or glitches at a transition Files have different streams, codecs, time bases, or inaccurate duration information. Inspect the affected clips and normalize incompatible files before relying on concat. Do not expect -c copy to repair differences.
The playlist does not repeat The input-loop option is missing, applied to the wrong input, or behaves differently in the installed FFmpeg version. Check option ordering and that version’s FFmpeg documentation, then test a short repeat cycle before a long stream.
YouTube does not receive the stream The ingest URL or stream key is incorrect, the key is stale, or the output settings are unsuitable. Copy the current values from Live Control Room, keep the key private, and check that FFmpeg’s output codec and encoding settings match YouTube guidance.
Viewers see buffering or YouTube reports encoder issues Upload capacity may be inadequate or output settings may not fit the selected codec, resolution, and frame rate. Check actual sustained upload capacity and select the corresponding bitrate from YouTube’s current encoder table. Consider a lower resolution or frame rate if necessary.
The stream ends after FFmpeg or the connection stops The basic playlist command does not supervise or restart the FFmpeg process. Check the process and network, restart FFmpeg as appropriate, and decide whether a restart should reuse the saved shuffle order or generate a new one.

Copyright and channel-policy checks

A playlist can run technically while still violating YouTube rules. Broadcast only material you own or are licensed to use, including music, footage, and any embedded third-party content. YouTube’s reused-content and monetization assessments are separate from whether a stream can be ingested; looping the same recordings does not itself establish originality or monetization eligibility. Review YouTube’s current policies for your content and channel before scheduling a continuous stream.

Or let it run in the cloud

If the goal is an always-on YouTube stream without leaving your own computer running, StreamNeo is a cloud option: upload a recording or build a playlist, add your YouTube stream key, and go live. It plays uploaded videos rather than broadcasting from a camera. Your computer and home connection do not need to stay on; uploaded quality is streamed as made, up to 4K 60fps, at one flat price per slot; and StreamNeo automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly pricing is $9.99 per month. See StreamNeo for details, then start the free first day.

Frequently Asked Questions

Does shuffling guarantee each video plays once before any video repeats?

No. It randomizes the list order; it does not guarantee a no-repeat draw across cycles.

Will FFmpeg restart automatically if YouTube drops the connection?

Not through the basic playlist setup described here; recovery requires separate process or service behavior.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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

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.