FFMPEG and cinematics question

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
WaspUK1966
Posts: 135
Joined: Sat Aug 09, 2014 9:17 am

FFMPEG and cinematics question

Post by WaspUK1966 »

Hope you can help. I've created intro and ending cinematics for my LOG 2 mod using movie maker and saving them as MP4 files. I then used ffmpeg to convert these files to .IVF format to use in my mod (using the code sequence listed on the MODDING page for cinematics). I've tested the cinematics ingame and they work fine. However, for some reason, the colours of the .IVF files seem pale, and not like the original MP4 files. The black, for example, looks a more light grey and it spoils the affect somewhat. Why is this? Is it something to do with the compression settings I used etc? Can I correct it by changing a setting/value when using ffmpeg so the colours are true and not washed out? Any help greatly appreciated.

George
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: FFMPEG and cinematics question

Post by minmay »

Sounds like your ffmpeg profile either has a brightness change in it, or has too low of a gamma exponent.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
WaspUK1966
Posts: 135
Joined: Sat Aug 09, 2014 9:17 am

Re: FFMPEG and cinematics question

Post by WaspUK1966 »

The code I used in ffmpeg is this:

ffmpeg -i c:\users\george\pictures\gorgons_start.mp4 -vcodec libvpx -b 3000k -s 1920x1080 c:\users\george\pictures\gorgons_start.ivf

I havent changed anything as regards ffmpeg etc just modified the code given on here to fit my file name etc, so I'm not sure what you mean...
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: FFMPEG and cinematics question

Post by minmay »

Well, there's not really much else that could cause this.
It is possible that your video is too complicated to encode well at a constant 3000k bitrate at 1920x1080, which would result in "washed-out" colours among other things, but this probably wouldn't result in pure black turning to grey. See if this fixes the problem:

Code: Select all

ffmpeg -i c:\users\george\pictures\gorgons_start.mp4 -vcodec libvpx -crf 10 -s 1920x1080 c:\users\george\pictures\gorgons_start.ivf
The "-crf 10" tells the encoder to target a certain quality level (10) and choose the bitrate for each frame itself. If the resulting file is too large, you can increase the number (up to 63) to reduce the target quality and therefore the filesize. If the resulting file is too low-quality, you can decrease the number (down to 4).
Since you are not streaming this video, telling the encoder to use a fixed bitrate (like the example in the Creating Cinematics page) is probably a bad idea. You get more quality for your bytes by using variable bitrate. You can also provide both options to tell the encoder to use a variable bitrate, but cap the bitrate at a certain value:

Code: Select all

ffmpeg -i c:\users\george\pictures\gorgons_start.mp4 -vcodec libvpx -crf 24 -b 3000k -s 1920x1080 c:\users\george\pictures\gorgons_start.ivf
Also, just in case you aren't aware, if your original video's resolution is lower than 1920x1080, there is not really any compelling reason to force it to 1920x1080 and you can remove the -s 1920x1080 option.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
WaspUK1966
Posts: 135
Joined: Sat Aug 09, 2014 9:17 am

Re: FFMPEG and cinematics question

Post by WaspUK1966 »

Thanks for that, i'll give it a go and see what happens. My cinematics don't contain anything animated, they're just a sequence of pictures with text, nothing complicated. And my native res is 1920x1080. Will changing the res help?
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: FFMPEG and cinematics question

Post by minmay »

...
Why are you using videos if there's no animation involved?

Your computer's display resolution is completely irrelevant, I'm talking about the resolution of the video, which is what the -s option specifies.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: FFMPEG and cinematics question

Post by AndakRainor »

minmay wrote:Why are you using videos if there's no animation involved?
Don't videos allow dynamic memory management where pictures would eat permanently some precious space ?
User avatar
THOM
Posts: 1281
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: FFMPEG and cinematics question

Post by THOM »

minmay wrote:...
Why are you using videos if there's no animation involved?

Because, there is no other way in Log2 to do cinematics?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
WaspUK1966
Posts: 135
Joined: Sat Aug 09, 2014 9:17 am

Re: FFMPEG and cinematics question

Post by WaspUK1966 »

As regards what was said above, I'm only using the code on the MODDING page as is, as I'm led to believe (as THOM says) that it is the only way I can get images and music to work as intro/out sequences in LOG 2, irrespective wether the images are static or moving. As stated, the intro/ending sequences I've created work fine, I was just querying the slight colour wash-out on the final .IVF file, especially the black, which is does not look like true black but rather a lighter version. If there is another way to run both music and picture sequences at the start/end of my game WITHOUT using ffmpeg, then please let me know.
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: FFMPEG and cinematics question

Post by minmay »

Use GameMode.playStream() to play the music and PartyComponent.onDrawGui() to show the pictures. It's really easy. There's even a cinematics module in GrimTK that will do it for you.
AndakRainor wrote:Don't videos allow dynamic memory management where pictures would eat permanently some precious space ?
I just tested this, and the answer is no. Textures aren't loaded until they are actually needed, and are "garbage collected" around a minute after that. As long as you actually stop using the texture after you're done, it'll be fine.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Post Reply