Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (488)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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 [4] 5 6
  ignore  |  Print  
  YUNPM - a Java Media Player  (Read 29587 times)
0 Members and 2 Guests are viewing this topic.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #90 - Posted 2012-08-18 09:55:49 »

I can confirm that's probably it. I get roughly the same 'upload time' for 240p and 1080p videos.

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

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #91 - Posted 2012-08-18 10:11:12 »

The latest version here works almost as good as the "best" version. My test case is only a little worse CPU wise and well there is a much smaller start up time.

Over its working well.

I have no special talents. I am only passionately curious.--Albert Einstein
Offline davedes
« Reply #92 - Posted 2012-08-18 17:10:13 »

I didn't see any Mac executables on the ffmpeg website, but this one works:
http://ffmpegmac.net/

At 1080p it runs at 20 FPS and audio goes out of sync. (receiving 20ms, rendering 80ms)

I also ran into this exception when trying to resize my 1080p video. It seems to happen erratically. And occasionally when closing I get this exception.

Otherwise small files seem to work and resize properly. I'll have to do some more tests with different codecs.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online theagentd
« Reply #93 - Posted 2012-08-18 21:58:49 »

I also ran into this exception when trying to resize my 1080p video. It seems to happen erratically. And occasionally when closing I get this exception.
I can confirm that this exception happens. I played the video in fullscreen and tabbed out. This freezes the rendering, and when I tabbed in again it crashed with that same exception. It's most likely occurs when some video buffer is completely filled, probably since your computer didn't manage to display them fast enough.

EDIT:
I can confirm that's probably it. I get roughly the same 'upload time' for 240p and 1080p videos.
I ca confirm this too. Measuring CPU usage is veeeery difficult when using OpenGL...

Myomyomyo.
Offline Spasi
« Reply #94 - Posted 2012-08-18 22:26:01 »

Measuring CPU usage is veeeery difficult when using OpenGL...

I recommend ARB_timer_query. Easy to use and you get very accurate timings.

For trivial rendering (like this video player) you just need to be careful with reading back the times. It will cause a pipeline flush and will skew the rest of the rendering, like SwapBuffers does to the texture update above. A trick I use is to actually measure every X frames, where X is how many frames it takes for the timing result to be available. Like so:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
private int timerID;
private boolean timerAvailable = true;

{
   timerID = glGenQueries();
}

private void render() {
   if ( timerAvailable ) // skip if we're still waiting for the previous timing
     glBeginQuery(GL_TIME_ELAPSED, timerID);

   // ...the GL calls we want to time...

   if ( timerAvailable )
      glEndQuery(GL_TIME_ELAPSED);

   // Check if the timing result is available
  timerAvailable = glGetQueryObjecti(timerID, GL_QUERY_RESULT_AVAILABLE) != 0;

   if ( timerAvailable ) {
      long time = glGetQueryObjecti(timerID, GL_QUERY_RESULT);
      System.out.println("took = " + time + " ns.");
   }
}
Online Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #95 - Posted 2012-08-19 03:17:43 »

I didn't see any Mac executables on the ffmpeg website, but this one works:
http://ffmpegmac.net/
There is already a mac port in the zip. I assumed it worked persecutioncomplex

At 1080p it runs at 20 FPS and audio goes out of sync. (receiving 20ms, rendering 80ms)
The video player doesn't drop frames. If rendering takes 80ms, you'd only ever get 12.5fps, which is not acceptable in the first place. That is goes out of sync is no surprise, given that the video can never 'catch up'.

I also ran into this exception when trying to resize my 1080p video. It seems to happen erratically. And occasionally when closing I get this exception.


Regarding exception #1, that's not supposed to happen anymore in the latest versions. I tested whether a buffer put in the pool returned true for obj1.equals(obj2) on any item already in the pool. For distinct ByteBuffers containing the same pixels, this returned true. Now I'm using '==' instead. Which version (of the jars) did you use?

Regarding exception #2, that happened when ffmpeg.stdout returned an incomplete frame, which basically happens because I close the stream during closing of the player. I simply removed rethrowing the IOException as IllegalStateException.



I can confirm that this exception happens. I played the video in fullscreen and tabbed out. This freezes the rendering, and when I tabbed in again it crashed with that same exception. It's most likely occurs when some video buffer is completely filled, probably since your computer didn't manage to display them fast enough.
This shouldn't be the cause of that exception, really. I cannot reproduce it, so I hope that my latest version solves it.



Version 0.7.11 of YUNPM

  • Re-enabled measuring of PBO performance, which allows fallback to plain texture updates, if the drivers pick an horrendous path. (previously reported by kappa, with ~330ms updates per frame)
  • Discarded expected IOException on media player termination



