I have a .mkv video file I need to use but it is apparently infinite So I'm trying to make a YouTube video and I have recorded some gameplay and some facecam footage. When I went over to edit in Kdenlive (my video editor of choice) I tried to import my facecam footage (.mkv formatted) which was shot using the default camera app on my Chromebook. It crashed Kdenlive but before it crashed I looked at the time it predicted to be the end of the video which seemed to be extraordinarily long! Just dragging the clip to my timeline caused my computer to freeze up and then the program to eventually crash. I opened the clip in VLC and the playhead doesn't even move. In fact, VLC says that the video is 0 minutes and 0 seconds long even though I know for a fact that it is 42 minutes long. Attempting to move the playhead makes strange artifacts appear on my video clip and then the playhead jumps to 0:00 and it plays fine. This is extremely frustrating because I don't know how I can convert this so that it has a correct start and end time. I cannot edit the video of course because my video editor tries to import an infinite (or at least really massive) video. Strangely enough it plays fine in the Google Drive video player and I believe the native Chrome OS video player.
So I've found the issue to be related to inconsistent framerates. I found that running the video through ffmpeg with ffmpeg -i yourfile.mkv -c:v copy -c:a copy -r 30 newfile.mkv actually fixed the issue entirely. Now I can open the file correctly and it appears to be 42 minutes as expected. More information here.