Automatic sampling of video files: easier said than done!
Recently, as part of my research, I needed to extract a frame every x seconds from a video shot with a panasonic camcorder. Turns out there's not a lot of programs that can do this, or at least not many that advertise this feature. Software I found:
- Frameshots (by Frame-shots.com)
- Free video to Jpeg converter (by dvdvideosoft) - free
- Imagegrab (by hobbyist Paul Glagla) - free
- Advanced X video converter (by AoA)
- Sample X images per second (X integer) - allows a high temporal frequency, can't go lower than X = 1.
- Sample 1 image per X frames (X integer) - variable framerate can mess up things here
It is clear that with constant framerate video these 2 options combined with start / end parameters should offer complete (temporal) control over the extracted sequence. The first allows arbitrary high sampling from 1Hz upwards, the second allows sampling under 1 Hz.
Imagegrab is focused on the objective of saving images from video. Basic filters (flips and watermarks), and its intervalometer offers the same 2 options as X vid converter. It doesn't have start / end parameters or resizing. It does allow changing the second unit to minutes and realtime playback during capture. The latter feature helps with visual confirmation that sampling occurs on at the right times.
Frameshots, a commercial attempt at niche software. It thought my 1920x1080i video was 1920x746 in the preview window. Is it coincidence that 1080/746 = a common pixel aspect ratio?- I digress. But once I started outputting it could do 1920x1080. It worked properly with a different test file (avi). It allows cropping, brightness and contrast filters. Sequence parameters include start and end time. Its interval options are:
- 1 sample per X miliseconds (X integer > 0)
- X images per video clip (I'm assuming equal spacing)
In all I felt it was picky regarding codecs and it froze once for no clear reason. It does offer miliseconds as unit of time which is smart considering the timescale of frames, but offers no extra control.
Dvdvideosoft's free video to JPEG converter gives a simple interface, no filters.
Options are: 1 Sample every X frames, 1 Sample every X seconds, X Samples from total video. Again only X as positive integer values.
No big difference from the others in sequence freedom here, again no start/end time. However I would like a .bmp option.
Alternatively many editors and converters sport an imagedump output option, but that gives you every frame of the final video as an image. Even if you can be bothered to delete all the unneeded ones it gets complicated if your video has a variable framerate or drivespace is limited.
A slower but less error-prone approach is to just manually select the frames in a player or editor, since most have a "save as .bmp / .tiff / .jpeg /. png" option. You could maybe even pick a frame just before or after the frame at the timepoint, if the quality is better and the time accuracy loss isn't vital. But not very practical when analyzing long videos or at a high temporal resolution.
I didn't pay much attention to the naming formats available as this can often be easily corrected or isn't important. Imo an important feature is having a start & end time parameter, makes life easier. A help file that details exactly (and perhaps graphically) how the extraction is done may help alleviate some of my concerns regarding variable frame rate and equal spacing of samples.
Perhaps ironically, only the 2 free software options allowed MTS files, where I had to remux first for the other 2 ( 3/4 could handle mkv, they all handled .mp4 and .mov). This remuxing brings its own problems, more on that later.
Comments are closed