Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (593)
Games in Android Showcase (168)
games submitted by our members
Games in WIP (646)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 ... 295
1  Java Game APIs & Engines / Engines, Libraries and Tools / Re: YUNPM get frame is black on: 2015-06-29 16:49:15
You could add a method that takes the format as a parameter.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
package net.indiespot.media.impl;

...

public class FFmpeg
{
   ...

   public static InputStream extractVideo(File srcMovieFile, int seconds, String pixfmt) throws IOException {
      return streamData(new ProcessBuilder().command(//
         FFMPEG_PATH, //
         "-ss", String.valueOf(seconds), //
         "-i", srcMovieFile.getAbsolutePath(), //        
         "-f", "rawvideo", //
-         "-pix_fmt", "rgb24", //
+         "-pix_fmt", pixfmt, //
         "-" //
      ));
   }

   ...
}


List of all supported formats:
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  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL
-----
IO... yuv420p                3            12
IO... yuyv422                3            16
IO... rgb24                  3            24
IO... bgr24                  3            24 <--- there we go
IO... yuv422p                3            16
IO... yuv444p                3            24
IO... yuv410p                3             9
IO... yuv411p                3            12
IO... gray                   1             8
IO..B monow                  1             1
IO..B monob                  1             1
I..P. pal8                   1             8
IO... yuvj420p               3            12
IO... yuvj422p               3            16
IO... yuvj444p               3            24
..H.. xvmcmc                 0             0
..H.. xvmcidct               0             0
IO... uyvy422                3            16
..... uyyvyy411              3            12
IO... bgr8                   3             8
.O..B bgr4                   3             4
IO... bgr4_byte              3             4
IO... rgb8                   3             8
.O..B rgb4                   3             4
IO... rgb4_byte              3             4
IO... nv12                   3            12
IO... nv21                   3            12
IO... argb                   4            32
IO... rgba                   4            32
IO... abgr                   4            32
IO... bgra                   4            32
IO... gray16be               1            16
IO... gray16le               1            16
IO... yuv440p                3            16
IO... yuvj440p               3            16
IO... yuva420p               4            20
..H.. vdpau_h264             0             0
..H.. vdpau_mpeg1            0             0
..H.. vdpau_mpeg2            0             0
..H.. vdpau_wmv3             0             0
..H.. vdpau_vc1              0             0
IO... rgb48be                3            48
IO... rgb48le                3            48
IO... rgb565be               3            16
IO... rgb565le               3            16
IO... rgb555be               3            15
IO... rgb555le               3            15
IO... bgr565be               3            16
IO... bgr565le               3            16
IO... bgr555be               3            15
IO... bgr555le               3            15
..H.. vaapi_moco             0             0
..H.. vaapi_idct             0             0
..H.. vaapi_vld              0             0
IO... yuv420p16le            3            24
IO... yuv420p16be            3            24
IO... yuv422p16le            3            32
IO... yuv422p16be            3            32
IO... yuv444p16le            3            48
IO... yuv444p16be            3            48
..H.. vdpau_mpeg4            0             0
..H.. dxva2_vld              0             0
IO... rgb444le               3            12
IO... rgb444be               3            12
IO... bgr444le               3            12
IO... bgr444be               3            12
I.... gray8a                 2            16
IO... bgr48be                3            48
IO... bgr48le                3            48
IO... yuv420p9be             3            13
IO... yuv420p9le             3            13
IO... yuv420p10be            3            15
IO... yuv420p10le            3            15
IO... yuv422p10be            3            20
IO... yuv422p10le            3            20
IO... yuv444p9be             3            27
IO... yuv444p9le             3            27
IO... yuv444p10be            3            30
IO... yuv444p10le            3            30
IO... yuv422p9be             3            18
IO... yuv422p9le             3            18
..H.. vda_vld                0             0
I.... gbrp                   3            24
I.... gbrp9be                3            27
I.... gbrp9le                3            27
I.... gbrp10be               3            30
I.... gbrp10le               3            30
I.... gbrp16be               3            48
I.... gbrp16le               3            48
I.... rgba64be               4            64
I.... rgba64le               4            64
..... bgra64be               4            64
..... bgra64le               4            64
IO... 0rgb                   3            24
IO... rgb0                   3            24
IO... 0bgr                   3            24
IO... bgr0                   3            24
IO... yuva444p               4            32
IO... yuva422p               4            24
IO... yuv420p12be            3            18
IO... yuv420p12le            3            18
IO... yuv420p14be            3            21
IO... yuv420p14le            3            21
IO... yuv422p12be            3            24
IO... yuv422p12le            3            24
IO... yuv422p14be            3            28
IO... yuv422p14le            3            28
IO... yuv444p12be            3            36
IO... yuv444p12le            3            36
IO... yuv444p14be            3            42
IO... yuv444p14le            3            42
I.... gbrp12be               3            36
I.... gbrp12le               3            36
I.... gbrp14be               3            42
I.... gbrp14le               3            42
2  Java Game APIs & Engines / Engines, Libraries and Tools / Re: YUNPM get frame is black on: 2015-06-29 15:35:34
A decade ago I looked into the Java2D (software) backend, and for any non-standard type, it basically did pretty 'impressive' per pixel operations. It's like doing bufimg.setRGB(x, y, value) for every pixel. That's a fancy trip down the rabbit hole, btw. Back in the day every pixel op involved a few object creations and dozen layers of indirection. I doubt much has changed, especially considering that people report factor 1000 slowdowns for some paths in the link you mentioned.
3  Java Game APIs & Engines / Engines, Libraries and Tools / Re: YUNPM get frame is black on: 2015-06-29 15:04:15
I think that triggers an extraordinarily slow path when rendering. persecutioncomplex
4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: YUNPM get frame is black on: 2015-06-29 08:36:21
BufferedImage sadly doesn't have a 3BYTE_RGB type Roll Eyes

