Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
Mountain View desk6 min

How to Stream Videos in Random Order to YouTube with FFmpeg

Shuffle a playlist before FFmpeg reads it, then stream the sequence to YouTube Live. Learn how to prepare compatible clips, loop the order, configure ingest, and fix common failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To stream local videos in random order to YouTube with FFmpeg, shuffle their filenames into a concat-demuxer playlist, then send that playlist to YouTube Live. FFmpeg plays the list in order; it does not randomize entries itself. Add -stream_loop -1 to repeat the same shuffled sequence, and use a common media profile when the clips are not compatible.

How the shuffled FFmpeg playlist works

The order is decided before FFmpeg starts: a script or shell command shuffles the file list, and the concat demuxer reads the resulting playlist sequentially. Looping that input repeats the same order. To get a new order on each pass, an external process must generate a new playlist and restart or otherwise orchestrate playback.

As an Amazon Associate I earn from qualifying purchases.

The concat demuxer is intended for files with matching streams, codecs, and time bases. Differences between files, including duration metadata, can cause gaps or artifacts at transitions. FFmpeg distinguishes joining compatible inputs with the concat demuxer from joining inputs that need re-encoding with the concat filter. See the FFmpeg concat demuxer documentation and the FFmpeg FAQ.

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

Prepare your videos and decide how to concatenate them

Inspect the files first

Check representative clips for video and audio codecs, resolution, frame rate, audio layout, and duration. A set of exports from one consistent workflow is more likely to fit the concat demuxer’s requirements than unrelated downloads or recordings. If the files differ, normalize them to a common profile before relying on a repeated live playlist.

#1 Best Overall
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • 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.

Choose stream copy or re-encoding

Approach When it fits Trade-off
Concat demuxer with -c copy Inputs have compatible streams and the output container accepts their encoded packets. Fast and avoids re-encoding loss, but cannot apply filters and is not suitable for every set of files or target container.
Normalize clips, then encode or use the concat filter Inputs vary or you need a consistent output profile. More flexible, but uses processing resources and re-encoding can affect quality. Test transitions and resource use before relying on it.

FFmpeg documents the stream-copy and transcoding distinction in its command-line documentation. Do not assume that a playlist that opens will produce clean transitions; inspect the actual output.

Create a shuffled concat playlist

Create a UTF-8 plain-text playlist with one file entry for each video, in the randomized order you want. For example, the file should have this shape, with real paths replacing the examples:

Rank #2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
  • 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.
file '/absolute/path/video-a.mp4'
file '/absolute/path/video-b.mp4'
file '/absolute/path/video-c.mp4'

This is only a syntax example: the listed filenames must already be in the desired shuffled order. Use absolute paths to avoid confusion about which directory FFmpeg resolves relative paths from. Paths with quotes or unusual characters need appropriate escaping for concat-list syntax.

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

The exact shuffle command depends on your operating system and shell. For example, shuf is available in some Unix-like environments but is not a universal Windows command. Whatever method you use, verify the generated list before starting. The concat demuxer also has safe-path behavior; only relax safety restrictions when you trust the playlist and its paths.

Rank #3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
  • 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.

Send the playlist to YouTube Live with FFmpeg

Use this command as a template

The following is an illustrative template, not a tested, drop-in command. Replace every placeholder with values for your files, selected output profile, current YouTube ingest endpoint, and stream key. Confirm the options work with your installed FFmpeg build.

ffmpeg -re -stream_loop -1 -f concat -safe 0 -i playlist.txt 
  -c:v libx264 -preset veryfast -b:v <video-bitrate> -maxrate <video-bitrate> 
  -bufsize <buffer-size> -g <keyframe-interval-in-frames> 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "<YouTube RTMPS ingest URL>/<stream key>"
  • -re reads the input at its native rate for a real-time stream rather than sending the playlist as fast as possible.
  • -stream_loop -1 infinitely loops the playlist input, so the same generated order repeats.
  • -f concat -i playlist.txt tells FFmpeg to read the concat-demuxer list. -safe 0 relaxes path restrictions; use it only for a playlist and files you trust.
  • -c:v libx264 and -c:a aac encode video and audio to common YouTube live codecs. Encoding uses CPU resources; the selected resolution and frame rate must match what you intend to send.
  • -b:v, -maxrate, and -bufsize need values chosen for the output profile. Keep bitrate settings consistent with the codec and YouTube’s guidance.
  • -g sets the GOP/keyframe interval in frames, so calculate it from frame rate. For a two-second interval, use 60 frames at 30 fps or 120 frames at 60 fps.
  • The output destination combines the server URL and key shown for your YouTube live stream. Use the endpoint YouTube gives you rather than copying a key or URL from someone else’s example.

