Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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 ... 6
  ignore  |  Print  
  YUNPM - a Java Media Player  (Read 31310 times)
0 Members and 1 Guest are viewing this topic.
Online nsigma
« Reply #30 - Posted 2012-08-16 11:00:10 »

I'd like to emphasize that this should not be a competition (although that's not always a bad thing).

Absolutely!  Sorry, I didn't mean it to come across like that actually.

At the moment I'd regard 'private code that works' not quite useful for the community, so I look forward to open sourcing Cero's solution.

Sure, though I guess it's stuck somewhere in the middle at the moment.  Praxis is out there and open-source, but as it's NetBeans platform based there were a few changes needed to make it work outside the platform, as well as get it to talk to Cero's Slick code as opposed to Praxis' renderer (which is a fork of libGDX).

Anyway, the library preloader code that allows shipping the binaries (I'm using the ones from Processing) is linked to here - http://www.java-gaming.org/topics/gstreamer-in-lwjgl/24852/msg/233945/view.html#msg233945.  (header should be LGPL here not GPL - will change ASAP).

And the corrected code from Cero is in the pastebins here - http://www.java-gaming.org/topics/gstreamer-in-lwjgl/24852/msg/236439/view.html#msg236439

Obviously, all that needs tidying up to be of more general use!  Smiley

NB.  All that code obviously currently assumes LWJGL, Slick, GStreamer-Java and JNA are in the classpath.


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

JGO Kernel


Medals: 149
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #31 - Posted 2012-08-16 11:07:45 »

I always assumed that the reason Bink was so successful is that it created a standard - it could have been any codec, but by limiting yourself to one, there is only 1 codec to ship to the customer.

I imagine it is that, plus it is easy to use and runs everywhere. If all you want to do is play some video, that pretty much covers it.

The problem with Bink is that it isn't free. $8,500 USD isn't even close to free. Apparently ffmpeg can do Bink. It'd be dirty to use Bink anyway, it was just an example of a successful, single codec playback library. No one on JGO is using Bink and it isn't a viable option for pretty much anyone here except Markus (who isn't seen here anymore anyway).

I'm not knocking your work, I was just thinking that possibly the problem could be simplified. It is great you have video working! Certainly having something working is far more useful than conjecture. Smiley

Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #32 - Posted 2012-08-16 12:30:28 »

@nsigma
On one machine... Example gstreamer command line works on machine a, not on machine b. That happens all the time! I don't trust gstreamer because about once a year I *try* to use it and still flaky. Now add that windows and mac support has been poor....

If it works, great. But i won't hold my breath. Also i didn't notice if you are syncing sound properly?

As for "another solution". Yes it is. But dammit, a simple to play to texture or something is just not out there. I try and go through all these libs/bindings once or more a year. They mostly sux. They mostly can be make to work on one machine. But deploy? Yea Right.

This one is the first one that has worked on all 3 machines at home, and the 2 at work without any issues at all.

I have no special talents. I am only passionately curious.--Albert Einstein
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online nsigma
« Reply #33 - Posted 2012-08-16 12:55:37 »

Now add that windows and mac support has been poor....

Yes, I agree, though with emphasis on "has been".

If it works, great. But i won't hold my breath. Also i didn't notice if you are syncing sound properly?

I'm not in Praxis (for reasons unrelated to GStreamer), but the code I fixed up for Cero plays sound fine.

As for "another solution". Yes it is. But dammit, a simple to play to texture or something is just not out there.

Er, that's exactly what that code is, as is Riven's FFMPEG code and as I believe Cero has for VLCJ too (though that's reliant on a GPL library). There's not been a shortage of code flying around this forum over the last few months that does this.  It's just been a little hidden away!

I've deliberately chosen to fork the library loading code from Processing and use their version of the native libs too, because quite frankly that's going to have a huge userbase testing it!

Anyway, this bit of discussion might be better off on the other (GStreamer) thread.  I didn't post here to spam Riven's thread - I'm interested in the pros and cons of the two approaches. 

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

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #34 - Posted 2012-08-16 13:12:58 »

Now add that windows and mac support has been poor....

Yes, I agree, though with emphasis on "has been".

A quick trip to the gstreamer website shows no demo app, and that they don't provide windows binaries. I don't know about anyone else but for me that shows a project that's either very immature or doesn't care about people using it. Either way, I'm going to go elsewhere.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #35 - Posted 2012-08-16 13:26:31 »

If it works, great. But i won't hold my breath. Also i didn't notice if you are syncing sound properly?
I'm not in Praxis (for reasons unrelated to GStreamer), but the code I fixed up for Cero plays sound fine.
I don't know whether you translated 'syncs fine' to 'plays fine', but those are two very different things Smiley

It wouldn't be the first media player that goes out of sync, after your framerate drops for a second, or the audio buffer is drained. The syncing problem is not something you'd dump on a developer that focuses on getting things done -- seeing how many here struggle with a steady game loop.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline ReBirth
« Reply #36 - Posted 2012-08-16 13:45:26 »

* a post to subscribe this awesome thread *

Online nsigma
« Reply #37 - Posted 2012-08-16 13:45:48 »

A quick trip to the gstreamer website shows no demo app, and that they don't provide windows binaries.

How about www.gstreamer.com - big download button!  Wink

I don't know whether you translated 'syncs fine' to 'plays fine', but those are two very different things Smiley

No, they're not!  'plays fine' in my book means 'syncs fine' and sounds correct (undistorted, right pitch, etc.)

It wouldn't be the first media player that goes out of sync, after your framerate drops for a second, or the audio buffer is drained. The syncing problem is not something you'd dump on a developer that focuses on getting things done -- seeing how many here struggle with a steady game loop.

GStreamer is not a media player - it's a media library.  Syncing is one of its major points.  I've never noticed an issue with sync, personally.  In a way it's doing all the sync stuff on top of FFMPEG that you're doing.  

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

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #38 - Posted 2012-08-16 13:46:08 »

* a post to subscribe this awesome thread *
Just click [ notify ] in the dark blue bar at the top of the thread. persecutioncomplex

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline ReBirth
« Reply #39 - Posted 2012-08-16 13:47:24 »

@Riven
No, I want it to appear on my "Show new replies to your posts."

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 #40 - Posted 2012-08-16 14:08:52 »

There is a shortage of code flying around that works on just the 5 machines i test on. What is the point if you can't deploy easily?

Even apps that use gstreamer have a huge list of "you need to do this with your local gstreamer for xxx to work" for more than half the faq. Its not like i haven't tried these things. They mostly just don't work consistently. And claiming that "they can"... well i don't care if they won't even work on 5 very similar machines i test on. Claiming PEBKAC is not winning points either (yes i was told that when gst seg faulted on one of my machines).

mplayer works consistently, which is based on ffmpeg. ffmepg works well too. So static binary's with pipes seems like a great idea.   

I have no special talents. I am only passionately curious.--Albert Einstein
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #41 - Posted 2012-08-16 14:09:51 »

GStreamer is not a media player - it's a media library.  Syncing is one of its major points.  I've never noticed an issue with sync, personally.  In a way it's doing all the sync stuff on top of FFMPEG that you're doing.
Don't pay too much attention to what I'm saying, I literally have no idea what I'm talking about Smiley That might sound like sarcasm, but it's true. I didn't do any field research, didn't even google for existing solutions, just wrote some code.

When I browse through the (j)gstreamer code, it feels like it's rather lowlevel, introducing many new concepts - like a bus that is somehow crucial to whatever it is crucial to*. If there is anything I learned from dumping my code/projects on JGO, is that the amount of code to get it to work should be less than 10 easy to grasp lines or it will be discarded.



* among similar lines, their example 'hello world' code contains this:
1  
GstElement *pipeline;
Now wtf is it? an element or a pipeline? They are not synonymous in the slightest, eventhough interchangeably used in the tutorial.

1  
gst_bus_timed_pop_filtered(...)
Say what? Can I say 'poor API design' yet? Do I really have to read method specifications before I can grasp the tutorial?

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 #42 - Posted 2012-08-16 14:10:02 »

A quick trip to the gstreamer website shows no demo app, and that they don't provide windows binaries.

How about www.gstreamer.com - big download button!  Wink

Odd. The first result in google for 'gstreamer' is gstreamer.net, which looks... pretty old school.  Huh

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Online princec

JGO Kernel


Medals: 404
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #43 - Posted 2012-08-16 14:34:11 »

I spent I don't know how long at Sony trying to get all these solutions to work. In the end Gstreamer is effectively an amateurish effort when compared to ffmpeg which is the granddaddy of video tools. Likewise VLC is  similarly ramshackle.

At the end of the day Java only needs support for about 2 formats to be useful to 99.999% of any of us in here - Theora and MPEG2. Whichever one of these monoliths does those two perfectly correctly wins.

Cas Smiley

Offline Cero
« Reply #44 - Posted 2012-08-16 16:24:29 »

A quick trip to the gstreamer website shows no demo app, and that they don't provide windows binaries.

How about www.gstreamer.com - big download button!  Wink

Odd. The first result in google for 'gstreamer' is gstreamer.net, which looks... pretty old school.  Huh

As of late the .com domain is all new and now the way to go, unfortunately the old page still exists.


I have always said Bink would be killer - at least the principle...


Just a short question: Technically, by law, you are not allowed to bundle a media file with a licensed codec right ? so even bundling a mp3 isnt allowed just like that. Theora and Vorbis are free which is why I use them. I love H.264/MPEG-4 AVC but I'm not entirely sure... is it open and ok to use ? maybe the decoders are licensed ? I assumed only Theora&Vorbis were truly open n stuff.


I will release a package like this with the GStreamer stuff we came up with.
@nsigma I have only Win32 & 64 on hand... I know you posted the mac binaries which are part of praxis, but in case of linux, I never added those yet as I said.

@delt0r The stuff we, mainly nsigma wrote is very reliable and stable. We package gStreamer and it never failed on any machine or desynced. The worst I could ever do is tearing on really weak machines...

Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #45 - Posted 2012-08-16 16:45:36 »

I have asked... properly asked. at least for H264 you require a license to encode/ to decode and on the transport layer. So yes if you include H264 files and a decoder, you need to pay for both.

That is what you have to agree to when you get a license for the patents.

I don't know why so much fuss is made over H264. Once you have bitrates that don't look like total crap, it does not perform any better than even mpeg2 (or theora). Sure it hides crap better at low bitrates, but then whats the point of HD if my effective resolution is more like half that? Encoding at a lower resolution with higher quality works better IMO and hides the artifacts better when scaling up anyhow.

I intend to use theora. 


I have no special talents. I am only passionately curious.--Albert Einstein
Offline Cero
« Reply #46 - Posted 2012-08-16 16:51:03 »

I intend to use theora. 

Yeah lets do that.

Offline theagentd
« Reply #47 - Posted 2012-08-16 16:51:58 »

This puppy played 2k just fine, and with my changes its going to be able to play 1080p on pretty low end hardware
Just to get everybody informed on this one, delt0r is writing a YUV streamer, as opposed to a MJPEG streamer.

For those who don't know what YUV is: it's basically 'raw' encoded RGB - every pixel takes the same number of bytes. Most movies use YUV as their colorspace, so decoding to this format is always in the decoding process, hence this 'transcoding' doesn't take any performance.

This YUV data is piped to Java, which either decodes YUV to RGB on the CPU or on the GPU. In the end, there will be barely any overhead to the streaming of video, apart form the piping process, which would allow for playback of high resolution video on low end hardware.
Not to mention that you don't get JPEG compression artifacts. >_> I'm waiting for this until I try it.  Wink

Myomyomyo.
Offline Cero
« Reply #48 - Posted 2012-08-16 17:43:14 »

ah yeah maybe we I didn't have any mac binaries

and not sure how to "extract" them from a dmg file - So I could basically just release the windows thing

Online princec

JGO Kernel


Medals: 404
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #49 - Posted 2012-08-16 18:26:56 »

Hm I beg to differ about H264 quality. Bit for bit it blows any other format into the weeds, pretty much, at any significant quality level. But that's in the digital video archiving / editing world, where I came from.
In a game? Who cares. MPEG2 is good enough; Theora is just yummier because it's unencumbered.

Cas Smiley

Offline delt0r

JGO Knight


Medals: 27
Exp: 18 years


Computers can do that?


« Reply #50 - Posted 2012-08-16 18:39:30 »

just to let others know. Currently this works really well. On linux. Windows... not so much. ffmpeg does not buffer writes to pipes, so on windows its not good for 1080p or anything like that.

I have no special talents. I am only passionately curious.--Albert Einstein
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #51 - Posted 2012-08-16 18:45:51 »

just to let others know. Currently this works really well. On linux. Windows... not so much. ffmpeg does not buffer writes to pipes, so on windows its not good for 1080p or anything like that.
To avoid confusion, that refers to the RGB streamer, not the MJPEG streamer - so we're working on it, while everybody else can play 1080p just fine with the current version.

Not to mention that you don't get JPEG compression artifacts. >_> I'm waiting for this until I try it.  Wink
I'm using 100% jpeg quality, so the artifacts are really hard to see.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #52 - Posted 2012-08-16 22:07:12 »

Version 0.7.5

  • Pause, resume (from any thread)
  • Adjusting volume (from any thread)
  • Removed MJPEG transcoder (credits: delt0r for finding the commandline args to stream rgb8)



Download files


Hilarious sample code
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
class VideoPlaybackTest {
   public static void main(String[] args) throws Exception {

      File movieFile = new File(args[0]);

      VideoRenderer videoRenderer = new OpenGLVideoRenderer(movieFile.getName());
      AudioRenderer audioRenderer = new OpenALAudioRenderer();

      VideoPlayback playback = new FFmpegVideoPlayback(movieFile);
      playback.startVideo(videoRenderer, audioRenderer);

      /**
       * oldskool controls!!
       */


      BufferedReader br = new BufferedReader(
         new InputStreamReader(new BufferedInputStream(System.in)));

      while (true) {
         String line = br.readLine();

         if (line.equals("mute")) {
            playback.setVolume(0.0f);
         } else if (line.equals("half")) {
            playback.setVolume(0.5f);
         } else if (line.equals("full")) {
            playback.setVolume(1.0f);
         } else if (line.equals("pause")) {
            playback.pause();
         } else if (line.equals("resume")) {
            playback.resume();
         } else {
            System.out.println("wait what?");
         }
      }
   }
}

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Online Spasi
« Reply #53 - Posted 2012-08-17 08:18:51 »

Two performance-related contributions:

PBO texture updates: OpenGLVideoRenderer (much faster, especially for HD videos)
Minor stream reading optimization: Rgb24VideoStream (1 temp buffer instead of 2)
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #54 - Posted 2012-08-17 08:37:00 »

Version 0.7.6

  • Significant performance increase for sending RGB8 to GPU using PBOs (credits: spasi)
           (observed performance increase: 5ms -> 1ms for 'rendering' phase of 720p video)

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #55 - Posted 2012-08-17 08:39:57 »

Minor stream reading optimization: Rgb24VideoStream (1 temp buffer instead of 2)
If you don't mind, I'll keep that the way it is. I think that additional byte[] results in more readable code, and doesn't affect performance.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Online nsigma
« Reply #56 - Posted 2012-08-17 08:56:24 »

At the end of the day Java only needs support for about 2 formats to be useful to 99.999% of any of us in here - Theora and MPEG2.

Surprised no mention of WebM / VP8 as a useful unencumbered format - surely better than Theora anyway?

In the end Gstreamer is effectively an amateurish effort when compared to ffmpeg which is the granddaddy of video tools.

That's comparing apples and oranges (not to mention GStreamer and VLC's use of FFMPEG underneath).  Interested (genuinely) in why you consider it amateurish, and when you last looked at it.  There's been a lot of work and investment in it more recently, and it's gaining a lot of traction - a few years ago I may have agreed with you.

When I browse through the (j)gstreamer code, it feels like it's rather lowlevel, introducing many new concepts - like a bus ...

The bus, element and pipeline terminology does make sense if you need to look into the low level stuff, but for just "getting things done"  Smiley there's a number of higher-level constructs that automatically set things up - you basically just need to use PlayBin2

The basics of playing a video file are lines 41-56 here - http://www.java-gaming.org/index.php?action=pastebin&hex=54a6b8d341c

@delt0r The stuff we, mainly nsigma wrote is very reliable and stable. We package gStreamer and it never failed on any machine or desynced. The worst I could ever do is tearing on really weak machines...

Thanks for the backup that I'm not just spouting crap.  Wink  Also noticed you'd posted the code up here - http://www.java-gaming.org/topics/gstreamer-in-lwjgl/24852/msg/241915/view.html#msg241915 - so now you can all test it and prove I am spouting crap!  Grin

btw - while thanks for the credit, most of this code (the bit that links in local GStreamer libs) is ported from Processing code by Andres Colubri - I just made it work outside Processing, and fixed a couple of bugs.  The actual write to texture could be improved a lot - I just did enough fixes to what Cero had - but it works.

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

JGO Kernel


Medals: 404
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #57 - Posted 2012-08-17 09:12:01 »

WebM/VP8 are relatively young even compared to Theora and their legality is still questionable. I admit it's been 2 years since I looked at gstreamer so I expect things have moved on since then; but then, ffmpeg was already working perfectly back then too.

Cas Smiley

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #58 - Posted 2012-08-17 09:33:03 »

Version 0.7.7

  • Attempts to use PBOs, and rolls back to normal texture updates when PBOs are slower (performance degradation reported by kappa)
        (video starts with 5 frames doing texture updates, then switches to PBO for the next 5 frames, then picks the fastest)



Download files

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Cero
« Reply #59 - Posted 2012-08-17 09:39:18 »

So yes if you include H264 files and a decoder, you need to pay for both.

So in this case, even if we dont use H264 files but Theora with "YUNPM", we still could not bundle it legally for free with our game, because it includes a H264 decoder.
If its possible to seperate those parts, it would work out. With VLC and GStreamer we have all these dlls and can delete them one by one, depending on license and requirement.

Pages: 1 [2] 3 4 ... 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.

Longarmx (38 views)
2014-10-17 03:59:02

Norakomi (29 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (28 views)
2014-10-15 16:18:58

TehJavaDev (56 views)
2014-10-14 00:39:48

TehJavaDev (55 views)
2014-10-14 00:35:47

TehJavaDev (46 views)
2014-10-14 00:32:37

BurntPizza (64 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (78 views)
2014-10-11 22:30:10
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

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

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!