Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with V4 miniscope video #75

Open
alexisfaure376 opened this issue Sep 2, 2024 · 6 comments
Open

Trouble with V4 miniscope video #75

alexisfaure376 opened this issue Sep 2, 2024 · 6 comments

Comments

@alexisfaure376
Copy link

Dera Jinghao,

I first want to thank you for sharing your powerfull pipeline.
I have already use it on V2 miniscope video, but on V4 it doesn't work.
I use the newest Min1pipe 2023 and I get an error message like that:

"Begin data cat
Error using zeros
CLASSNAME input must be a valid numeric or logical class name.

Error in data_cat (line 170)
frame_allt = zeros(pixh, pixw, idbatch(ib + 1) - idbatch(ib), dtype);

Error in min1pipe (line 83)
[m, filename_raw, imaxn, imeanf, pixh, pixw, nf, imx1, imn1] =
data_cat(path_name, file_base{i}, file_fmt{i}, Fsi, Fsi_new, spatialr);"

I suppose that video format is an issue, but I could not understand
Hope you will have an idea
Alexis

@JinghaoLu
Copy link
Owner

Hi Alexis, I think you might be right since the error message does not seem the reason and it could be due to the video format that creates wrong pixh or pixw. What is the video format, avi? It is supposed to be uncompressed avi that is compatible with MIN1PIPE.

@alexisfaure376
Copy link
Author

Dear Jinghao,
my files are .avi, but with a FFV1 codec. Reading various posts, it seems that converting videos to gray, with an RGBP codec might work. I was previously using Min1PIPE with miniscope V2 videos which were with an RGBP codec, but the new miniscope V4 videos are with an FFV1 codec.
However, I'm not very good at python, and I'm having trouble handling this change using FFmpeg in Anaconda3.
Do you have any ideas?
Thank you in advance.

@JinghaoLu
Copy link
Owner

I think you don't need to use python for FFmpeg. You can directly use terminal or command prompt in your OS to do that. Here is a simple command to start with: ffmpeg -i input_ffv1.avi -c:v rawvideo -pix_fmt yuv420p output_uncompressed.avi.
Or alternatively, if you still have the original file from miniscope, you can use their software to save uncompressed avi.

@alexisfaure77
Copy link

Thank you for your response,
I have been able to made it working with a RGPB conversion (Codec : Palettized RGB with palette element R:G:B (RGBP)), but I loose resolution and I guess that I will loose neurons.
And when I convert using your command, unfortunatly it does not work (error below). Do you know an uncompress codec that would work?
there is still this error:
Error using reshape
Number of elements must not change. Use [] as one of the size inputs to automatically calculate the
appropriate size for that dimension.

Error in data_cat (line 215)
frame = flipud(reshape(d_raw(stt(f_idx(ii)) + 1: stt(f_idx(ii)) + ndframe),
pixwo, pixho)');

Error in min1pipe (line 84)
[m, filename_raw, imaxn, imeanf, pixh, pixw, nf, imx1, imn1] = data_cat(path_name,
file_base{i}, file_fmt{i}, Fsi, Fsi_new, spatialr);

@JinghaoLu
Copy link
Owner

Can you try this: ffmpeg -c:v ffv1 -i your_video_full_path.avi -an -c:v rawvideo -pix_fmt gray8 -y your_target_video_full_path.avi

@alexisfaure77
Copy link

Thank you very much, it seems to work properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants