Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (606)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2] 3
  ignore  |  Print  
  is video playback in java really as complicated as it seems?  (Read 10002 times)
0 Members and 1 Guest are viewing this topic.
Offline nsigma
« Reply #30 - Posted 2011-12-18 14:11:15 »

I say lwjgl because everything java2d is *not* easy to sync if at all. To sync you going to need to framedrop sometimes which looks horrible on PC monitors where you really need to run a native frame rates or have a very consistent pull down. Now lets consider java sound? Hell no, just use openal. Java2d is just not animation friendly.

Is that a response to my reply to @cero about LWJGL, because if so you've completely missed the point - basically that the output target is immaterial to how we get hold of the video data, which if using GStreamer-Java will be a native ByteBuffer.  With that you can send it to whatever target you want.  And for some people, Java2D and JavaSound will be fine.

Your idea of using GLSL to offload some of the work (like colour space changes) is pretty cool, though as long as whatever video library is giving you the native ByteBuffer allows you to specify raw vs rgb colour space, then that could still be done.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Online theagentd

« JGO Bitwise Duke »


Medals: 367
Projects: 2
Exp: 8 years



« Reply #31 - Posted 2011-12-18 15:08:39 »

Once you can get to the stage of having access to the native video buffer, you can do what you want with it.
This. ByteBuffer --> glTexImage2D() --> Draw quad. I have so many filters and things I want to try on videos, so someone better get to it!  Grin Grin Grin

Myomyomyo.
Online Roquen
« Reply #32 - Posted 2011-12-18 15:09:04 »

Color conversion can be a very significant portion of the total cost, so it's a very good candidate.  Along the same lines the freq/space transform can be performed on the GPU.  Nvidia has a block DCT example in one of their SDKs.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline delt0r

JGO Knight


Medals: 30
Exp: 18 years


Computers can do that?


« Reply #33 - Posted 2011-12-18 15:17:17 »

Talking to the Theora devs, they thought that for most cases the colour transform is the lions share of performance. For a lot of predicted frames the DCT coefficients are zero and there are optimized versions  of iDCT with small coefficient counts. Having said that iDCT with SSE is very fast.

My codec has a 4x4 transforms for easy glsl implementation. I have a trick or two to get good compression with such a small block size. One day i should really finish it. The idea of doing a lot on the card, is that you can send the mostly compressed video stream to the card, since something like 1080p60 raw is a lot of bandwidth.

Obviously having a decode to texture, does not preclude decode to bytebuffer.

I have no special talents. I am only passionately curious.--Albert Einstein
Online Roquen
« Reply #34 - Posted 2011-12-18 15:25:43 »

My experience is the same (assuming that the freq/space transform has short-cuts) that color conversion is the big win.  A problem with the Nvida example is that they don't reorder the output from the entropy decoder and reorder data on the GPU.
Offline nsigma
« Reply #35 - Posted 2011-12-19 10:59:19 »

Once you can get to the stage of having access to the native video buffer, you can do what you want with it.
This. ByteBuffer --> glTexImage2D() --> Draw quad. I have so many filters and things I want to try on videos, so someone better get to it!  Grin Grin Grin

You could do that now using GStreamer-Java!  The problem above is more about making sure it's easy to package and "just works" across all OS's.

The Processing video code already does exactly what you want using JOGL.  Should be easy to fork it to work with LWJGL.

In Praxis I've got video playback, webcam, etc. going to an LWJGL texture.  However, at the moment it's not a direct upload to the texture - it's coming into an int[] first - a legacy of Praxis' need to support a software renderer too.  This will be fixed in the next month or so, along with addition of live-coding GLSL filters - I want to do exactly the thing you're interested in!  Grin

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline Cero
« Reply #36 - Posted 2012-01-06 08:04:26 »

just to check: did anyone work on some of this video stuff, since this thread ?

Online Riven
« League of Dukes »

« JGO Overlord »


Medals: 849
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #37 - Posted 2012-01-06 23:36:04 »

FWIW, I just did a test on MJPEG using a video file from '30 Rock':

MPEG1219MB
MJPEG (90%)960MB
MJPEG (75%)561MB
Below 75% jpeg compression quality it becomes uncomparable to the original.

So it's not really useful, unless you have short videos Undecided

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social
Offline Cero
« Reply #38 - Posted 2012-01-18 02:32:05 »

how long was that clip ? I guess not a full episode ?

edit: well I need audio too, so it doesnt matter anyway I guess

Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #39 - Posted 2012-01-18 09:35:50 »

You can solve the audio problem by playing that independently and just ensuring you sync the video to the audio. As streaming audio comes in chunks of known size (and hence, duration) this is pretty easy.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online Roquen
« Reply #40 - Posted 2012-01-18 09:50:35 »

