is video playback in java really as complicated as it seems?

what also strikes me - there have to be java games with video playback
dont think minecraft has video
but what about other big games like wakfu and spiral knights ? I’m sure they have something

so Wakfu uses xuggler apparently
does anyone here has any experience with it ?

Yes. It works. Big piece of complicated native code. Based off of ffmpeg. Has licensing issues with some formats.

Cas :slight_smile:

Yeah you cant even download the jar anymore, you have to build it yourself
its all… exhausting

Well thats a given - gotta go Theora and OGG Vorbis.

Which is why I’m looking into cortado again.
Being an Applet sucks - but if I can get the frames to render in OpenGL…
and for sync, well, if you do play audio and video separately, it never appears to have a problem
going try some more cortado…

there is a site requesting more codecs for javafx 2 obviously, saying

[quote]The on2 Vp6 codec not only is unsupported, but is also not that much of a platform dependent format (the encoder library exists only as a dll vp6vfw.dll and nothing else). It defeats the purpose of the end-goal of JavaFx.
[/quote]
we wrote some code to get cortado working right, or to be more precise jheora with the help of POGG

it basically boils down to these problems:

  • you would have to do audio sync yourself, because only theora files without audio work reliably
  • also its too slow, decoding the video is just too slow, something like a 800x500 video on a 2,4ghz single core and it does stutter here and there, which of course doesnt help sync

the only way out, that I can see - is writing some piece of xuggler code with uses theora because of the licensing

stuff like VLCJ works in theory, but only if you wanna GPL your code and everything

but now, there arent even xuggler builds any more to download, you have to build it yourself somehow
now, i cannot even start coding using Xuggler because the set-up is so complex - and apart from getting it to work, I do have to understand it a little to deploy it, so that it would work on all users PCs, regardless of what they have installed
which is what I could say about VLCJ, but again there are other issues there…

Hmm I’m a little surprised about the speed - contrary to popular believe Java’s pretty reasonable at number crunching tasks - I should think it came in at around 50% of the speed of optimised C code for a decoder… maybe more work back at the labs required?

Cas :slight_smile:

Don’t underestimate the lack of SIMD (SSE) in Java.

I had thought that it was using some of those SIMD instructions under the hood by now?

Cas :slight_smile:

HotSpot is using SSE2, but only operating on single values, never 4.

I only used POGG in java2D no opengl stuff yet, but syncing issues would still be there

@Cas: I have read the old thread “Cortado works”, and you never said that you’re going to give up on video
Reading the thread one might think that you really came up with a solid theora player, especially with your background being in TV/video
So what chance does anyone have, if not even you can get it to work - kinda demoralizing

also tried a little JMF again: basically only MPEG looks good, but those videos are of course quite big
and not easily (or not fast) rendered to opengl…

SISD usage has been around for awhile. The painful fact is that even if there was some SIMD usage the gains would be less than one might expect because auto-vectorization technology is very limited and doesn’t seem to be making much progress.

That’s why it’s handcoded in most codecs. I was merely making the point that SIMD is impossible in Java (though not trivial in C).

My expertise is in integration work rather than actually writing and/or debugging codecs, and a lot of the issues I had were basically down to slightly crappily designed codecs or APIs (making OpenGL integration basically difficult and/or slow) or just plain “it doesn’t work” bugs. I got one single piece of test video to work with cortado - some silent lunar module launch footage - and nothing else I tried to encode with Theora worked with it. This is a great shame because it would just be an absolutely perfect fit for a large number of hobby developers to get Theora and OpenGL working together properly.

I wonder why autovectorisation is proving such a tough nut to crack. The same processes that people go through to vectorise C code should be… hmmm… “definable” I thought. Though it is rather a specialised area. In fact I can’t think of any other general purpose computing task that seriously requires this sort of effort. All the cool kids are using multithreaded decoding anyway now - far easier to throw multiple cores at this problem than write custom machine code for every chip out there…

Cas :slight_smile:

Sure…I was intending to augment what you were saying. If java were to add SIMD & state-of-the-art auto-vectorization then the gains would not be what most people might expect. We’re sorta in the same boat as lacking structs here. The only was to really use SIMD is to be able to directly express the operations.