For protocol and output details, consult FFmpeg’s protocol documentation as well as its command-line documentation. If you choose -c copy instead of encoding, the input streams and target output must be compatible; copy mode cannot normalize, filter, or repair mismatched clips.

Rank #4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
  • 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.

Decide whether the order should change each time around

The command above loops the same playlist forever. It does not reshuffle when it reaches the end. A fresh random order for every pass requires a separate playlist-generation and process-orchestration step. Its design depends on your operating system and how you handle the transition between passes; test it rather than assuming a seamless handoff.

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

Set up YouTube Live and protect your stream key

  1. Confirm the channel is eligible to livestream. YouTube’s current getting-started guidance says a channel must be verified, have no live-streaming restriction in the past 90 days, and the user must be at least 16.
  2. Open YouTube Live Control Room and create or select a stream. Follow YouTube’s encoder setup instructions.
  3. Copy the server or ingest URL and stream key shown for that stream into the FFmpeg output destination. Keep the key private: do not put a real key in a public example, screenshot, source repository, or log.
  4. Start FFmpeg and check the Live Control Room preview. For a scheduled stream, wait for the preview and press Go live when the event is ready.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose settings and test the stream

YouTube’s published encoder guidance recommends RTMPS, constant bitrate (CBR), supported codecs, and a two-second keyframe interval, with an interval no longer than four seconds. Its settings depend on codec and output mode, so use the row for your actual codec rather than treating one bitrate as universal. YouTube’s current H.264 SDR table recommends the following video bitrates:

Best Value
Sale
UnionSine 500GB Ultra Slim Portable External Hard Drive HDD-USB 3.0 | for PC, Mac, Laptop, PS4, Xbox one, Xbox 360-(Black)
  • [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.
Output YouTube-recommended bitrate YouTube-listed minimum
1080p at 30 fps 5 Mbps 4 Mbps
1080p at 60 fps 17 Mbps 6 Mbps
720p at 30 fps 6 Mbps 3 Mbps
720p at 60 fps 8 Mbps 3 Mbps

These are YouTube recommendations for H.264 SDR, not guarantees of stream quality. YouTube lists separate values for AV1 and HEVC. Check its current encoder settings, bitrate, and resolution page when choosing a profile.

  • Leave upload-bandwidth headroom; YouTube recommends 20% above the stream’s bitrate.
  • Preview before going live and continuously monitor audio, video, and stream health.
  • Test the exact playlist, including clip boundaries, with motion and audio similar to the intended stream. A private or unlisted test may be appropriate before a public event.

See YouTube’s streaming tips and live streaming tips for preflight and monitoring guidance.

Troubleshoot common FFmpeg and YouTube problems

Symptom What to check and do
FFmpeg exits while opening the playlist Check the concat-list syntax, path spelling, working directory, file permissions, and whether every listed file can be opened. Confirm paths with spaces or unusual characters are escaped correctly.
Video or audio breaks at a clip boundary Compare the clips’ streams, codecs, parameters, time bases, and duration metadata. Normalize incompatible inputs or use a re-encoding approach, then test the transitions again.
YouTube shows no preview Check that the ingest URL and stream key are the ones for the current Live Control Room stream. Confirm channel eligibility and inspect FFmpeg’s output and errors.
YouTube reports stream-health issues Check codec, CBR configuration, keyframe interval, bitrate for the selected profile, and available upload bandwidth.
The stream starts but is unstable Increase bandwidth headroom, monitor continuously, and test the complete playlist and transitions on the same connection before the event.
The sequence repeats without changing order This is expected with -stream_loop -1: it repeats one playlist. Add external playlist generation and orchestration if each pass needs a new shuffle.

Or let it run in the cloud

If the goal is to keep a prerecorded YouTube stream running without leaving your own computer on, StreamNeo runs uploaded videos from the cloud. Upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home; it streams the uploaded quality up to 4K 60fps at one flat price per slot, with automatic recovery if YouTube drops the stream. The first day is free with no card. Monthly is $9.99 per month. StreamNeo is for prerecorded video sent to YouTube, not a camera feed. Start at StreamNeo’s free trial.

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

Quick Recap

Bestseller No. 1
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400) | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$129.99
Bestseller No. 2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$219.99
Bestseller No. 3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.80
Bestseller No. 4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue | Everyday HDD storage. Plug-and-play backup. Windows & macOS. Adobe CC trial included. 1-Year Warranty
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$189.99

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 *

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.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair 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.