Skip to content

Instantly share code, notes, and snippets.

@derofim
Created April 21, 2017 19:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derofim/5007d0d7ac270aaab90de86ddde58500 to your computer and use it in GitHub Desktop.
Save derofim/5007d0d7ac270aaab90de86ddde58500 to your computer and use it in GitHub Desktop.
UE4 Video Plane

Creating Video material & Sound.

@derofim
Copy link
Author

derofim commented Apr 21, 2017

Install ffmpeg https://ffmpeg.org/download.html
You may need Microsoft Visual C++ (Redistributable Package) to install ffmpeg
image
image
Add ;c:\ffmpeg\bin to PATH (change to ffmpeg bin folder)
image

@derofim
Copy link
Author

derofim commented Apr 21, 2017

Convert video file to unreal supportable mp4 format:
ffmpeg -i "input.mp4" -c:v libx264 -preset veryslow output.mp4

Extract audio from video file:
ffmpeg -i input.mp4 output.wav

Or Convert audio file to unreal supportable wav format:
ffmpeg -i input.mp3 -acodec pcm_s16le -ac 1 -ar 16000 output.wav

@derofim
Copy link
Author

derofim commented Apr 21, 2017

Import wav audio (as Sound Wave) and mp4 video (as Media Source).

Create new new Media Player asset as in https://docs.unrealengine.com/latest/INT/Engine/MediaFramework/HowTo/FileMediaSource/.
Open created Media Player.
Set "Play on Open" and Loop" to true.
Check Sound Wave and Video Texture.

Create Media Texture from Media Player.
image
Create Material from Media Texture.
image

Add Emmisive Color to Material.
image

Open Level Blueprint.
Add MediaPlayer variable of type Media Player.
Save All.
Set varible "Media Player" field to created Media Player.
"OnBeginPlay""->"OpenSource"->"Media Player"
image
Set "OpenSource" field "Media Source" to created "File Media Source".

Apply video material to game object. Save all and check in "Simulate" mode .

Drag imported "Sound Wave" to Game.
Set "Override Attenuation" and set proper "radius" and "falloff distance".
Set "Auto Activate" to true.

Click right mouse button at "Sound Wave" and choose "Edit" in Content Browser:
image

Set "Looping" to true.
image

Or create sound class and set Always Play to true.
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment