Pre-processing (conversion) for video analysis using ImageJ on Mac

1 minute read

Preface

When analyzing a video with ImageJ, read it in the .avi file format.

It is a familiar extension on Windows, but on Mac, I had a hard time with many errors such as not being able to read even if I converted it using a free software converter.

At this time, using ffmpeg solved the problem smoothly.
At that time, as a memorandum of the solution.

What to use

・ Homebrew
・ Fmpeg
・ Original video file (The extension of the original file is not limited to mpg, but a wide range of formats are okay)

Installation

Start up the terminal and operate the command.

  • It is a prerequisite that Homebrew is installed in advance.

brew install ffmpeg

things to do

(1) Launching a Mac terminal
(2) Move to the directory containing the video file (use cd XXX or ls to check the existence of the file)
(3) Enter the following command in the terminal

ffmpeg -i Original file name.mpg -f avi -vcodec mjpeg File name after conversion.avi

```

(4) Load the converted file by dragging and dropping it into ImageJ.
that’s all

  • This time, only simple conversion is performed, but in reality, you can specify quite a variety of options such as codec type, frame rate, and audio format when converting.

As a bonus

ImageJ is often taken care of in research, but I think that there are many people who stumble because it has too many functions.
Is it possible to perform procedures such as video analysis and such processing? If you think that, you should take a look at this material for the time being.

reference

ImageJ -Inporting .avi
It can be done with FFmpeg!