I mean, how to generate images files from a video like screenshots.
5 Answers
Try with ffmpeg
ffmpeg -i inputfile.avi -r 1 -f image2 image-%3d.jpeg
You can read the documentation here
-i inputfile.aviThe video input file is inputfile.avi-r 1extract 1 image per second of video. Replace that number for the number of images you want to get per second.-f image2force image output format, you may probable be able to omit this since the program tries to choose the output images format from the file extension.image-%3d.jpegname of the output images, the %3d indicates that the output generated images will have a sequence number there of 3 decimals, if you want the number padded with zeroes you just need to use %03d.
-
1your link seems be brokenNolwennig– Nolwennig2016-02-24 09:10:15 +00:00Commented Feb 24, 2016 at 9:10
-
@Nolwennig. Fixed, not as specific as the previous one but at least is the official documentation and hardly to be broken.YoMismo– YoMismo2016-06-23 06:41:48 +00:00Commented Jun 23, 2016 at 6:41
-
12
-r 1is for the number of images per sec. So for 60ips, or 24, it's-r 24. And to limit the extract, it's-ss [start] -t [duration].Sandburg– Sandburg2018-06-01 21:12:50 +00:00Commented Jun 1, 2018 at 21:12 -
Thanks, work fine on XubuntuIndacochea Wachín– Indacochea Wachín2019-07-27 02:45:57 +00:00Commented Jul 27, 2019 at 2:45
-
it does not work : [swscaler @ 0x5560a2cf5500] [swscaler @ 0x5560a2d05300] deprecated pixel format used, make sure you did set range correctlyMarietto– Marietto2023-04-30 13:57:22 +00:00Commented Apr 30, 2023 at 13:57
I have just downloaded the latest version of VLC for Windows 32 - 2.1.2 Rincewind and it works fine to do this.
Steps:
1 - Click Tools > Preferences and click radio button All
2 - Scroll down and click the + sign next to Video to expand
3 - Scroll down and click on Scene Filter and fill in the info for Directory Path prefix (where you want to save frames). Don't click Save.
4 - Scroll up and click on the word Video under Filters
5 - Click the check box for Scene video filter and click Save.
6 - Open and run a video and it will save .png's
7 - To stop saving frames go back to step 5 and uncheck Scene video filter. Easy really once you know where to find the settings.
-
I had to restart VLC to get changes to the Scene Filter preference to take effect. My platform is macOS; not sure if this applies to Unix/Linux/Win versions. VLC 3.0.11.1.Mat Gessel– Mat Gessel2021-01-11 22:52:22 +00:00Commented Jan 11, 2021 at 22:52
-
2015 to 2025 that's ten years. The UI might have changed. I could follow with 1 and 2, maybe 3 (unsure), but got lost on 4JLuc– JLuc2025-05-17 13:31:13 +00:00Commented May 17 at 13:31
In VLC you can right click, Video, Take Snapshot
-
This sounds a bit labour-intensive if one would need images for e.g. each frame in scene.2019-10-06 08:06:13 +00:00Commented Oct 6, 2019 at 8:06
-
Unfortunately on Linux VLC crashes. (I found postings dating back to 2015, so this is a really old problem)arved– arved2021-01-06 11:10:21 +00:00Commented Jan 6, 2021 at 11:10
-
@arved, got a URI to those?RokeJulianLockhart– RokeJulianLockhart2025-03-19 14:35:50 +00:00Commented Mar 19 at 14:35
Hope this help
#!/bin/bash
source_dir="."
output_dir="."
input_file_types=(avi wmv flv mkv mpg mp4)
output_file_type="jpg"
convert() {
echo "" | ffmpeg -ss $ss -y -i "$in_file" -an -f image2 -vframes 1 "$output_dir/$out_file"
}
for input_file_types in "${input_file_types[@]}"
do
find "$source_dir" -name "*.$input_file_types" -print0 | while IFS= read -r -d $'\0' in_file
do
echo "Processing…"
echo ">Input "$in_file
# Replace the file type
out_file=$(echo $in_file|sed "s/\(.*\.\)$input_file_types/\1$output_file_type/g")
echo ">Output "$out_file
# get video duration
# fulltime=`ffmpeg -i "$in_file" 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//`;
# hour=`echo $fulltime | cut -d ':' -f 1`;
# minute=`echo $fulltime | cut -d ':' -f 2`;
# second=`echo $fulltime | cut -d ':' -f 3 | cut -d '.' -f 1`;
# seconds=`expr 3600 \* $hour + 60 \* $minute + $second`;
# ss=`expr $seconds / 2`; # from the middle of video
ss=`expr 10`; # from the 10sec of video
# Convert the file
convert "$in_file" "$out_file"
if [ $? != 0 ]
then
echo "$in_file had problems" >> ffmpeg-errors.log
fi
echo ">Finished "$out_file "\n\n"
done
done
-
Tom : your script does not work : [image2 @ 0x56081d0f9b00] The specified filename '././video-nano.jpg' does not contain an image sequence pattern or a pattern is invalid. [image2 @ 0x56081d0f9b00] Use a pattern such as %03d for an image sequence or use the -update option (with -frames:v 1 if needed) to write a single image.Marietto– Marietto2023-04-30 13:54:40 +00:00Commented Apr 30, 2023 at 13:54
-
@Marietto That message is a warning, not an error — it doesn't stop ffmpeg writing the file anyway.gidds– gidds2023-06-26 10:47:02 +00:00Commented Jun 26, 2023 at 10:47
In vlc-3.0.21-15.fc41, use:
- "Video"
- "Take Snapshot"
The snapshot shall be saved in file:///$Env:HOME/Pictures:
-
Perhaps, this should be proposed as an edit to
revisions/545338/1instead?RokeJulianLockhart– RokeJulianLockhart2025-03-19 14:47:17 +00:00Commented Mar 19 at 14:47

