Opening avi movies with Image J

1,774 views
Skip to first unread message

elham ghanbarian

unread,
Sep 11, 2020, 7:35:45 PM9/11/20
to Miniscope
Hi Daniel, 

I finished the first scope and did some recording on mouse today. Miniscope seems to be working fine, thank you!
Now I want to open the .avi movies in Image J but this error happens: "unsupported compression 31564646'FFV1'". Would you please advise? 

Thanks, 
Elham 

Daniel Aharoni

unread,
Sep 11, 2020, 7:38:00 PM9/11/20
to elham ghanbarian, Miniscope
Excellent!

Here are a couple of helpful links concerning MATLAB and codecs. I am not sure how to get imageJ to work well with FFV1 though. 


--
You received this message because you are subscribed to the Google Groups "Miniscope" group.
To unsubscribe from this group and stop receiving emails from it, send an email to miniscope+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/miniscope/a90d5912-ed97-4634-97ad-0406fb7678c1n%40googlegroups.com.


--
Daniel B. Aharoni, PhD
Assistant Professor
Dept. of Neurology, UCLA

elham ghanbarian

unread,
Sep 11, 2020, 7:40:01 PM9/11/20
to Miniscope
Great, thanks!

Kenneth S Dyson

unread,
Sep 11, 2020, 8:08:28 PM9/11/20
to mini...@googlegroups.com
Thanks for the Matlab links. I haven't been able to get Matlab to read any media in Linux without having gstreamer1.0 installed. I will try with these tools asap.

Matthias Klumpp

unread,
Sep 11, 2020, 8:54:15 PM9/11/20
to Kenneth S Dyson, Miniscope
Am Sa., 12. Sept. 2020 um 02:08 Uhr schrieb Kenneth S Dyson
<in...@m3platform.org>:
>
> Thanks for the Matlab links. I haven't been able to get Matlab to read any media in Linux without having gstreamer1.0 installed. I will try with these tools asap.

Video codec support in MATLAB is pretty awful, especially on Linux.
Having GStreamer should work though - in most cases. We had issues
with that on some configurations though and used this code (by Andrei
Barbu) as workaround: https://github.com/bothlab/ffmpeg-matlab
(produces a Mex file)
Since the MIN1PIPE pipeline also supported only one specific type of
Raw video (PAL 8:8:8) and apparently was reading it manually, I also
have some really crude conversion code to encode a FFV1 MKV video to a
PAL888 Raw AVI using VirtualDub in Wine (any other method to produce
this data with current tools and up-to-date FFmpeg failed, and the
quick & dirty method worked well enough).
Currently we are playing with CaImAn and Minian which use OpenCV's
VideoReader and support all formats FFmpeg can read.

I never needed to read these videos into ImageJ, but
https://forum.image.sc/t/plugins-for-reading-and-writing-compressed-video/8777
looks pretty interesting.




--
I welcome VSRE emails. See http://vsre.info/

Kenneth S Dyson

unread,
Sep 11, 2020, 9:42:28 PM9/11/20
to Matthias Klumpp, Miniscope
We have been successful converting the ffv1 to greyscale frames and processing through cnmfe on MATLAB on Ubuntu 20.04. But we are unable to get it to work on our remote super computer cluster. The cluster does not have gstreamer installed,so I figure that is the issue. I am waiting on an admin to install it and see if that solves the problem.

Sep 11, 2020 20:54:14 Matthias Klumpp <matt...@tenstral.net>:

cke...@gmail.com

unread,
Sep 11, 2020, 11:45:36 PM9/11/20
to Miniscope
I want to second Matthias's comment about CaImAn (the python version). Last fall, I had a lot of trouble and gave up on CNMF-E. This fall, we came back to it again and have found quite a bit more success. (The key is apparently to seed the algorithm with contours extracted from a maxprojection!) We've been processing long videos recorded using our HD sensor (1920x1040) , and so the raw data is ~400 GB. Cropping and compressing to FFV1 drops that to about 200 GB. I was very pleased to see that the FFV1-encoded avi's generated by FFMPEG "just worked" with CaImAn...

I suspect there should be a way to get a "rawvideo" encoded AVI (which I believe ImageJ can read) back out using FFMPEG - probably something like "ffmpeg -i input.avi  -c:v rawvideo output.avi" might work. Also, if you use CaImAn just for motion correction (which has worked very well for us), then you can use their movie class to write data back out to disk in different formats including tiff and HDF5.

elham ghanbarian

unread,
Sep 15, 2020, 8:23:31 PM9/15/20
to Miniscope
Thank you all for very helpful comments. Using ffmpeg toolbox ( "ffmpeg -i input.avi  -c:v rawvideo output.avi" ) I was able to convert ffv1 avi movies to rawvideo avi and open them with Image J. Next, I'll try CNMF-E or Min1pipe. 

-Elham 

Omid Miry

unread,
Jan 6, 2021, 6:49:20 PM1/6/21
to Miniscope
Hi Elham,
Were you able to get the ffmpeg toolbox to function in Matlab or did you use another program? We are having some trouble with ffmpegtranscode in Matlab. 
Where did you enter this command? > ( "ffmpeg -i input.avi  -c:v rawvideo output.avi" )
-Omid

Omid Miry

unread,
Jan 6, 2021, 8:10:59 PM1/6/21
to Miniscope
Never mind, I was able to use it outside of matlab. Thanks!

Ana Gonçalves

unread,
Jan 7, 2021, 6:48:37 AM1/7/21
to Miniscope
Hi all,

In windows by previously downloading the k-lite codec pack (https://codecguide.com/download_kl.htm), I was able to open the avi files with codec FFV1.

Best,
Ana

elham ghanbarian

unread,
Jan 7, 2021, 4:42:19 PM1/7/21
to Miniscope
Hi Omid, 

Okay cool. 
I also wasn't able to use the command in Matlab but this one worked in Matlab: 
system(["ffmpeg -c:v ffv1 -i 0.avi -an -c:v rawvideo -pix_fmt gray8 -y new0.avi"]);

Now I am recording with GREY compression and do not need to convert the FFV1 to avi. 

Good luck
Elham 

day...@gmail.com

unread,
Jun 11, 2021, 8:45:34 PM6/11/21
to Miniscope
Hi Caleb,
Would you be able to provide any advice on how you seed CNMF-E with contours derived from max projection? CNMF-E seems to work OK for us on its own but we also can produce maps of active ROI by regressing pixel intensity vs stimulus and would like to try using these maps to guide segmentation. Just getting started with caiman and not sure where/how to supply this data to the algorithm -  would appreciate any tips!
Thanks,
David

Reply all
Reply to author
Forward
Message has been deleted
0 new messages