It should probably be noted that motion JPEG will be much slower than using a real video codec (if that is of any concern).
Offline Cero
« Reply #41 - Posted 2012-01-18 15:51:30 »

You can solve the audio problem by playing that independently and just ensuring you sync the video to the audio. As streaming audio comes in chunks of known size (and hence, duration) this is pretty easy.
its not easy. The whole reason Xuggler has still no player available is that people have tried ever since, but still have sync issues.
And overall I dont have the time, skill or knowledge to build an own decoder/video player / whatever  =/

It should probably be noted that motion JPEG will be much slower than using a real video codec (if that is of any concern).
It is indeed.

Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #42 - Posted 2012-01-18 17:08:10 »

Come to think of it when I tried MJPEG a little while back it was too slow if you wanted a reliable 15fps or better. (Bearing in mind the wide disparity in CPU power available on desktops)

Cas Smiley

Online Riven
« League of Dukes »

« JGO Overlord »


Medals: 849
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #43 - Posted 2012-01-18 17:32:19 »

Come to think of it when I tried MJPEG a little while back it was too slow if you wanted a reliable 15fps or better. (Bearing in mind the wide disparity in CPU power available on desktops)

What resolution?

At 512x288 pixels on a CPU running at 2.4GHz, with the jpeg data as byte[], I get 8ms per frame, using this code:
1  
BufferedImage img = ImageIO.read(new ByteArrayInputStream(data));
Despite the fact that ImageIO is slow, we can already push out frames at 125Hz.

Actually drawing takes 0.8ms per frame. To account for the wildly varying performance of ImageIO you simply need to buffer a few dozen frames.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social
Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #44 - Posted 2012-01-18 20:12:27 »

I was using a 1.6GHz mobile CPU at the time (the one I developed Revenge of the Titans on) - not surprisingly it was around half the speed at that resolution (doing sound as well, and rendering) - so it could just about cope with 60Hz. Trouble is I wanted rather higher resolution and it got rather a lot slower.

Cas Smiley

Online Riven
« League of Dukes »

« JGO Overlord »


Medals: 849
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #45 - Posted 2012-01-18 20:26:36 »

While I agree it's rather slow, I think it's uncommon to playback video at 60Hz.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social
Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #46 - Posted 2012-01-18 20:41:00 »

This is very true Smiley Ok, I admit it, I was doing hi-def stuff at Sony at the time Smiley Ignore me. Nevertheless the space issue is a bit of a showstopper if you've got any reasonable amount of video.

Cas Smiley

Online theagentd

« JGO Bitwise Duke »


Medals: 367
Projects: 2
Exp: 8 years



« Reply #47 - Posted 2012-01-18 23:38:49 »

While I agree it's rather slow, I think it's uncommon to playback video at 60Hz.
Uh, no? Isn't 23.976 or something the standard frame rate of real movies? I was gonna check it up, but after encountering strike pages on 3 different sites I gave up. This strike IS starting to bothering me now. -_-

Myomyomyo.
Offline ra4king

JGO Kernel


Medals: 356
Projects: 3
Exp: 5 years


I'm the King!


« Reply #48 - Posted 2012-01-19 04:58:59 »

While I agree it's rather slow, I think it's uncommon to playback video at 60Hz.
Uh, no? Isn't 23.976 or something the standard frame rate of real movies? I was gonna check it up, but after encountering strike pages on 3 different sites I gave up. This strike IS starting to bothering me now. -_-
He DID say that 60Hz is uncommon....so you aren't disagreeing with him Tongue

And is it really bothering you? GOOD now help us take SOPA and PIPA down, I don't care where you live Grin

Online theagentd

« JGO Bitwise Duke »


Medals: 367
Projects: 2
Exp: 8 years



« Reply #49 - Posted 2012-01-19 07:13:03 »

While I agree it's rather slow, I think it's uncommon to playback video at 60Hz.
Uh, no? Isn't 23.976 or something the standard frame rate of real movies? I was gonna check it up, but after encountering strike pages on 3 different sites I gave up. This strike IS starting to bothering me now. -_-
He DID say that 60Hz is uncommon....so you aren't disagreeing with him Tongue

And is it really bothering you? GOOD now help us take SOPA and PIPA down, I don't care where you live Grin
I swear he said common, not uncommon!!! And, no, I've submitted my mail address. Enough is enough.

Myomyomyo.
Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #50 - Posted 2012-01-19 10:04:28 »

23.97fps is only used by standard film format - there are a whole bunch of other standard frame rates, compounded with dropframe and non-dropframe versions of the fractional rates, progressive vs. interlaced, etc. You wouldn't believe what a quagmire it is. For any normal sane computer video you will be using "30p", which is 30fps, non-interlaced ("p" for "progressive scan").

