fourMs / 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
52 stars 11 forks source link

Skip error message #305

Closed alexarje closed 11 months ago

alexarje commented 11 months ago

I suddenly get an error with the skip function:

Screenshot_20231106_224920

This is in a Jupyter notebook I have been using daily for my stillstanding project, and it appeared after I compiled a new FFmpeg version the other day, although I don't really know why that should matter? The skipping function works, but it is unable to pass the filename to the video object.

joachimpoutaraud commented 11 months ago

Hi, it seems that the problem is related to the FFmpeg time code here. It might be that the new FFmpeg version you are using runs with a different time code than before. Consequently, the toolbox fails when converting time code string into seconds because there is maybe no time code anymore in that specific string.

For debugging this issue, I would need to know what FFmpeg version you are using to test it myself, or perhaps to print the time_str variable that goes in the str2sec() function in order to see what the new time code looks like.

alexarje commented 11 months ago

ffmpeg version N-112670-g4fb9d94688 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 13 (Ubuntu 13.2.0-4ubuntu3) configuration: --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --disable-static --enable-shared libavutil 58. 31.100 / 58. 31.100 libavcodec 60. 32.102 / 60. 32.102 libavformat 60. 17.100 / 60. 17.100 libavdevice 60. 4.100 / 60. 4.100 libavfilter 9. 13.100 / 9. 13.100 libswscale 7. 6.100 / 7. 6.100 libswresample 4. 13.100 / 4. 13.100

joachimpoutaraud commented 11 months ago

After downloading your version of FFmpeg, I got the same error. So it seems that new versions of FFmpeg produce non-applicable values (i.e. N/A) for the variables time and fps. However, this doesn't happen all the time, mainly at the start of the sub-process, and then it works normally.

I simply added a ValueError exception in the _utils.py script in order to pass any potential N/A values. That way, the script won't crash and will continue to output the following time values for the progress bar.

alexarje commented 11 months ago

Cool, it fixed the problem! But now I see that there is also a problem when using -1 to find only the keyframes. A related issue?

Screenshot_20231107_224136

joachimpoutaraud commented 11 months ago

The error happens when the h264 file is reencoded. I have seen similar issues saying that when it is not clearly specified in which format the file needs to be re-encoded (i.e. -f h264) it can fails to encode it. Consequently, I have clearly specifed the h264 format in the encoding process (_videoadjust.py)