Download files


Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline nsigma
« Reply #96 - Posted 2012-08-20 18:00:22 »

Well, finally got a few hours to look at tidying up the GStreamer stuff today.  I initially looked at creating an alternative backend to YUNPM, but due to the difference in approach (callback vs streaming) this was leading to about 4x more code then was actually required (and I was having issues with some of the dependencies - seems a few things missing in your JAR?).  So, instead we have GstLwjgl - in a separate thread so as not to pollute this one further!  Wink  Not quite as CPU friendly yet (not too bad), but it is lacking a few optimizations.

The video player doesn't drop frames. If rendering takes 80ms, you'd only ever get 12.5fps, which is not acceptable in the first place. That is goes out of sync is no surprise, given that the video can never 'catch up'.

Given our earlier comments on sync, isn't the lack of frame-drop actually a bit of a flaw at the moment?  Obviously, constant frame dropping will look terrible, but the ability to always work to the audio clock and drop the odd video frame (in case of CPU spike, etc.) would seem to be important for accurate sync - unless I'm missing something in your answer?


Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Online Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #97 - Posted 2012-08-20 18:24:04 »

I own a flower shop and every wednesday a friendly guy comes in, handing out flyers for his flower shop. I offer him tea and a biscuit and we discuss unrelated business.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Cero
« Reply #98 - Posted 2012-08-20 21:57:11 »

The smell of flower stores drives me nuts.

Offline nsigma
« Reply #99 - Posted 2012-08-21 09:11:19 »

I own a flower shop and every wednesday a friendly guy comes in, handing out flyers for his flower shop. I offer him tea and a biscuit and we discuss unrelated business.

LOL - nice analogy!   Grin  Actually, you misinterpret my intentions though.  I have no interest in running a flower shop, I have enough other shops to juggle at the moment!  One flower shop would be fine in this town, but I disagree with growing half the product in the back garden when a reputed wholesaler can offer so much more with far less effort.  Ah, you say, but I can never get hold of that wholesaler, the phone always seems to be down .. here, try the number on this card instead!   Wink

You started this thread with the assertion that there was no useful code for video in Java.  As I've pointed out before, there are lots of people away from here quite happily working with video, and have been doing for years (Processing guys particularly have this all working cross-platform).  Almost all are using GStreamer, some are using VLC.  Most of the code I posted above was on here months ago, and it's a far simpler too.  Use it or ignore it, I don't particularly care - I'll maintain it because I personally need the extra features in Praxis.  Just don't see the point in re-inventing the wheel!  I personally believe that a marriage of GStreamer backend and the YUNPM rendering code is the best way forward, and while working now also offers some interesting longer term potential (hardware decoding and rendering directly to texture, streaming video from the net, etc.)  If a shotgun wedding ain't the way forward, then so be it.

Now, where's that tea and biscuits you offered me?  Grin

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #100 - Posted 2012-08-21 09:46:25 »

@nsigma
And yet the Gstreamer option is *not* working with the *same* its your config that is at fault from the coders! Gstreamer is continuing to live up to its reputation. Its crap and flaky. 

In my book, that is *not* working. I should not need to spend half a day configuring anything to play movies with sound in a java app. More so  if i can play movies from other applications just fine. 


I have no special talents. I am only passionately curious.--Albert Einstein
Offline nsigma
« Reply #101 - Posted 2012-08-21 10:05:10 »

@nsigma
And yet the Gstreamer option is *not* working with the *same* its your config that is at fault from the coders! Gstreamer is continuing to live up to its reputation. Its crap and flaky on Slackware

Be fair and mention what system you're working with!  It's mainly meant to be a demonstration of library bundling for Windows.  Easy enough to take the same approach on any other OS to give you a known quantity (I've never had issues on any Linux distro - that's a distro issue not a GStreamer one, and a good reason in my book for choosing which Linux OS's you support).

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Online Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #102 - Posted 2012-08-21 10:12:00 »

that's a distro issue not a GStreamer one, and a good reason in my book for choosing which Linux OS's you support.
The end user is never at fault, mkay? Did you realize you suggested the end user to pick another OS distro, because the GStreamer developers couldn't be bothered to make their shit work? For the sake of cute fluffy bunnies, please make more sense.


</rant>


 Emo


<rant>
Seriously!
</rant>

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

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #103 - Posted 2012-08-21 10:13:08 »

that's a distro issue not a GStreamer one, and a good reason in my book for choosing which Linux OS's you support.
The end user is never at fault, mkay? Did you realize you suggested the end user to pick another OS distro, because the GStreamer developers couldn't be bothered to make their shit work? For the sake of cute fluffy bunnies, please make more sense.

Ladies and gentlemen - Linux! Let's give it a big warm hand.

 Wink

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline nsigma
« Reply #104 - Posted 2012-08-21 10:25:25 »

Did you realize you suggested the end user to pick another OS distro,

Yes!

because the GStreamer developers couldn't be bothered to make their shit work?

You seriously suggesting that it's down to library developers to support every Linux based OS?  That's a distro's packaging responsibility.  That developers target a core number of popular Linux distributions is good and realistic IMO (and I've said that many times before here).  It's not a surprise that Valve and Unity3D are both only targeting one (Ubuntu).