1  
2  
3  
4  
5  
6  
// BGR <-> RGB
for(int i=0; i<rgb.length; i+=3) {
   byte tmp = rgb[i+0];
   rgb[i+0] = rgb[i+2];
   rgb[i+2] = tmp;
}


Keep in mind YUNPM uses STDIN/STDOUT to 'pipe' raw video/audio data from a separate FFMPEG process. This means that for 1920x1080 @ 24Hz, over 140MB/sec is transfered over I/O channels not really meant for this bandwidth (on Windows, at least). The overhead is generally acceptable, but with Full HD and higher resolutions and/or framerates, you need to look for alternatives.
5  Java Game APIs & Engines / Engines, Libraries and Tools / Re: YUNPM get frame is black on: 2015-06-28 18:20:10
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  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferByte;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import net.indiespot.media.impl.FFmpeg;
import net.indiespot.media.impl.VideoMetadata;

public class TestFrameExtraction {
   public static void main(String[] args) throws Exception {
      File movieFile = new File(args[0]);

      VideoMetadata meta = FFmpeg.extractMetadata(movieFile);
      InputStream rgb24Stream = FFmpeg.extractVideoAsRGB24(movieFile, 0);

      DataInputStream videoStream = new DataInputStream(rgb24Stream);

      BufferedImage buf = new BufferedImage(meta.width, meta.height, BufferedImage.TYPE_3BYTE_BGR);
      byte[] rgb = accessRasterByteArray(buf);
      for (int frame = 0; true; frame++) {
         readFrame(videoStream, rgb);
         swapChannels(rgb);
         System.out.println("frame: " + frame + " (" + meta.width + "x" + meta.height + ")");
      }
   }

   private static void readFrame(DataInputStream videoStream, byte[] dst) throws IOException {
      // videoStream.readFully(dst);
      int chunk = 64 * 1024;
      for (int off = 0; off != dst.length;) {
         int len = Math.min(chunk, dst.length - off);
         videoStream.readFully(dst, off, len);
         off += len;
      }
   }

