Free tools Windows power users keep installed
One-click scans. No signup required.
FFmpeg does not have a concat-demuxer setting for shuffling files or enforcing an episode cooldown. Shuffle the episode list before FFmpeg reads it, then write that order to a concat playlist. A shuffled pass plays each listed file once; if you loop the playlist, check its first and last entries to avoid an immediate repeat at the boundary.
How shuffling works with FFmpeg
The concat demuxer reads file entries in the order they appear; it does not randomize them. The practical method is to generate a randomized list outside FFmpeg and pass that list to the demuxer. Python’s random.shuffle changes a list in place, while random.sample can return a selection without replacement. See the FFmpeg concat documentation and Python 3.11 random documentation.
Create a shuffled playlist
1. Prepare the episode files
Put the videos in a dedicated videos directory beside the script below. This example looks for MP4 files and assumes portable filenames without spaces or special characters. It requires at least two files.
2. Generate the concat script
Save this as a Python script in the directory containing videos, then run it. It writes one file directive per episode in randomized order. The loop that compares the first and last entries prevents the last video of a pass from being immediately followed by the first video when the same playlist loops.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →#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.
from pathlib import Path
import random
files = sorted(Path("videos").glob("*.mp4"))
if len(files) < 2:
raise SystemExit("Put at least two episode files in videos/")
random.shuffle(files)
# Avoid an immediate repeat at the loop boundary.
while files[-1] == files[0]:
random.shuffle(files)
with open("playlist.ffconcat", "w", encoding="ascii") as playlist:
playlist.write("ffconcat version 1.0n")
for path in files:
playlist.write(f"file {path.as_posix()}n")
The shuffle is random rather than a guarantee that episodes will be evenly spaced. With two files, for example, one must follow the other within every pass. The first/last check only addresses the transition between the end and start of the playlist.
3. Concatenate one shuffled pass
Run this from the same directory as playlist.ffconcat:
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.
ffmpeg -f concat -safe 1 -i playlist.ffconcat -c copy shuffled.mp4
-c copy attempts stream copying rather than re-encoding. It is suitable only when the inputs meet the concat demuxer’s compatibility requirements, including matching streams, codecs, and time bases. If they do not, use a compatible normalization or filter-based concat workflow that re-encodes as needed; the FFmpeg FAQ explains the distinction between concat-demuxer and concat-filter approaches.
4. Loop the ordered playlist indefinitely
To loop the playlist as an input while producing an output file or stream, put -stream_loop -1 before the input:
Rank #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.
ffmpeg -stream_loop -1 -f concat -safe 1 -i playlist.ffconcat -c copy output.mp4
FFmpeg documents -1 as infinite looping and 0 as no loop. Because the playlist is unchanged, each pass repeats the same sequence. The option loops the input; it does not generate a fresh shuffle for each pass. See the FFmpeg main options.
Choose the repeat protection you need
No repeat within one pass
A shuffle without replacement puts each listed file into the generated pass once. It prevents a file from appearing twice in that pass, but after all files play, a loop starts the same sequence again.
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
No immediate repeat across the loop boundary
The first/last check in the example prevents the final entry from matching the first entry. It does not prevent an episode from returning after one or more other episodes, nor does it change the order on later passes.
A longer cooldown across passes
To enforce a rule such as “do not replay an episode until several other episodes have played,” use a scheduler that remembers recent episode identities and chooses only an eligible episode outside that recent-history window. The library must contain enough distinct episodes to meet the cooldown. If two files are alternate encodes or duplicate copies of the same episode, treat them as one episode identity; a filename-based shuffle cannot infer that they tell the same story.
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.
Paths, compatibility, and output caveats
Safe paths and special characters
The example uses -safe 1, which accepts relative paths made from portable characters and rejects unsafe path forms. FFmpeg documents -safe 0 as permitting any filename, but do not switch to it casually; use it only for trusted local paths when necessary. Spaces and special characters in concat-script paths require FFmpeg’s concat-script quoting or escaping rules. Shell quoting alone does not necessarily make a path valid inside the script. Refer to the concat documentation for its path rules and examples.
Matching input streams and timestamps
The concat demuxer expects files to have the same streams, codecs, and time bases. The FFmpeg manual also warns that inaccurate file durations can cause timestamp artifacts because durations help position subsequent files. If inputs differ, normalize them or use a filter-based concat workflow with re-encoding as appropriate rather than assuming stream copy will work.
Documentation for your installed build
The online FFmpeg documentation is regenerated nightly and corresponds to the newest revision. If your installed FFmpeg is older, consult the documentation shipped with that build; the project’s documentation index makes this distinction.
Troubleshooting
- The episodes play in the same order every time: the concat demuxer follows the playlist exactly. Regenerate
playlist.ffconcatwith a new shuffle before starting another pass if you want a new order. - The same episode starts immediately after itself at the loop point: confirm the generated playlist’s first and last entries differ. The boundary check does not provide a longer cooldown.
- FFmpeg rejects a path: keep filenames and entries within the
-safe 1rules, or apply the concat-script escaping rules for the actual path. Use-safe 0only when the playlist points to trusted local files. - Stream copy fails or the join has glitches: inspect whether the files have matching streams, codecs, and time bases, and whether their durations are accurate. Normalize incompatible inputs or use a filter-based concat workflow that re-encodes as necessary.
- Two files containing the same episode appear far apart: the script shuffles file paths, not episode content. Deduplicate or group alternate copies by episode identity before scheduling.
Or let it run in the cloud
If your goal is to keep a pre-recorded playlist live on YouTube, StreamNeo is an alternative to managing an always-running computer. Upload a recording or build a playlist, add your YouTube stream key, and go live; StreamNeo loops uploaded videos in the cloud. Nothing has to stay on at home, it streams what you uploaded up to 4K 60fps at one price per slot, and it automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly pricing is $9.99 per month. StreamNeo is for YouTube streams of uploaded videos, not a camera broadcast. Learn more at StreamNeo, or start the free day.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →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.




