Page 1 of 1

FFMPEG and cinematics question

Posted: Sat Mar 12, 2016 1:20 pm
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

Re: FFMPEG and cinematics question

Posted: Sat Mar 12, 2016 1:35 pm
by minmay
Sounds like your ffmpeg profile either has a brightness change in it, or has too low of a gamma exponent.

Re: FFMPEG and cinematics question

Posted: Sat Mar 12, 2016 2:13 pm
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...

Re: FFMPEG and cinematics question

Posted: Sat Mar 12, 2016 11:48 pm
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.

Re: FFMPEG and cinematics question

Posted: Sun Mar 13, 2016 10:31 am
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?

Re: FFMPEG and cinematics question

Posted: Sun Mar 13, 2016 12:08 pm
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.

Re: FFMPEG and cinematics question

Posted: Sun Mar 13, 2016 1:43 pm
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 ?

Re: FFMPEG and cinematics question

Posted: Sun Mar 13, 2016 1:52 pm
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?

Re: FFMPEG and cinematics question

Posted: Sun Mar 13, 2016 6:05 pm
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.

Re: FFMPEG and cinematics question

Posted: Mon Mar 14, 2016 12:08 am
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.