   private static byte[] accessRasterByteArray(BufferedImage src) {
      return ((DataBufferByte) src.getRaster().getDataBuffer()).getData();
   }

   private static void swapChannels(byte[] rgb) {
      // BGR <-> RGB
      for(int i=0; i<rgb.length; i+=3) {
         byte tmp = rgb[i+0];
         rgb[i+0] = rgb[i+2];
         rgb[i+2] = tmp;
      }
   }
}
6  Java Game APIs & Engines / Engines, Libraries and Tools / Re: YUNPM get frame is black on: 2015-06-28 17:44:25
There is no need to bring in *movie* playback, which syncs with audio. As you're not signalling you played audio samples, the video stream will eventually stall. I'll give you some working code in 10 minutes. Gotta finish some cookin' first.
7  Game Development / Performance Tuning / Re: Video frame grabbing to bufferedImage on: 2015-06-25 19:47:44
With YUNPM you can read/display frames one at a time, at any speed. You have access to this input stream that simply feeds you byte[w*h*3] for every frame. Plain RGB8.

The audio sync, frame skipping and other features are merely feeding off this stream. The logic behind that is simply not active if you're only reading from this raw video stream. Same applies to audio, whatever media file you play, you get access to a plain inputstream with whatever sample rate you prefer.
8  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Java OpenGL Math Library (JOML) on: 2015-06-25 19:41:30
kappa: that would break half of the tutorials, and lead to major confusion when using two tutorials that define different units for their angles.
9  Discussions / General Discussions / Re: IRC Channel for Java-Gaming.org on: 2015-06-25 15:27:39
A not-quite-live stream has been added to the JGO homepage, in an effort to draw in more people to this questionable effort.
10  Game Development / Newbie & Debugging Questions / Re: Iterative flood fill on: 2015-06-24 15:15:29
Ah, you don't reset the 'visited' property when restarting a fill. Okay, that seems counter intuitive, but will work in your case.

To clean up your code a bit, you should remove the static fields, and just return the
ArrayList<CaveCell>
you are building in
iterativeFill(...)
. There is no need to store it in a field, especially not in a static one.
11  Games Center / WIP games, tools & toy projects / Re: CaveGear on: 2015-06-24 07:25:37
You should use VAO, you can bind your VBOs to it (like vertices, colors, texture coords...).
When you render you just have to bind the VAO, enable the attribs and then retrieve them in your shader program.
Keep in mind though that VAOs are still slower than doing it the 'inefficient' way. Most games, for this reason, simply have 1 VAO and bind their VBOs like they did prior to the existence of VAOs. It's simply not the driver's fast path.
12  Game Development / Newbie & Debugging Questions / Re: Iterative flood fill on: 2015-06-24 07:17:48
You'll have thousands of identical caves in your 'caves list', as adjacent cells are very likely to be in the same cave.
13  Game Development / Game Mechanics / Re: Best way to debug? on: 2015-06-18 20:49:44
Launch the game in your IDE in Debug mode.
Once you suspect your game enters some loop, freeze the thread you suspect is 'stuck', and look at the stacktrace.
Then step though the code until you figure out what is happening.

Or... litter your code with logging, until you figure out what's the culprit.
14  Discussions / Miscellaneous Topics / Re: How well does this work? on: 2015-06-16 17:27:42
persecutioncomplex If both slow and fast hardware yield the same framerate (180-220fps), the bottleneck is not your code/graphics. Maybe you put a sleep(4) in there, skewing the result, or you're hitting a browser bottleneck.

To get more reliable results, create a scene that is a better representation of the final game - load wise.
15  Discussions / General Discussions / Re: Stack traces when no LineNumberTable attribute exists... on: 2015-06-15 19:56:59
I wondered the same, and attributed it to the desired look-and-feel of the language.

You're going to spook Joe Sixpack with bytecode offsets in his trusty stacktraces.



