I'm on macOS, and have ffmpeg and python installed through homebrew. Bash solutions are also welcome - though I have no experience with bash I have folders with many videos, most (if not all) in either mp4 or mkv. I want to generate quick samples for each video, and each sample should have multiples slices/cuts from the original video. I don't care if the resulting encode, resolution and bitrate are the same as the original, or if it's fixed for example: mp4 at 720. Whatever is easier to write on the script or faster do execute. Example result: folder has 10 videos of different duration. Script will result in 10 videos titled "ORIGINALTITLE-sample.EXT". Each sample will be 2 minutes long, and it'll be made of 24 cuts - 5 seconds long each - from the original video. The cuts should be approximately well distributed during the video, but doesn't need to be precise. Edit someone on Reddit suggested the script below, but the result has some issues, like images blinking in and out (see it here https://youtu.be/FZC3aIvugpI). Maybe it's related to errors like this I saw? [hevc @ 0x11c631a30] Could not find ref with POC -43 I was also not able to change the 1-second duration of each clip for something longer, and would still need to make this loop on every video in the folder. #!/bin/bash f="original.mp4" dur=$(ffprobe -v 16 -show_entries format=duration -of csv=p=0 "$f") cnt=$(echo "scale=0; ${dur} * 0.95 / 8" | bc -l) echo $dur $cnt ffmpeg -i "$f" -c copy -f segment -segment_time $cnt -reset_timestamps 1 "/tmp/out_%03d.${f##*.}" -y -hide_banner echo "#list">/tmp/1.txt for g in /tmp/out_*; do echo "file $g" >> /tmp/1.txt echo "outpoint 1" >> /tmp/1.txt done o="/tmp/out.${f##*.}" ffmpeg -f concat -safe 0 -i /tmp/1.txt -c copy "$o" -y -v error -stats test.mp4 Continue reading...