Saturday, July 23, 2016

YouTube works better in iOS 10 public beta

I've been having fun with iOS 10 public beta on my iPhone and iPad in the last few weeks. Apple has finally fixed an issue I had with iOS 9: Whenever I was browsing the web with Safari, any links to YouTube was forcing opening the YouTube app instead of viewing the website.

The YouTube app is great but when searching the web, it does not mean that I want to switch to another app just to read the comments on a video.

With iOS 10 public beta, this issue is no more. I quite happy!

There is a small issue now showing up: the top banner in the YouTube app is sometime not showing the icons. I've seen this behaviour in a few other apps so it's probably a glitch from iOS. The icons are still there as you can press on them, but you cannot see them.

The new iOS 10 is a great update. The new widget screen does look a lot better than iOS 9.

The first public beta of iOS 10 was slow on my iPad 4. Since the second public beta, its back to a more enjoyable experience.

The next update should iron out the last annoyances.

Sunday, June 26, 2016

How to capture desktop in Java: Fast method!

If you are developing software in Java, you may need to capture the desktop at some point.  There is the Robot API that does provide a simple way to capture the desktop, but it's not very efficient.

I've found a better way to capture the desktop, or the webcam in Java, relying on FFMpeg.  There is no need for JNI bindings or other obscure libraries dependencies.  All you need is an executable FFMpeg binary in your path.

Why not use Robot?

The Robot API is really easy to use but it has a major drawback: Speed.  On some computers, you may be able to capture up to 30 fps but on other, you'll struggle to capture images at 3 fps.  It seems that the operating system and the video driver are sensitive areas for the Robot API.


FFMpeg is a console application that can capture, transcode and even stream video and audio file.  It's a swiss army knife for multimedia content.  It is available on almost all Linux distros, OS X and Windows.

If not already installed, you can download it here:

How to capture video?

Once FFMpeg is installed on your system, you can invoke the binary using the Process class as any other executable.

The trick is to retrieve the captured data directly from FFMpeg using the Process class.  Once the raw data is captured, use a BufferedImage to store those raw data and you'll end up with an Image available for whatever you want to do with it.

Here's the code snippet:

BufferedImage buffer = new BufferedImage(720, 480, BufferedImage.TYPE_3BYTE_BGR);
String command = "ffmpeg -nostats -loglevel 0 -f x11grab -r 30 -video_size "+ buffer.getWidth() +"x" + buffer.getHeight() + "-i :0.0 -f rawvideo -pix_fmt bgr24 -";

Process p = Runtime.getRuntime().exec(command); in = new;
byte[] data = ((DataBufferByte) buffer.getRaster().getDataBuffer()).getData(); 

while (!stopMe) {

 This code will capture at the highest frame rate that the computer can support.  The speed of the computer will be the limit of your capture processing speed.

The thing you need to focus is the output format of FFMpeg.  The video encoding must be "rawvideo" with a pixel format matching the BufferedImage.  In this example, a 24 bit/pixel is used in BGR format (Blue, Green, Red).  The data is them exported directly to the console (notice the "-" at the end of the command line...) instead of a file.  That means that using the InputStream from the Process class, Java is able to read the data as fast as it can.

Execute this capture process in a Thread making the BufferedImage available for other parts of your software. 

See the whole thing running...

Using this method, I have built ScreenStudio to capture the desktop into a virtual video mixer built entirely in Java.  If you want to see it running live, download the source code of ScreenStudio at

Leave you questions in the comments or tweet me at

Have fun!

Friday, June 24, 2016

Rediscovering Gnome, moving away from Unity

While testing other desktop managers on my laptop running Ubuntu 16.04, I've accidentally broke my installation.

The main culprit is me as I did force a few things to happen.  Ubuntu has been my main distros since 2004.  The passage to Unity did upset me a little bit but I got used to the new interface and eventually, I liked it.

Today, I wanted to try out the other desktop manager available in the Ubuntu repository.  I could not get a decent performance from KDE, but others like XFCE and Mate were running smoothly on my old laptop.

Eventually, I've tried Gnome...  I was expecting something similar to Mate with a few bells and whistles on the top.  It's not a lightweight desktop but it does have its charms.  I must say, I do like this desktop metaphor way more than Unity.

The way I understand it, an app is meant to run in full screen all the time.  That is something that I do like in OS X as a full screen app is considered as a "new" desktop space.  That's exactly how Gnome 3 does work.

Of course, you still can have multiple apps running in the same desktop space, but I hate switching between apps as I do prefer everything to be maximized.  The the Unity Desktop, you can have multiple desktop spaces but you have to pre-configured the layout.  In Gnome, desktop spaces are dynamic so if you need one more, just go to the last desktop space.

Another great feature of Gnome is the Gnome Shell itself.  It does support Extensions that can be added at the top and I've found a few plugins that made my day. 

Finally, I just re-installed the Ubuntu Gnome from scratch to ensure that nothing from Unity would survive on my laptop.  It is a bit more flexible than Unity and does provide a lot of features.

You can download for free at: