问题解答

永久分享链接:百度网盘 请输入提取码 提取码:t6ua

Plugin'UEVideoRecorder'failed to load because module 'UEVideoRecorder'could not be loaded错误多为ffmpeg的dll没有拷贝,editor模式下需要将dll放在项目的Binaries\Win64目录下,runtime运行情况下需要将dll放在exe根目录下

此录屏为游戏画面录屏,不录制UMG,需要音视频混合的朋友,可以同步录制音频,结束录制的时候调用ffmpeg进行混合

2022.1.17示例项目更新

1.添加了对4.24+的兼容

2.插件内dll添加了自动拷贝到运行目录及添加到运行时,防止出现Plugin'UEVideoRecorder'failed to load because module 'UEVideoRecorder'could not be loaded错误

永久分享链接:https://pan.baidu.com/s/12SQnywLUzgLBK88DKJ2a0Q 
提取码:w36d

UE引用插件流程

1. 下载ue录屏插件 并解压到Plugins目录

GitHub - ash3D/UEVideoRecorder: Video record and screenshot taking plugin for Unreal Engine 4.

2. 下载录屏实现lib工程

GitHub - ash3D/VideoRecorder: Static library for video recording and screenshots taking.

打开项目并编译出供UE使用的第三方lib库 VideoRecorder.lib

将编译的lib和include拷贝到项目ThirdParty(与Plugins同级)目录下

3. 下载FFmpeg SDK.

FFmpeg

  1. 下载FFmpeg  Dll(dll在项目运行同级目录下要放 运行时需调用)
    https://ffmpeg.zeranoe.com/builds/  
  2. 下载 Boost.并解压到项目ThirdParty(与Plugins同级)目录下
    https://www.boost.org/

1. 在项目的Source / ThirdParty 创建脚本boost.Build.cs

using UnrealBuildTool;
public class boost : ModuleRules
{
    public boost(ReadOnlyTargetRules Target) : base(Target)
    {
        Type = ModuleType.External;

        const string LibraryPath = "../ThirdParty/boost_1_70_0";

        PublicIncludePaths.Add(LibraryPath);
    }
}

2. 在项目的Source / ThirdParty 创建脚本 VideoRecorder.Build.cs

using UnrealBuildTool;
using System.IO;

public class VideoRecorder : ModuleRules
{
    public VideoRecorder(ReadOnlyTargetRules Target) : base(Target)
    {
        Type = ModuleType.External;

        const string LibraryPath = "../ThirdParty/VideoRecorder";

        PublicIncludePaths.Add(Path.Combine(LibraryPath, "include"));

        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            PublicLibraryPaths.Add(Path.Combine(LibraryPath, "lib", "x64", "Release"));
            PublicAdditionalLibraries.Add("VideoRecorder.lib");
        }
    }
}

设置GameViewportClass为视频录制的view 否则会使录制失效

在场景中添加VideoRecorderActor,并提升为蓝图

开始录制(1.filename需写入完整路径 可以使用GetProjectDirectory来获取相对路径 2.不要在begin里面开始 会无法成功启动 Actor需要准备)

停止录制

VideoRecorder.lib编译流程

打开VideoRecorder.sln

添加用户自定义宏

BOOS_ROOT

FFMPEG_ROOT

调整编译器参数

异常处理

下载zip的时候会下载不到DirectXTex部分 需手动添加拷贝放入

没有将“__cplusplus”定义为预处理器宏,用“0”替换“#if/#elif”解决方法

在*.build.cs里加 bEnableUndefinedIdentifierWarnings = false;

Log打印方法报Formatting string must be a TCHAR array错误


Logger<>::Log(__FILE__, __LINE__, VideoRecorder.GetCategoryName(), verbosity, msgStr.c_str());

修改为

const wchar_t* w = msgStr.c_str();
    Logger<>::Log(__FILE__, __LINE__, VideoRecorder.GetCategoryName(), verbosity, TEXT("%s"),w);

Logo

苏州本地的技术开发者社区,在这里可以交流本地的好吃好玩的,可以交流技术,可以交流招聘等等,没啥限制。

更多推荐