ali-alidoust / gta5-extended-video-export

GTA V Video Export Enhancement
Apache License 2.0
25 stars 17 forks source link

EVE crashing on FiveM #13

Closed kasuganosoras closed 2 years ago

kasuganosoras commented 2 years ago

I'm trying to find out what cause the EVE crashing on FiveM, here are the issues I found:

ENBSeries

If you installed ENBSeries, then FiveM will prevent the script to register the present callback:

The following two Present errors are perfectly normal and are to work around a bug in ENBSeries
IDXGISwapChain::Present failed: 887a0001
IDXGISwapChain::Present failed: 887a0001

The codes are in fivem/code/components/rage-graphics-five/src/GfxFixups.cpp:312

Edit: This is a ENB issue, not EVE, ignore it.

Voukoder

Cannot create voukoder interface instance:

gta5-extended-video-export/encoder.cpp:118

Microsoft::WRL::ComPtr<IVoukoder> m_pVoukoder = nullptr;
REQUIRE(CoCreateInstance(CLSID_CoVoukoder, NULL, CLSCTX_INPROC_SERVER, IID_IVoukoder,
                             (void**)m_pVoukoder.GetAddressOf()),
            "Failed to create an instance of IVoukoder interface.");

The CoCreateInstance is always return 0x80040154 (class not registered), then it crashes the game.

Fix

Sadly, I can't fix it, I'm not professional for C++, here are all things I tried to fix:

01 Check if the swap chain not be NULL in OMSetRenderTargets gta5-extended-video-export/script.cpp:629

if (::exportContext->pSwapChain != NULL) {
    LOG_CALL(LL_DBG, ::exportContext->pSwapChain->Present(
                         0, DXGI_PRESENT_TEST)); // IMPORTANT: This call makes ENB and ReShade effects to be
                                                 // applied to the render target
}

02 Fallback to default resolution if DXGI_SWAP_CHAIN_DESC is NULL gta5-extended-video-export/script.cpp:868

if (desc.BufferDesc.Width != NULL) {
    REQUIRE(encodingSession->createContext(vkConfig, std::wstring(filename.begin(), filename.end()),
                                           desc.BufferDesc.Width, desc.BufferDesc.Height, "bgra",
                                           fps_num, fps_den, numChannels, sampleRate, "s16",
                                           blockAlignment),
            "Failed to create encoding context.");
} else {
    LOG(LL_ERR, "No such buffer desc, fallback to default size 1920x1080");
    int bufferWidth, bufferHeight;
    bufferWidth = 1920;
    bufferHeight = 1080;
    REQUIRE(encodingSession->createContext(vkConfig, std::wstring(filename.begin(), filename.end()),
                                           bufferWidth, bufferHeight, "bgra", fps_num, fps_den,
                                           numChannels, sampleRate, "s16", blockAlignment),
            "Failed to create encoding context.");
}

Thanks for your great work.

ali-alidoust commented 2 years ago

Can you help me with this issue? I don't know why the EVE logs are not saved when using FiveM.

kasuganosoras commented 2 years ago

Hi. The EVE logs will save to <GTAV folder>\EVE\. You also need to place the EVE folder to FiveM\FiveM.app\data\cache\subprocess\ to make it work. Here is a tutorial for install EVE in FiveM: https://forum.cfx.re/t/how-to-use-extended-video-export-eve-fivem/2581771

ali-alidoust commented 2 years ago

I'm getting this log in FiveM:

[      3813] [b2545_GTAProce]             MainThrd/ Unable to load \AppData\Local\FiveM\FiveM.app\plugins\ExtendedVideoExport.asi - this ASI plugin does not claim to support game build 2545. If you have access to its source code, add `FX_ASI_BUILD 2545 dummy.txt` to the .rc file when building this plugin. If not, contact its maintainer.

Is there anyway to bypass it? I'm not very fond of updating the mod for every single build of the game.

kasuganosoras commented 2 years ago

You should change your game build to 1604:

  1. go to FiveM/FiveM.app/
  2. open CitizenFX.ini
  3. change or add SavedBuildNumber=1604
  4. save it and restart your game, it should switch to 1604 build.

Another way is adding 2545 build support for it, here is a quick tutorial: https://forum.cfx.re/t/simple-trainer-wont-show-up/4183132/3

ali-alidoust commented 2 years ago

I managed to debug it and realized presentCallbackRegister() function in FiveM is just a stub and does not hook IDXGISwapBuffer::Present() at all. Unless I find an easy way to get the swap buffer, it's not possible to support FiveM.

kasuganosoras commented 2 years ago

Okay... but I'm searching all the codes, looks like the SwapChain are only use for getting output width and height? Maybe you can add an option to the configuration file to set the output size manually?

ali-alidoust commented 2 years ago

I managed to get SwapChain in the latest update in refactor branch. I'm closing this issue and will ship the support in the next release.

Mikaa6 commented 2 years ago

Sorry to re-open this topic, but i am a content creator on a FiveM RP Server. I use the Rockstar Editor to record my footage and modify it into the R* Editor after.

But i see that Logic Films use EVE for their footage and it's could be a very nice script for me. Actually i can't export my footage with ReShade filters, and it's very complicated.

When i launch the R* Editor, i have a error line in the log, who says that FiveM can't load the plugin and ask me to write a new line in the .RC file of the plugin :/

I search for hours but i don't find the .rc file

That's why i ask some help here, so if someone have an idea how can i fix this issues :)

Have a nice day/night

kasuganosoras commented 2 years ago

Hi, I clone the newest codes and build it, but now it was still crashing when I export the video. The logs say: Failed to open Voukoder context. I installed the Voukoder 11.3.2 and 10.2 and they all not working. Did I use wrong version of Voukoder?