FFmpeg’s concat demuxer does not shuffle files or prevent back-to-back repeats. Generate an ordered playlist first, making sure each selected episode differs from the one immediately before it, then pass that playlist to FFmpeg. The method below creates one concatenated output; continuous playback requires a player or playlist generator to apply the same rule again at each boundary.
How the shuffle rule works
The concat demuxer reads files from a script in the order they are listed; it does not choose or randomize episodes. The no-immediate-repeat rule belongs in the code or process that builds that list. For the official behavior and script format, see the FFmpeg concat demuxer documentation.
For a finite set in which every episode is used once, shuffle the list and check adjacent entries. If any two neighbors match, shuffle again or build the order by choosing from the remaining episodes while excluding the immediately previous one whenever possible. If episodes have different repeat counts, a valid arrangement exists only when the count of the most frequent episode is no greater than the total count of all other episodes plus one.
Create a shuffled ffconcat playlist
- Choose the eligible files. Gather the episodes to include in this output and decide whether each should appear once or have a specified repeat count.
- Build a constrained order. Randomize the eligible episodes, then verify that no episode appears directly after itself. For repeat counts, select among remaining copies while excluding the previous episode when another choice is available. If there is no alternative, the requested counts cannot satisfy the rule; change the counts or omit episodes.
- Write the order to a text file. Put the exact header
ffconcat version 1.0on the first line, followed by onefiledirective per episode. For example:ffconcat version 1.0 file '/media/Bluey/S01E01.mp4' file '/media/Bluey/S01E03.mp4' file '/media/Puffin Rock/S01E02.mp4'Use valid quoting or escaping for paths containing spaces or special characters; consult the concat script syntax if a path does not parse as expected.
- Check the sequence. Inspect every neighboring pair in the file before running FFmpeg. This catches an accidental repeat introduced while generating or editing the list.
Concatenate compatible episodes without re-encoding
If the inputs have compatible streams and properties, such as codecs and time bases, use the concat demuxer with stream copy:
#1 Best Overall
- Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
ffmpeg -f concat -safe 0 -i playlist.ffconcat -map 0 -c copy shuffled.mp4
Here, -f concat selects the demuxer, -safe 0 permits paths that do not meet its default safe-path restrictions, -i supplies the playlist, -map 0 maps the input streams, and -c copy avoids re-encoding. Use -safe 0 only with a playlist you trust, especially if it contains paths you did not create. The output follows the script’s order; this command does not add randomness.
The demuxer expects compatible inputs. Differences in streams or properties can prevent clean concatenation, and inaccurate duration information may cause timestamp gaps or other artifacts. The FFmpeg documentation describes the demuxer’s requirements and the use of duration directives when needed: concat demuxer.
Rank #2
- Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
When to use the concat filter instead
If the episodes are not compatible for stream copy, or you need to re-encode them into a consistent output, use the concat filter workflow. It is a different route from the demuxer: inputs are decoded, joined by the filter, and encoded as needed. The FFmpeg FAQ on concatenating video files explains the filter approach and when the demuxer is suitable for avoiding re-encoding. The precise filter command depends on the files’ codecs, streams, timing, and desired output settings, so inspect the inputs and choose matching filter and encoder options rather than assuming one command fits every collection.
One output file versus continuous playback
The example creates a single finite video in the generated order. When it reaches the end, it has no new episodes to choose. If you need a player to keep selecting episodes indefinitely, the playback process or an external playlist generator must create or provide the next order and enforce the no-repeat rule across playlist boundaries. A finite output alone cannot supply fresh randomness after it ends.
Rank #3
- Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
Troubleshooting
- FFmpeg does not recognize the playlist automatically: Check that the first line is exactly
ffconcat version 1.0, with no blank line or other text before it. - A file path is rejected or treated incorrectly: Check the concat script’s quoting and escaping rules, including spaces and special characters. Use
-safe 0only when the playlist is trusted. - Concatenation fails or streams do not match: The demuxer requires compatible streams and properties. Use the concat filter and re-encode if the inputs need normalization.
- The output has gaps or timestamp artifacts: Check whether input durations are accurate; the demuxer documentation describes explicit
durationdirectives for cases where duration information needs to be supplied. - An episode repeats immediately: The playlist generator or manual list did not enforce the adjacency rule. Check neighboring entries, including the last and first entries if your player loops the list, and regenerate or edit the order.
- Episodes stop after the output ends: That is expected for a one-time concatenated file. Use a playback setup that can consume a newly generated playlist and carry the previous episode into the next selection decision.
Or let it run in the cloud
If your goal is to keep uploaded videos playing live on YouTube rather than create a local concatenated file, StreamNeo is a separate cloud option: upload a recording or build a playlist, add your YouTube stream key, and go live. It loops uploaded videos, not a camera feed, and does not change FFmpeg’s shuffle behavior or guarantee that adjacent playlist entries differ.
- Your computer and home connection do not have to stay on.
- Each slot streams uploaded video at its original quality up to 4K 60fps for one flat slot price, with no re-encode or quality tiers.
- It can automatically recover if YouTube drops the stream.
- The first day is free with no card, once per account.
The monthly option is $9.99 per month. Start a free day at StreamNeo registration.
Rank #4
- Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
FFmpeg’s documentation is regenerated nightly, and it recommends checking the documentation for your installed version if it is older; the exact behavior and compatibility of your own files depend on that installation and media collection. See the FFmpeg documentation.
Quick Recap
Best Value
- [Upgraded Version] - This external hard drive features a mirrored logo stripe combined with a striped anti-slip design, and the rounded corners of the casing make it easier to grip. The stripes also have a heat dissipation function, ensuring stable and fast data transfer.
- 【Ultra-thin and quiet】 - The motherboard adopts JMicron 578 noise-free solution, giving you a quiet working environment. Lightweight and portable size designed to fit in your pocket for easy portability.
- 【Ultra-Fast Data Transfers】 - Pairing this external hard drive with JMicron 578 solution USB 3.0 and USB 2.0 interfaces enables blazing-fast data transfer. It boasts theoretical read speeds of up to 125MB/s and write speeds of up to 103MB/s.
- 【Plug and Play】 - With no software to install, just plug it in and the drive is ready to use.The hard disk chip is wrapped with an aluminum anti-interference layer to increase heat dissipation and protect data.
- 【What You Get】 - 1 x Portable Hard Drive, 1 x USB 3.0 Cable, 1 x User Manual, Gift-type shell packaging ,Three-year manufacturer's warranty and free technical support services.
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.