If you'd not provided a binary of FFMPEG for Linux, you'd suffer with the same issues of differing distro's - delt0r might have been OK, but others may not.  It's a good argument for bundling natives - my post was meant as a demo of this on Windows (which is most people here, yes?).  The code could be adapted to do it on all 3 OS's with minimal effort.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Online Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #105 - Posted 2012-08-21 10:37:49 »

If you'd not provided a binary of FFMPEG for Linux, you'd suffer with the same issues of differing distro's - delt0r might have been OK, but others may not.  It's a good argument for bundling natives - my post was meant as a demo of this on Windows (which is most people here, yes?).
Guess why I shipped the binaries... because I try to make it work for everybody, regardless of their choices.


The code could be adapted to do it on all 3 OS's with minimal effort.
Any code could easily be adapted to do anything. Until it actually is adapted, it doesn't matter to the end user.



Did you see how much effort I put in updating YUNPM, to make it work for everybody? I even wrote a fallback to disable PBOs, when poor performance is measured, specially for kappa. I could have told him to use another OS distro, update his graphics drivers or explain to him how he could remove the PBO code.

It isn't enough to dump code into the community. You have to support and maintain it for it to get anywhere. I put far more hours into this can I anticipated, but at least now people can embed video playback in their game and/or app.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Spasi
« Reply #106 - Posted 2012-08-21 10:46:05 »

Btw, kappa, could you post some info on your setup (OS/GPU/drivers/etc)? Maybe there's a better solution to simply disabling PBO. Or at least we could detect the problematic environment without benchmarking, which is inherently sensitive to external factors.
Offline nsigma
« Reply #107 - Posted 2012-08-21 10:50:20 »

The code could be adapted to do it on all 3 OS's with minimal effort.
Any code could easily be adapted to do anything. Until it actually is adapted, it doesn't matter to the end user.

Actually, I un-adapted it from the Processing code (at least for OSX) because I didn't have a way to test it.

It isn't enough to dump code into the community. You have to support and maintain it for it to get anywhere. I put far more hours into this can I anticipated, but at least now people can embed video playback in their game and/or app.

Absolutely, and simply put I'm maintaining and supporting enough right now.  I don't under-appreciate the amount of time this has taken you - it's great!  I think one of the underlying choices you've made is wrong, and will make this far harder and time consuming to support in the long run.  It doesn't mean I don't appreciate how important it is to this community that someone has stepped up to the plate.

Shipping binaries that work is a great thing - some LGPL binaries would be good too though!  Tongue

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Online Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #108 - Posted 2012-08-21 10:52:24 »

I think one of the underlying choices you've made is wrong
At least be specific. You've done enough vague handwaving over issues with YUNPM.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Cero
« Reply #109 - Posted 2012-08-21 10:56:20 »

I agree with Riven that users aren't at fault, obviously it just has to work.

You seriously suggesting that it's down to library developers to support every Linux based OS? 
Either you say "this game/app works with linux." period. then you do everything you can to make sure it will work on every distro. Or you will only support specific Distros like "Works on Windows, Mac and Ubuntu & Mint"

Be fair and mention what system you're working with!
Yeah, this was not a linux ready version, completely relying on preinstalled gst...

Shipping binaries that work is a great thing - some LGPL binaries would be good too though!  Tongue
Only reason why I wouldn't use it right now - I dont want to get sued.
So maybe someone can build binaries with only the LGPL codecs like theora and vorbis...

Online Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #110 - Posted 2012-08-21 11:10:21 »

As YUNPM does not link ffmpeg, it is not a derived work, which (to my knowledge) means that YUNPM is not tainted by LGPL or GPL.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Cero
« Reply #111 - Posted 2012-08-21 11:14:50 »

eeeh right  Clueless, well shipping codecs which are licensed isnt ok - thats as far as my knowledge goes

Offline kappa
« League of Dukes »

JGO Kernel


Medals: 77
Projects: 15


★★★★★


« Reply #112 - Posted 2012-08-21 11:16:48 »

Btw, kappa, could you post some info on your setup (OS/GPU/drivers/etc)? Maybe there's a better solution to simply disabling PBO. Or at least we could detect the problematic environment without benchmarking, which is inherently sensitive to external factors.
Agreed the current detection method isn't the ideal way to go. PBO's work perfectly on my home computer however the computer I was testing on (Windows XP, Java 7) has an ATI Radeon Xpress 200 series card, it uses the latest drivers available for it from ATI/AMD (Catalyst 10.2).