Slightly offtopic: stacktrace elements pointing to synthetic methods, pointing to
Classy.java:1
are a similar minor pet peeve of mine. There's no code at line one. Stop lying to me plz! While we're at it, it surprises me how even (well) seasoned developers don't grasp that a stacktrace ending with
 ... 31 more
does not imply that information was dropped. It's just deduplicated from the parent exception. HTH somewhat. persecutioncomplex
16  Game Development / Newbie & Debugging Questions / Re: Iterative flood fill on: 2015-06-12 09:53:31
Instead of always adding four neighbours, check whether each neighbour exists before adding it to the queue..
17  Game Development / Articles & tutorials / Re: 2D terrain maps (for side-scrollers): how to modulate strata with Perlin Noise on: 2015-06-12 07:08:05
At the bottom of your pist you see the edit-icon.
18  Game Development / Newbie & Debugging Questions / Re: Brick Breaker game running slow on: 2015-06-11 16:31:34
Stop plugging Mercury to newbies. Seriously.
19  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-10 21:16:55
It's about responsibility and deflecting blame. If one piece of bad behaving code takes down an entire website, it's 'easy' to 'design' your architecture in a way that such crashes remain isolated to a tiny subset of your website. In other words: pointing the finger at whoever wrote that piece of code. If you happen to be the author, make sure you have 5 services up and running, so that if your crappy code crashes, the other 4 services will continue while the crashed one is rebooted.

It's actually not a bad style. It's how Unix/Linux are designed: building modules on top of modules. Every module has its own team, that specializes in that module. The Microsoft way is at the other end of the spectrum, where every project seems to be written from scratch, in huge code bases.

Isolation: good.
Composition: good.
Latency: bad.


Quite a few issues should be solved by hosting all your VMs on the same Host, but that isn't 'web-scale', so we end up with services and databases being 50ms apart, at the best of times. Sometimes I'm hitting >1s latency on reads/writes, with clients complaining about performance. We give them a fancier loading animation, they buy it. Ramble ramble.
20  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-10 18:29:21
The sad thing is we're all paying the price. Webservices are getting slower by the month. Storing / reading individual records on web-scale databases taking 50-100ms, it all adds up, and then you find yourself waiting 1-5s per page load, with nifty loading animation trying to distract you from the utterly horrifying technological deficiencies. Who cares about throughput when compounding inter-service latency ruins the User Experience? Pages loaded faster in the late nineties, and this has nothing to do with rich media, that's a bandwidth issue.
21  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-09 20:42:45
Once you 'transition' into AngularJS, you'll realize 'JavaScript+JQuery' was not so great after all. Pointing
22  Discussions / Miscellaneous Topics / Re: Data protection act on: 2015-06-07 09:08:49
What's your motive? Never bite the hand that feeds you, and all... unless you can find another... hand, easily. Has this hand been rubbing you the wrong way? I'm stretching the expression too far, as you may have noticed.
23  Discussions / General Discussions / Re: Four hour downtime as mysql tumbled on: 2015-06-05 20:55:28
I'm not too keen on rewriting hundreds of SQL queries. SMF queries really take the cake in being... awful.

Like GROUP BY clauses where the SELECT clause has varying dimensions for each resultset column. Whoever @ MySQL decided to support this madness:
SELECT abc, def FROM tab GROUP BY abc
should be tickled to a hilarious death. Every proper db rejects this nonsense.

SMF is saturated with this query style, which means porting it to a proper SQL database will take eons. I heard something about a Postgres version with a MySQL compatibility mode, but given it was announced on some April 1st, I'm not holding my breath Smiley
24  Discussions / General Discussions / Re: Four hour downtime as mysql tumbled on: 2015-06-05 19:09:44
As for why JGO was in limbo for such an eternity... the corrupted state of the database did not affect the homepage, causing Pingdom not to alert me of any problems... it was a busy day at work, and once again theagentd alerted me over Skype. It took me about 30 minutes to get home, and a horrifying full hour to get everything back up.

