UE 录屏自动化上传阿里云OSS

本文介绍了如何在UE5.3中通过Texture2D存储每一帧图片,然后利用本地Python执行文件封装视频并上传到OSS。作者分享了从创建插件、编写蓝prints到测试执行的详细步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前言

       最近在做一个功能,然后就发现了一个很有趣的东西,虽然在一定程度上属于偷懒,但是在一些短频快的应用中还是很适用的,下面我就针对于这个测试做一些简单的分享,希望帮助到大家,在实际的开发中获得一些灵感和帮助,具体的实现方式,UE通过Texture2D将每一帧的图片存储到本地,存完以后调用一个本地PythonEXE执行文件进行视频封装和OSS上传,我这里使用的版本UE5.3,大家根据代码自己调试下。

UE开发调试过程

  1. 新建一个带有C++内容的项目,因为有一些代码功能需要用到C++,我这里的名称因为创建过了所以有个提示。
  2. 然后在Edit -> Plugins -> Add点击新建一个BlueprintLibeary的插件,因为我个人写一些封装性功能的时候喜欢用插件,这样其他的项目用到的时候直接导入调用就可以了,如果你想在类里面使用的话创建一个BlueprintFunctionLibrary的类就可以了。
  3. 创建完插件后,会在VistualStudio中提示,直接点全部加载,然后点击全部保存关闭项目,因为有时候有些编译会有问题,在UE和VS都关闭的状态下,在你的工程根目录打开sln的VS主文件,我们直接进行操作
  4. 接下来在插件中TextureVideoBPLibrary.h和TextureVideoBPLibrary.cpp中,我们添加两个功能,打开.h文件将原有的函数进行删除然后添加我们新的函数
    // Copyright Epic Games, Inc. All Rights Reserved.
    
    #pragma once
    
    #include "Kismet/BlueprintFunctionLibrary.h"
    #include "TextureVideoBPLibrary.generated.h"
    
    /* 
    *	Function library class.
    *	Each function in it is expected to be static and represents blueprint node that can be called in any blueprint.
    *
    *	When declaring function you can define metadata for the node. Key function specifiers will be BlueprintPure and BlueprintCallable.
    *	BlueprintPure - means the function does not affect the owning object in any way and thus creates a node without Exec pins.
    *	BlueprintCallable - makes a function which can be executed in Blueprints - Thus it has Exec pins.
    *	DisplayName - full name of the node, shown when you mouse over the node and in the blueprint drop down menu.
    *				Its lets you name the node using characters not allowed in C++ function names.
    *	CompactNodeTitle - the word(s) that appear on the node.
    *	Keywords -	the list o
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值