The card does claim to support OpenGL 2.1 and PBO's however I'm pretty sure the driver/card is borked in some way. I've noticed that some types of GLSL fragment shaders fail to compile for unknown reasons (I'm guessing some hardware limitation) and the card also seems to be blacklisted by Firefox WebGL.

As for the YUNPM it works fine without PBO's but has serious lag (sometimes even a blackscreen) when using PBO's.

Not sure what the correct fix would be for cards like this, maybe we need to go the WebGL route and have a small library that maintains a blacklist of features for certain cards and drivers (maybe even copy the WebGL list).
Offline nsigma
« Reply #113 - Posted 2012-08-21 11:37:50 »

I think one of the underlying choices you've made is wrong
At least be specific. You've done enough vague handwaving over issues with YUNPM.

This, for one.

The video player doesn't drop frames. If rendering takes 80ms, you'd only ever get 12.5fps, which is not acceptable in the first place. That is goes out of sync is no surprise, given that the video can never 'catch up'.

Given our earlier comments on sync, isn't the lack of frame-drop actually a bit of a flaw at the moment?  Obviously, constant frame dropping will look terrible, but the ability to always work to the audio clock and drop the odd video frame (in case of CPU spike, etc.) would seem to be important for accurate sync - unless I'm missing something in your answer?

Trying to rewrite A/V sync from scratch rather than relying on an available solution, is IMO going to end up being a headache.  I'm also assuming that using separate processes makes it harder to control / skip frames through FFMPEG.

As YUNPM does not link ffmpeg, it is not a derived work, which (to my knowledge) means that YUNPM is not tainted by LGPL or GPL.

Actually, thought of this just after I posted - think you're right and OK with that one.  Permission to ship h264 is another thing, though, so at least an LGPL build would remove it.

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

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #114 - Posted 2012-08-21 11:58:59 »

Shipping H264 has nothing to do with GPL or LGPL... its a patent issue. Countries that respect software patents it is a patent violation to ship it. Its less clear about other parts of a license agreement with MPEG-LA is really enforceable in some countries. For example you also need a license to ship *content* in H264 according to MPEG-LA and you must agree to that to get a license from them for the encoders/decoders.

There are many other details, but long story short, its easier to just not include it. This is not a big deal in the bigger scheme of things. Theora is pretty good now, and more than good enough for government work.

I just like the idea that adding a intro movie and/or a info video is now a possibility.

I have no special talents. I am only passionately curious.--Albert Einstein
Offline Roquen
« Reply #115 - Posted 2012-08-21 12:23:44 »

WRT H264...hardware decoders on embedded devices is one reason to go that route.
Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #116 - Posted 2012-08-21 12:42:36 »

I would expect that the local OS/hardware can then provide a licensed decode path in that case. OpenMax was/is suppose to make accessing this fairly easy.... in theory.

I have no special talents. I am only passionately curious.--Albert Einstein
Online theagentd
« Reply #117 - Posted 2012-08-21 12:57:41 »

Shipping H264 has nothing to do with GPL or LGPL... its a patent issue. Countries that respect software patents it is a patent violation to ship it. Its less clear about other parts of a license agreement with MPEG-LA is really enforceable in some countries. For example you also need a license to ship *content* in H264 according to MPEG-LA and you must agree to that to get a license from them for the encoders/decoders.
Jesus Christ, what a hurdle. How bad is Theora anyway?

Myomyomyo.
Offline Cero
« Reply #118 - Posted 2012-08-21 13:27:36 »

How bad is Theora anyway?

It's great.

Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #119 - Posted 2012-08-21 13:38:47 »

Theora quality for quality is pretty similar at high bit rates (at least most folk can't tell), at lower bitrates (aka not DVD or BluRay bit rates) assume about 1.5 increase in bit rate tops for the same quality. I am being conservative and of course the content makes a big difference. It should also be pointed out that its the h264 encoder that is pretty impressive. If theora had that much work put into its encoder, how good would it be? Well we don't know, but it could be more competitive.

Theora also is less complicated to decode. So cpu usage should be less for software decodes.

However even though theora never will win the codec wars, the mere existence of a license free codec has been worth its weight in gold. At the very least it keeps the others honest.

I have no special talents. I am only passionately curious.--Albert Einstein
Pages: 1 2 3 [4] 5 6
  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.

TehJavaDev (17 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (68 views)
2014-08-11 02:49:23

BurntPizza (45 views)
2014-08-09 21:09:32

BurntPizza (36 views)
2014-08-08 02:01:56
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

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!