Video Plays in Engine/Profile Build but Shows Black Screen in Release Build

I have a video (VP8 .webm ) that plays fine when I run my level in the editor but shows up as a black screen in a release build. I am not sure what else to provide here, so here is what I have done so far:

  • Verified that the VideoPlaybackGem was a part of my project
  • Verified that the 3rdParty/FFMPEG folder had the FFMPEG stuff
  • Rebuilt the profile/all and release/game and engine builds
  • Reran both the shader and PC .bat files for my game, and confirmed that everything completed successfully
  • Ran the “Export to Engine” thing in the editor
  • Verified that the levels.pak file had been moved over successfully
  • Verified that the .dll files for FFMPEG were also in the executable directory
  • Verified that “+map mapname” is being used in my shortcut to launch (the game itself launches fine)
    I should also add that while the Video Playback component is on a 3D object, the object that actually shows the video is in the UI.

Anyone else have this problem/a workaround? I saw this one for VR, but they were using the editor.

@petrocket

Thank you for taking the time to track down this problem and answer this question. I just tried this on the 1.13 build for Lumberyard and it worked! Hopefully this saves everyone else a lot of hassle.

Hi @Roosevelt.Boyland

This is a cross-post from your question about render targets that is also relevant to this question.

I believe the problem may be that the video playback gem does not find the webm video file in the level .pak - to fix this try placing your .webm file outside the .pak file with the same folder path it had before.

For example if your .webm file is in

c:\Amazon\Lumberyard\1.4.0.1\dev\MyProject\Levels\test\MyMovie.webm

and your folder with all the built PAK files is

c:\Amazon\Lumberyard\1.4.0.1\dev\MyProjectPaks_PC

place the file in

c:\Amazon\Lumberyard.1.4.0.1\dev\MyProjectPaks_PC\MyProject\Levels\test\MyMovie.webm

@petrocket

Is this issue remaining in 1.27.1.0?
I heard this caused by ffmpeg can not access to inside pak, but Lumberyard passing the video file path to ffmpeg even its in the pak.

Anyway, My situation is similar to this topic, I need to deliver the release build to my customer with video playback in the 3D and I want to encript the video in the pak file instead of regular file for contents protection purpose.
But I get black screen on release build.

Any suggestions?

Hi @Soeda , I think the key here is to modify Decoder.cpp to use AZ::IO::FileIOStream which should be able to read the file from AZ::IO::CryPakFileIO - this is the default FileIOBase set in SystemInit.cpp

AZ::u64 fileSize;
if (!AZ::IO::FileIOBase::GetInstance()->Size(filename, fileSize))
{
    m_LastError.Format("Failed to retrieve file size for '%s'", filename);
    return false;
}

char *buffer = new char[fileSize];
AZ::IO::FileIOStream stream(filename, AZ::IO::OpenMode::ModeRead);
if (stream.Read(fileSize, buffer) != fileSize)
{
    m_LastError.Format("Failed to read %u bytes from file '%s'", fileSize, filename);
    return false;
}
... use the buffer for video playback ...

Here’s an example which shows how to use libav to read from memory:

Currently the Decoder loads the file using avformat_open_input given the filename path

I hope this helps, if you’re successful , it’d make a nice pull request :slight_smile:

2 Likes

Thank you for pointing me to information, I will take a look and try to implement it.
If it will go well then I will send a pull request.

Basically, this approach seems working, with additional issues.

I could load the AVI in the pak with release client, but failed to load MP4. It requires more research for ffmpeg codec handlings, but AVI is enough for us at this moment.

Additionally, LoadVideo function is called at the component Activate timing, that results memory issue on our target platform, so I need to modify VideoPlaybackGameComponent to implement the delay video load eventually.

Thank you.

1 Like