Now stop medal-slapping, I'm merely doing what I'm supposed to do Pointing
25  Discussions / General Discussions / Re: Four hour downtime as mysql tumbled on: 2015-06-05 18:35:43
 Emo

The MySQL database was corrupted, records were lost, table column definitions had lost their 'default' value, I actually had to reinstall MySQL from scratch, as critical metadata info (in the databases 'information_schema' and 'mysql') about tables was corrupted or had vanished completely. When starting the mysql service sys-log exploded with errors.

I tried to uninstall MySQL and reinstall it, but that retained the metadata and corrupt SMF table definitions. As a last resort, I uninstalled MySQL, dropped the datadir and turned to backups to rebuild the JGO database from there. persecutioncomplex

The last post is from ~10 hours ago, so quite a bit of today's content has been lost, but at least we have write-access to the database again.


The root cause of all this instability is still a bit of a mystery, but 'luckily' it's weekend, so I've got a ton of time to dig deeper.



Update: as JGO runs on a larger Linode VPS now, I have more diskspace to hold backups. For the kind souls mirroring http://java-gaming.org/recovery/ it's important to know that the backup interval has been increased from once per day, to every 4 hours, increasing the size of the backups by factor 6.
26  Game Development / Performance Tuning / Re: Did the Java designers just not care? on: 2015-06-02 20:09:46
My experience with the Hotspot compiler for about a year or so, is that the Iterable is completely removed. There is no object on the heap, it's turned into local variables (native stack) and/or held completely in registers. They will show up in some profilers as objects on the heap, but that's because these profilers inject bytecode that prevents the stack allocation optimisation. If you loop through nested loops of loops of loops backed by iterables, you'll see no garbage is created. I think it's safe to say that Iterables from the Collections API, in foreach-loops, are now almost guaranteed to be entirely optimized away.

Predictable stack allocation of arbitrary types is on the horizon. Value types are approaching the same problem from another angle, but the support will greatly enhance stack allocation optimisations.

Yadda. Yadda.
27  Games Center / WIP games, tools & toy projects / Re: Solarex - Travel and Explore the Galaxy on: 2015-06-01 19:43:11
The humbled peoples demand screenies!
28  Discussions / Miscellaneous Topics / Re: What is your opinion about ... on: 2015-06-01 17:32:00
There is a huge plus to println, though. It provides you with a log, a history if you will.

With breakpoints there is merely the current state. If you end up in this broken state, there is no way to trace your steps. With println you can... scroll up, use search, etc.


Therefore, I hereby present you with the ultimate debugging tool: the unholy println/debugger hybrid. Pointing
29  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-05-31 09:25:28
I only allow 'safe for children' ads on JGO, and these were a bit inappropriate for that category.

Anyway, the AdSense ads have been pulled, so all is fine for now. There are 'misrated' ads on ProjectWonderful too, but these I can report/pull individually - so keep me informed.
30  Discussions / General Discussions / Re: Four hour downtime as mysql tumbled on: 2015-05-29 22:04:47
There. 13min later we're running on a brand new VM Smiley

Old trusty VM was hovering around 20MB free RAM just after launching MySQL. Now we have ~1GB headspace. Gotta get some sleep now!
Pages: [1] 2 3 ... 295
 
deepthought (35 views)
2015-06-30 15:39:44

deepthought (39 views)
2015-06-30 15:39:09

deepthought (51 views)
2015-06-30 15:36:52

Za\'Anzabar (21 views)
2015-06-29 05:44:54

TritonDreyja (38 views)
2015-06-24 17:10:40

CopyableCougar4 (35 views)
2015-06-23 00:34:45

BurntPizza (40 views)
2015-06-21 20:36:46

cookiecompiler (83 views)
2015-06-11 15:42:53

cookiecompiler (45 views)
2015-06-11 15:41:14

NegativeZero (75 views)
2015-06-11 09:49:18
How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

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
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!