balintlaczko / MGT-python

Musical Gestures Toolbox for Python
https://www.uio.no/ritmo/english/research/labs/fourms/downloads/software/musicalgesturestoolbox/mgt-python/index.html
GNU General Public License v3.0
1 stars 0 forks source link

Find a fourcc codec which works with most video extensions #24

Open balintlaczko opened 4 years ago

balintlaczko commented 4 years ago

The problem is the MJPG only works with .avi files

balintlaczko commented 4 years ago

Update: weirdly enough, rarely - though I get the same error - it manages to write .mp4 and .mov files as well.

balintlaczko commented 4 years ago

So after several hours spent on forum-diving about the issue, finally decided to avoid the problem instead of solving it - for now, since there seems to be no solution available (at least we haven't found it). What we do instead is to convert every non-avi video to .avi before we do anything with them. This uses ffmpeg, which is in theory included in our install command, but we should check if there are no issues with this on any platform. (Works on Windows 10) This adds the mild side-effect to the usage of the module that all output will always be .avi. Will keep the issue open as a reminder in case the real solution pops up somewhere...

balintlaczko commented 4 years ago

An alternative solution can be to keep ourselves to mjpeg and avi while processing the files, and - if necessary - convert them back into the input file's codec and container with ffmpeg as a last step. The benefit is that using the toolbox doesn't have the side effect of changing containers, codecs, losing disk space, etc... The drawback is that this can add a (probably significant) computational overhead to every class method, since every time the job is done and a new video is to be exported, we additionally have to convert it back to a format we can't "natively" handle... Still, worth to consider if we can implement it carefully.