GoZen Update: 2024 – Week 20

Last week we skipped a weekly update (again) as I wasn’t able to achieve a lot in week 18. However this week we achieved a lot, found a lot more bugs, and did I once again get beaten by FFmpeg. Let’s go over some of the changes which happened but first about my current setup.

My setup

As I’m trying to get used to touch-typing correctly I decided to try out NeoVim. I had been using Vim for some time, but I never really used much of the functionalities so I may as well have been using nano ^^”. This is just a weekly challenge I gave myself and decided that I’ll try it out a couple more day’s as I’m finally getting the hang of Vim motions. I’ll probably move back to the Godot editor for GDScript as the language server for GDScript is not … very complete.

Debugging GDExtensions

I have tried my best to get debugging working, but just as before I’m having trouble to actually debug C++, let alone trying to debug cpp code running from Godot. My solution will be simple, I’ll make the cpp side of things into it’s own project and just won’t return any of the images or the audio to anywhere. I’ll talk about this later but at this moment, there are some breaking problems with the GDExtension and it mainly has to do with cpp and FFmpeg.

The changes

As I already mentioned, a lot of changes have been happening since the past update. With the biggest one being haven a “working” video player and the first stage of the alpha being released.

Alpha: First stage problems

So the first stage went … better and worse then expected. There is a long list of bugs so let’s go over the main ones and why these bugs may be occuring.

Windows builds

At this moment, the Window builds are completely broken. The problem has to do with the compiling as the executable doesn’t know how to interact with the FFmpeg binaries. Problem is probably inside of scons and the way we compile everything but as long as I don’t have a Windows vm, this will be difficult to test and troubleshoot. This is an issue I want to look into soon, however the other issues are a bit more problematic and may need my attention first.

Last frames

The last frames of the video files are not being collected from FFmpeg. FFmpeg say’s that those frames can’t be found and just returns invalid images. One of the problems is the method we use to find the total number of frames. Apparently nb_frames is accurate, it’s our frame seeker and getter which aren’t functioning properly which were causing the strange issue of apparently “missing” frames in the back of the video.

At this moment I do not know how to solve this but this is a big issue which needs fixing quickly. Without a working debugging method, there is not other way then to put print statements everywhere which is an issue as prints don’t always get printed when Godot crashes, this is because prints get saved in an array and get printed when resources are available.

Codec support

We use FFmpeg so … we can use all codecs right? Not exactly, I mean we can … but just not out of the box as some video files have more info inside of them compared to others. Data such as duration, amount of video frames, … are sometimes missing for certain codecs as this isn’t a requirement.

Non square pixels

Some older video’s may have pixels which are 1.3 in size. The video shows 1440×1080 in format but playback is 1920×1080 because of the pixel not being a square. This is something which more modern camera’s don’t do anymore, but is still something to take in mind and implement just in case.

Interlaced video

Another relic from the past which we need support for, interlaced video’s. These will often have a real framerate which is exactly half of the average framerate. This type of footage is also quite difficult to work with as it acts similar to variable framerate footage.

Audio importing

Getting the audio from some video files doesn’t work and returns nothing, or only the first couple of seconds.

What we got working

I did manage to get a lot of things working during the last live-stream, which was split in 2 parts as I accidentally leaked the stream key ^^”. We got more codec support with all most common formats working now. We got threading working as well, which does fix the issue of print messages not printing completely when Godot crashes.

There is still the Variable frame-rate video issue, the pixel isn’t square issue, de-interlacing issue, … basically I still have enough work for the next coming months before Alpha stage 2 will come out.

Alpha stage 2

The to-do list for the next stage is basically as follows: (Items with a ‘?’ are maybe’s)

  • Windows support; (Will take some time and effort, not certain if for stage 2 or stage 3)
  • Maybe mac support?; (as apparently it’s not too different from Linux?)
  • Non square pixels; (Seems as something which I could fix with SWS)
  • Interlaced video?; (Seems as something which I could also possibly fix with SWS)
  • Codec support; (Full codec support for at least some of the most common codecs I may block others for the time being)
  • Last frames; (We need all frames and not just the last missing frames)
  • Audio?; (Not certain if this is a codec issue or not, if a codec issue this will get fixed in later versions)

And that’s it for this update, we are really getting closer and having this GDExtension work properly is important as the whole UI made in Godot is the easier part to work with. Let’s see if stage 2 comes by the end of next week. :p