Stacking frames extracted from movie - which software

A forum to ask questions, post setups, and generally discuss anything having to do with photomacrography and photomicroscopy.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

zzffnn
Posts: 1896
Joined: Thu May 22, 2014 1:25 pm
Location: Houston, Texas, USA
Contact:

Post by zzffnn »

Thank you very much, jnh!

So I did not do it incorrectly, the FIJI software is just not efficient/too slow on my computer. Last night I had to terminate the software as it took forever to run a fast edf stack (and it never seemed to finish, for the 10 min I waited).

Zerene or Helicon is much faster in comparison. I will go with Zerene, I guess, since it is fast and produces very good stacks.
Selling my Canon FD 200mm F/2.8 lens

rjlittlefield
Site Admin
Posts: 23608
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

Getting back to the original question of how to extract frames from video, FFmpeg (https://ffmpeg.org/) is good for for that.

Examples...

I have at hand a 5 minutes, 0 seconds video file shot by Canon T1i as 1920x1080, 20 fps.

The following command:

Code: Select all

ffmpeg -i MVI_0110.MOV -an -sn -y -q:v 1 VideoFrames\Frame%5d.jpg
extracted all frames as 6002 .jpg files (300 seconds * 20 frames per second), in about 34 seconds of wall clock time. (This is on a hefty gaming-class machine.)

To extract only a subset of 110 frames beginning at 1:19 and going for 5.5 seconds, use:

Code: Select all

ffmpeg -ss 1:19 -i MVI_0110.MOV -an -sn -y -q:v 1 -t 5.5 VideoFrames\Frame%5d.jpg
The arguments are:

-ss 1:19 = seek to 1:19 on input
-an = "disable audio recording", probably not really required here
-sn = "disable subtitle recording", likewise
-y = "overwrite output files without asking", handy for testing
-q:v 1 = specify output quality, gives bigger JPEG files than default or -q:v 0
-t 5.5 = limit output to 5.5 seconds

Note that the -ss and -t options allow fractional seconds to be specified, but the notation is liable to be different from video editors that use seconds.frames notation. At 20 fps, 5.5 seconds and 5.10 seconds.frames mean the same thing.

I hope this helps!

--Rik

zzffnn
Posts: 1896
Joined: Thu May 22, 2014 1:25 pm
Location: Houston, Texas, USA
Contact:

Post by zzffnn »

Thank you very much, Rik. That was very helpful!

I will have to give ffmpeg a try then, even though I try to avoid command lines in general.
Selling my Canon FD 200mm F/2.8 lens

zzffnn
Posts: 1896
Joined: Thu May 22, 2014 1:25 pm
Location: Houston, Texas, USA
Contact:

Post by zzffnn »

ffmpeg worked for me, thank you very much, Rik!

For stacking, does BMP provide any advantage over JPG? What is the best photo format I should use, if that matters?

I like ffmpeg extracted frames better than those extracted by CombineZP.

Somehow CombineZP made extracted frames (2047x1151p) larger than original (1920x1080p). And it made some artifacts at frame edges that were not in the movie nor in ffmpeg frames. Also it is slower than ffmpeg. Maybe I did something wrong. I could not tell how CombineZP extracts movie frame, as it was downloaded as a single app, not a few folders like ffmpeg or FIJI.

1st movie frame from ffmpeg. I got about 1920x1080p each frame, ~130KB as JPG, or ~5.93MB each BMP. My camera, micro 3/4 Olympus E-PM2, captures movies at a fix rate of 30 frames per second and as 1920x1080p mov.
Image

1st movie frame from CombineZP (note artifacts at frame edges that were not in the movie nor in ffmpeg frames). I got about 2047x1151p each frame, ~1.00MB each jpg, or ~8.98MB each BMP
Image


For other computer dummies, here is how I installed ffmpeg:
http://www.wikihow.com/Install-FFmpeg-on-Windows

I had to create a "PATH" there as new "user variable" and enter "%USERPROFILE%\AppData\Local\Temp;c:\ffmpeg\bin" as "Variable value".

The "Start" - "run" - "cmd" - Enter the command “ffmpeg –version”
Then use Rik's command lines exactly as they are. Take note to spell out the full drive/folder/file path for movie and photo files.
Selling my Canon FD 200mm F/2.8 lens

rjlittlefield
Site Admin
Posts: 23608
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

Excellent -- I'm glad to hear that all is working well now.
zzffnn wrote:For stacking, does BMP provide any advantage over JPG? What is the best photo format I should use, if that matters?
Realistically, I doubt that it matters. BMP is similar to uncompressed TIFF, so your 5.93 MB is just 1920x1080x3 bytes, divided by 1024^2 bytes per megabyte. The JPG's are of course compressed, and typical microscope images have so much fuzzy stuff that they compress very well. In the nematode images that I have just now compared, I can't see any visual differences between JPG and BMP, both produced by ffmpeg.
I could not tell how CombineZP extracts movie frame, as it was downloaded as a single app, not a few folders like ffmpeg or FIJI.
I think it links to whatever codec libraries it finds installed in Windows. The mirroring artifacts around the outside are something that CombineZP always adds, regardless of source format.

--Rik

Post Reply Previous topicNext topic