90% of ad revenue goes to creators. Go ad-free while supporting creators with Modrinth Plus. Subscribe today!
MediaPlayer
A decode library for Minecraft based on ffmpeg.
Features:
- Video and audio decoder
- Hardware acceleration
- Supports many media formats
- Only Windows x64 platform is supported
How to use:
For user
Use the commands
/summon mediaplayer:video
/mediaplayer video
to play video.
Or use
/mediaplayer audio
to play audio.
Use
/mediaplayer clear
stop all video and audio.
For developer
Create decoder
var file = new File("<video file path>");
var decoder = VideoDecoder.create(file);
Decode and render frame
decoder.fetch();
bufferSource.getBuffer(VideoRenderType.create(decoder.frame));
/* Rendering code */
Play companion audio from video
Minecraft.getInstance().getSoundManager().play(new AudioInstance(decoder.audio.decode(false), null));
Play independent audio
Minecraft.getInstance().getSoundManager().play(new AudioInstance(new AudioDecoder.decode(false), null));