<edit>And 50p and 60p formats are not at all uncommon in the hi-definition world, btw!

Cas Smiley

Offline delt0r

JGO Knight


Medals: 30
Exp: 18 years


Computers can do that?


« Reply #51 - Posted 2012-01-19 10:26:11 »

The Hobbit movie is getting shot at 48fps. Which I think is really about time IMO, 24fps cases visible flicker effects for me on faster pans. Unfortunately  is still going to be 3d.

What i don't understand is why interlaced hasn't died its deserved death. The 1970s called and wants is crappy interlaced CRTs back.

I have no special talents. I am only passionately curious.--Albert Einstein
Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #52 - Posted 2012-01-19 19:00:06 »

Don't worry, nobody in the industry understands why it still exists either. Actually we do, it's because of the vast pile of legacy equipment out there.

Cas Smiley

Offline Cero
« Reply #53 - Posted 2012-01-25 16:00:29 »

JavaFx 2 supports "FLV containing VP6 video and MP3 audio"

does anyone know a tool that an do this easily ? I remember that creating a flv video is not so hard, but VP6 specifically... I rarely could ever select that and when I could VP6 wasnt one of them.
Just would like to know that, if I actually could render every video in this flv codec, how would javafx 2 perform...

Offline Cero
« Reply #54 - Posted 2012-01-25 21:54:38 »

Quote
it's because of the vast pile of legacy equipment out there
btw same reason people use windows in general, and C++ for game development.

Offline sproingie

JGO Kernel


Medals: 202



« Reply #55 - Posted 2012-01-25 22:42:07 »

No, it's not the same reason, it's because the A/V situation on Linux is still a massive clusterf*ck that shows no signs of ever getting resolved.  For audio, assuming the driver manages to work, now add on the desktop environment's choice of mixer, whether you need superuser perms to even use it, and whether the distribution managed to completely cock it up or not.  For video, nvidia's looking pretty good, everything else you can forget about, and so on.

I do all my work dev work in Linux, but it's all network server stuff.  I do my hobby dev stuff in Linux too, but I don't bother holding out any hope it'll run on any machine but mine without a lot of debugging work.  Using Java is a good headstart, but once you depend on the external environment, you're still hacking through the brush.

Offline Cero
« Reply #56 - Posted 2012-01-25 23:43:31 »

No, it's not the same reason, it's because the A/V situation on Linux is still a massive clusterf*ck that shows no signs of ever getting resolved.  For audio, assuming the driver manages to work, now add on the desktop environment's choice of mixer, whether you need superuser perms to even use it, and whether the distribution managed to completely cock it up or not.  For video, nvidia's looking pretty good, everything else you can forget about, and so on.

I do all my work dev work in Linux, but it's all network server stuff.  I do my hobby dev stuff in Linux too, but I don't bother holding out any hope it'll run on any machine but mine without a lot of debugging work.  Using Java is a good headstart, but once you depend on the external environment, you're still hacking through the brush.

Even if many Linux' are screwed there are still many other options, people just use windows because it has been the standard for a long time and all the good software is written for it.
Only mac changes the game a little bit, with awesome software like final cut pro, only on mac
C++ same story - only reason its used so much is that legacy code and libraries are written in C++

Online Roquen
« Reply #57 - Posted 2012-01-26 06:47:51 »

I hate C++ with a passion.  But it's still the only viable option for balancing performance vs. work involved in creation for high performance situations.
Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #58 - Posted 2012-01-26 09:11:19 »

Actually, for codec work, Java seems to be pretty effective if you're prepared to hand-optimise the code a bit.

Cas Smiley

Online Roquen
« Reply #59 - Posted 2012-01-26 09:21:53 »

For codecs the gap (should be) narrow.  Sequential memory accesses, not pointer intensive, have the option to push stuff off to the GPU, etc. etc.  Not having access to non-scalar SIMD and non-temporal hints (and/or dropping to ASM for special cased) for stuff left on the CPU side is where any real difference will come in.
Pages: 1 [2] 3
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Elsealabs (20 views)
2014-12-28 10:39:27

CopyableCougar4 (21 views)
2014-12-28 02:10:29

BurntPizza (25 views)
2014-12-27 22:38:51

Mr.CodeIt (15 views)
2014-12-27 04:03:04

TheDudeFromCI (20 views)
2014-12-27 02:14:49

Mr.CodeIt (26 views)
2014-12-23 03:34:11

rwatson462 (60 views)
2014-12-15 09:26:44

Mr.CodeIt (48 views)
2014-12-14 19:50:38

BurntPizza (98 views)
2014-12-09 22:41:13

BurntPizza (117 views)
2014-12-08 04:46:31
How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!