[Part 6] Making a Video Player in Godot with FFmpeg - Tutorial

  Рет қаралды 145

Voylin's GameDev Journey

Voylin's GameDev Journey

Күн бұрын

Getting the actual visible video frames, the time has finally come to work on this! We are actually halfway this series now in terms of functionality and making things work. I say halfway because I have some ideas to extend this series to 12 episodes, but for the time being I'll probable stop at 8-9 and only continue if there is a lot of support for this series. ^^
Subscribe to stay up to date with the next parts of this tutorial series ;)
Playlist: • Tutorial - Video playe...
GitHub repo: github.com/VoylinsGamedevJour...
Support me: ko-fi.com/voylin
My main channel: / @voylinslife
Discord group: / discord
Github: github.com/voylin
Github organization: github.com/VoylinsGamedevJourney
GoZen repo: github.com/VoylinsGamedevJour...
GoZen sub-reddit: / gozen
Chapters:
0:00 Intro
0:18 Multi-threading
1:01 Check multi-threading
1:36 Compiling talk
2:31 YUV vs RGB
3:32 SWS Context
7:02 Creating some functions
9:15 Next_frame function
15:53 Preparing byte array
19:07 Continue next_frame function
23:07 Seeing frames in Godot
24:18 Explaining what's wrong
27:07 Explaining future problem
My Camera Setup
Canon EOS 200D: amzn.to/4btaUqP
Panasonic hc-v808: amzn.to/3w82MMo
Canon S120: amzn.to/3ug5uit
My PC Setup
Cooler master TD300 mesh case: amzn.to/3w85rpl
AMD Ryzen 5 2600: amzn.to/42uYVFb
Gigabyte B450M s2h: amzn.to/487gM6f
16GB Corsair Vengeance RAM: amzn.to/42wNTPV
Nvidia GTX760: amzn.to/4881Ch2
Fifine Mic: amzn.to/49tuZvF
#godot #godot4 #indiedev

Пікірлер: 10
@meneldal
@meneldal Ай бұрын
Another great tutorial on how to use ffmpeg. I remember the pain. One thing that I did that helped a bit my sanity was to use `std::unique_ptr` with custom deleters on all the ffmpeg stuff, which cleans up the code a fair bit and makes it harder to leak memory (cause it is really easy to leak memory with ffmpeg when you have nested types). For pixel formats, typically packed RGB is a pain to use, I think if you can using RGB with empty alpha channel to align it on the 32-bit boundary performs better. You can do some pretty impressive assembly magic for unpacking the values but it is still a pain. A bit of correction on the planar format thing terminology. Planar means that every pixel of the same color is next to each other, you basically have 3 arrays. It is usually YUV but it doesn't have to (RGB planar does exist). It's used a lot in video codecs since each block does transform on each channel so keeping the channels in different arrays is easier, you won't need to read modify write pixels. On the other hand you have what is commonly used for displaying the images, pixel formats where all the values are together. They can be packed in weird ways, especially when you have 10/12 bits, but when you actually want to do some processing with them you won't break the byte boundary. Packed YUV is also somewhat common, especially YUYV for 4:2:2
@VoylinsGamedevJourney
@VoylinsGamedevJourney Ай бұрын
Thanks for the much better explanation about the image formats! I haven't done much yet with unique pointers and didn't know about those deleters. It's something I'll try reading more about and possibly implementing it inside of the GDExtension for GoZen ^^ Thanks for the tip! On first sight, looks better compared to what I have now :p
@meneldal
@meneldal Ай бұрын
@@VoylinsGamedevJourney It's still hard to get it right, and I'm pretty sure I was leaking a fair bit but not enough to be an issue. I was doing the other way around though (recording data from the application). There are probably optimizations that can be done to avoid allocating for each frame, outside of very exotic video formats, you're not changing the size of a frame after you open the video, so you could allocate everything on video open for example (and just free the buffers on closing the video). There are also further tricks like keeping a buffer of a few frames in advance and have the video decoding by entirely handled by a background thread so it never hogs the main thread, but maybe that's part of the plan for your future videos since you talked about synchronizing playback.
@VoylinsGamedevJourney
@VoylinsGamedevJourney Ай бұрын
@@meneldal That's actually something I have been thinking of implementing for GoZen, but at this moment I don't seem to run into performance issues, but there's always room for improving things ^^ I do think that maybe on video open we should already get the audio, put it in a variable and remove the SWR stuff and other audio pointers. FFmpeg is a great library, but difficult to get the hang off, still great that it even exists though ^^
@meneldal
@meneldal Ай бұрын
@@VoylinsGamedevJourney It's definitely a lot of extra work to implement for sure. The biggest reason keeping a buffer can be useful is decoding time is not constant, so if your computer isn't powerful enough some frames could take more than they have to be decoded. I doubt you'd run into any issue with 1080p but for 4k it definitely can happen.
@VoylinsGamedevJourney
@VoylinsGamedevJourney Ай бұрын
KdenLive keeps making the quality of my video camera kind of bad ^^" Also, only 3 parts left!!! Congratulations for making it this far in this series!! :D
@stuntfax9004
@stuntfax9004 Ай бұрын
Hey voylin thanks for answering my last question, do u plan on getting rich of this project?
@VoylinsGamedevJourney
@VoylinsGamedevJourney Ай бұрын
Haha rich? All my projects are open source, so free for everybody. only way for me to earn anything is through ko-fi 😅 I don't even have monetisation in this channel yet 😅
@stuntfax9004
@stuntfax9004 Ай бұрын
@@VoylinsGamedevJourney you should do the first year not open source and make bank then make it open source but that’s just me
@meneldal
@meneldal Ай бұрын
@@stuntfax9004 I believe he said that it wouldn't be possible because ffmpeg is under the GPL, unless you want to replace libcalls suffering by linux pipes suffering.
[Part 7] Making a Video Player in Godot with FFmpeg - Tutorial
18:54
Voylin's GameDev Journey
Рет қаралды 126
Hush Engine Demo - Backdrop Build v4
12:15
Nef
Рет қаралды 18
Backstage 🤫 tutorial #elsarca #tiktok
00:13
Elsa Arca
Рет қаралды 32 МЛН
PINK STEERING STEERING CAR
00:31
Levsob
Рет қаралды 17 МЛН
Can you beat this impossible game?
00:13
LOL
Рет қаралды 67 МЛН
How to install ImageJ on a Chromebook
5:55
Chrome OS Made Simple
Рет қаралды 3
[Part 1] Making a Video Player in Godot with FFmpeg - Tutorial
13:59
Voylin's GameDev Journey
Рет қаралды 565
I got a 5$ Laptop...
6:18
Tech86
Рет қаралды 14 М.
I learned to type ... AGAIN
8:39
Voylin's GameDev Journey
Рет қаралды 523
i taught myself to code in 4 months
8:56
Joe Clements
Рет қаралды 8 М.
Apple Just Integrated ChatGPT and Elon Musk is Furious!
8:08
AI Revolution
Рет қаралды 15 М.
Put Yourself In An Animated Film For FREE With This Tool
8:36
The Most HATED Image Format
11:45
ThioJoe
Рет қаралды 12 М.
[Part 4] Making a Video Player in Godot with FFmpeg - Tutorial
51:38
Voylin's GameDev Journey
Рет қаралды 172
Backstage 🤫 tutorial #elsarca #tiktok
00:13
Elsa Arca
Рет қаралды 32 МЛН