does anybody know how to trigger the playing of an .avi file? i already have it located on assets/modid/video(package i created). how can i trigger the playing of it? I would like to click on a block and have the moie play and then end. i know I must use onRightClick() in block. has anybody ever gotten a video to play?
There's no such functionality in Minecraft as far as I know so you'd have to implement video playback yourself. Unless you're proficient in modern OpenGL and programming in general you're going have a really hard time doing so.
In short you will have to do the following:
Stream the video file data (frames) into some data (textures) that OpenGL can handle.
Draw the frame contents into a framebuffer object.
Use the framebuffer object's texture attachment for rendering onto the block.
Sure, OpenGl can do everything you want. But you'll have to do it yourself, that is reading the contents of the gif file, frame by frame, and drawing it at a capped framerate. With GIFImageReader, GIFImageReaderSpi and that alike.
ogg and ogv are just containers, not actual videos (vorbis is the audio codec) and could contain AVC/H.264 for video, for example.
This is a pretty advanced realm. You could use Java bindings for FFMpeg too (albeit it's somewhat incomplete) which can support a wide range of video formats. But if it's a short/small animation, animating a sprite is far easier (a drawing loop with counter which increments u/v per frame).
ogg and ogv are just containers, not actual videos (vorbis is the audio codec) and could contain AVC/H.264 for video, for example.
This is a pretty advanced realm. You could use Java bindings for FFMpeg too (albeit it's somewhat incomplete) which can support a wide range of video formats. But if it's a short/small animation, animating a sprite is far easier (a drawing loop with counter which increments u/v per frame).
Frame rate and resolution? Though if it were averaged to 20FPS, that's 320 total frames - so even if it were a 64x64 video, the size of the sprite would need to be 20480px.... which is clearly not possible
Maybe going the route of a GIF is better though, it would be much faster and easier to decode than a video. Although GIF's are limited to a 256 color palette too, so it'd have to dither well. (Technically, GIF's can support > 256 colours via a "chunk rendering" method, funnily enough - but the technicals behind this - and probably the drop in performance - remind me of Amiga's HAM mode so I don't recommend depending on this - although I could be completely wrong, given relatively modern invention of the Framebuffer in OpenGL... but I digress).
So... GIF animating libraries for Java. I don't have any suggestions... but if you're able to do a 256-color GIF of the video instead, and it looks OK when you encode it, then that's a good way to go I think.
Frame rate and resolution? Though if it were averaged to 20FPS, that's 320 total frames - so even if it were a 64x64 video, the size of the sprite would need to be 20480px.... which is clearly not possible
Maybe going the route of a GIF is better though, it would be much faster and easier to decode than a video. Although GIF's are limited to a 256 color palette too, so it'd have to dither well. (Technically, GIF's can support > 256 colours via a "chunk rendering" method, funnily enough - but the technicals behind this - and probably the drop in performance - remind me of Amiga's HAM mode so I don't recommend depending on this - although I could be completely wrong, given relatively modern invention of the Framebuffer in OpenGL... but I digress).
So... GIF animating libraries for Java. I don't have any suggestions... but if you're able to do a 256-color GIF of the video instead, and it looks OK when you encode it, then that's a good way to go I think.
If that were a GIF, it would indeed suffer. GIF's are not compressed much at all, and for it to be a decent quality/resolution it'd probably be over 10MB for the GIF.
You could render it in OpenGL yeah, that'd be ideal - far better quality, you can add some randomness to it, and you could do some fancy stuff to morph it in/out of the world, things like that. I don't know much about that either. I imagine it's a bit more complex than playing a video, but it's far more useful.
well, coud it display a Gif?
what is GIFImageReader and GIFImageReaderSpi?
Art by me: MrPancakeWolfie@DeviantArt
i mean .ogv .
For example, the tv mod uses Xuggler.
Art by me: MrPancakeWolfie@DeviantArt
i was hopig there was a way to do it without APi or Libraries.
This is a pretty advanced realm. You could use Java bindings for FFMpeg too (albeit it's somewhat incomplete) which can support a wide range of video formats. But if it's a short/small animation, animating a sprite is far easier (a drawing loop with counter which increments u/v per frame).
the video is 16 seconds long.
Maybe going the route of a GIF is better though, it would be much faster and easier to decode than a video. Although GIF's are limited to a 256 color palette too, so it'd have to dither well. (Technically, GIF's can support > 256 colours via a "chunk rendering" method, funnily enough - but the technicals behind this - and probably the drop in performance - remind me of Amiga's HAM mode so I don't recommend depending on this - although I could be completely wrong, given relatively modern invention of the Framebuffer in OpenGL... but I digress).
So... GIF animating libraries for Java. I don't have any suggestions... but if you're able to do a 256-color GIF of the video instead, and it looks OK when you encode it, then that's a good way to go I think.
EDIT: There are other ways to make animated textures.
well,, about the gif, Will it be to compromising? because my video only has 1 color, blue(it also has multiple shades). here's a video:
If that were a GIF, it would indeed suffer. GIF's are not compressed much at all, and for it to be a decent quality/resolution it'd probably be over 10MB for the GIF.
You could render it in OpenGL yeah, that'd be ideal - far better quality, you can add some randomness to it, and you could do some fancy stuff to morph it in/out of the world, things like that. I don't know much about that either. I imagine it's a bit more complex than playing a video, but it's far more useful.