libgdx / gdx-video

A libGDX cross platform video rendering extension
Apache License 2.0
147 stars 50 forks source link

Exception: Could not open file! #42

Closed JuKu closed 3 years ago

JuKu commented 7 years ago

Hi,

I have tried to play an MP4 video, but there i get this exception:

java.lang.Exception: Could not open file!
    at com.badlogic.gdx.video.VideoDecoder.loadStream(Native Method)
    at com.badlogic.gdx.video.VideoPlayerDesktop.play(VideoPlayerDesktop.java:140)
    at com.pentaquin.gameclient.gamestate.IntroScene.initialize(IntroScene.java:69)
    at com.pentaquin.gameclient.Game.initialize(Game.java:48)
    at com.pentaquin.engine.adapter.GameAdapter.create(GameAdapter.java:47)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:149)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
Exception in thread "LWJGL Application" java.lang.NullPointerException
    at com.badlogic.gdx.video.VideoPlayerDesktop.renderTexture(VideoPlayerDesktop.java:249)
    at com.badlogic.gdx.video.VideoPlayerDesktop.render(VideoPlayerDesktop.java:228)
    at com.pentaquin.gameclient.gamestate.IntroScene.draw(IntroScene.java:238)
    at com.pentaquin.engine.component.scene.SceneComponent.draw(SceneComponent.java:45)
    at com.pentaquin.engine.adapter.GameAdapter.beforeDraw(GameAdapter.java:166)
    at com.pentaquin.engine.adapter.GameAdapter.render(GameAdapter.java:58)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)
[VideoPlayer::loadFile] Error opening file: Invalid data found when processing input

@Robbiedobbie Which file formats are supported?

JuKu commented 7 years ago

How i play the video:

//on initialization
VideoPlayer videoPlayer = VideoPlayerCreator.createVideoPlayer(viewport);
try {
    this.videoPlayer.play(Gdx.files.absolute("./data/video/intro_sequence.mp4"));
} catch (FileNotFoundException e) {
    e.printStackTrace();
}

//...

//in gameloop
videoPlayer.render();
RBogie commented 7 years ago

The codec is not supported in the prebuild ffmpeg. To play it safe with licensing, the initial prebuild ffmpeg for the desktop player only supports webm/ogg video. If you want other codecs, you'll have to build your own ffmpeg for now.

SimonIT commented 3 years ago

Look at #68 for some current building hints