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

Motif_video is limited to mp4 files #11

Closed
JensBlack opened this issue May 26, 2020 · 1 comment · Fixed by #33
Closed

Motif_video is limited to mp4 files #11

JensBlack opened this issue May 26, 2020 · 1 comment · Fixed by #33

Comments

@JensBlack
Copy link

Me again,

The videowriter from openCV that you use is only looking for mp4 files and is not reporting an error if it entcounters other filetypes, which results in an empty variable that get's further passed down.

First error that happens in line 38 when trying to write the first videos:

 video = cv.VideoWriter(output, cv.VideoWriter_fourcc('M','J','P','G'), fps, (int(width), int(height)))

Error says "fps" is called before assignment.

Most likely origin:

in line:19 vame/analysis/videowriter.py when calling vame.motif_videos()

def get_cluster_vid(cfg, path_to_file, file, n_cluster):
    print("Videos get created for "+file+" ...")
    labels = np.load(path_to_file+'/'+str(n_cluster)+'_km_label_'+file+'.npy')
    --> capture = cv.VideoCapture(cfg['project_path']+'videos/'+file+'.mp4')
    

My workaround:
capture = cv.VideoCapture(cfg['project_path'] + 'videos/' + file + '.avi')

Suggested solution:
allow filetype parameter in config file (as early DLC did)
This would also help if you plan to include an automatic video/PE copying when initializing the project.

Alternative:
You could search for common filetypes within OpenCVs limits.

best,
Jens

@kvnlxm
Copy link
Collaborator

kvnlxm commented Jun 4, 2020

Hi Jens,

thank you for pointing this out. In a later release of VAME we will perhaps include this option.
For now, your workaround seems to be fine and I close the issue.

Best,
Kevin

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

Successfully merging a pull request may close this issue.

2 participants