Skip to content

Commit fac1e05

Browse files
committed
Use vlcj direct rendering instead of snapshot
1 parent b793d61 commit fac1e05

File tree

9 files changed

+394
-151
lines changed

9 files changed

+394
-151
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Webcam Capture API for Java
1+
# Webcam Capture API
22

33
This library allows you to use your build-in or external webcam directly from Java. It's designed to abstract commonly used camera features and support multiple capturing farmeworks.
44

55
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.sarxos/webcam-capture/badge.svg)](http://search.maven.org/#artifactdetails|com.github.sarxos|webcam-capture|0.3.10|bundle)
66
[![Build Status](https://img.shields.io/travis/sarxos/webcam-capture.svg?branch=master)](http://travis-ci.org/sarxos/webcam-capture)
77
[![Coverage Status](https://img.shields.io/coveralls/sarxos/webcam-capture.svg?branch=master)](https://coveralls.io/r/sarxos/webcam-capture?branch=master)
8-
[![Ohloh Stats](https://img.shields.io/badge/ohloh-%24%20243k%2019.7%20kNCSL-blue.svg)](https://www.ohloh.net/p/java-webcam-capture)
8+
[![Ohloh Stats](https://img.shields.io/badge/ohloh-19.7kNCSL-blue.svg)](https://www.ohloh.net/p/java-webcam-capture)
99

1010
## Features
1111

@@ -27,7 +27,7 @@ This library allows you to use your build-in or external webcam directly from Ja
2727
* [Freedom for Media in Java (FMJ)](http://fmj-sf.net/),
2828
* [OpenCV](http://opencv.org/) via [JavaCV](https://github.com/bytedeco/javacv),
2929
* [VLC](http://www.videolan.org/vlc/) via [vlcj](http://www.capricasoftware.co.uk/projects/vlcj/index.html),
30-
* [GStreamer](http://gstreamer.freedesktop.org/) via [gstreamer-java](https://code.google.com/p/gstreamer-java/)
30+
* [GStreamer](http://gstreamer.freedesktop.org/) (0.10.x only) via [gstreamer-java](https://code.google.com/p/gstreamer-java/)
3131
* MJPEG IP Cameras,
3232

3333
## Raspberry PI
@@ -150,15 +150,15 @@ List of additional capture drivers includes:
150150

151151
| Driver Name | Stable | Central | Description |
152152
|-----------------|--------|---------|-----------------------------------------|
153-
| [ipcam][] | yes | yes | IP / network camera driver |
154-
| [gstreamer][] | yes | no | Driver for [GStreamer][] framework |
155-
| [openimaj][] | yes | no | Driver for [OpenIMAJ][] framework |
156-
| [v4l4j][] | yes | no | Driver for [V4L4j][] project |
157-
| [jmf][] | yes | yes | Driver for [JMF][] / [FMJ][] frameworks |
158-
| [lti-civil][] | yes | yes | Driver for [LTI-CIVIL][] library |
159-
| [javacv][] | no | no | Driver for [JavaCV][] library |
160-
| [vlcj][] | no | no | Driver for [VLCj][] library |
161-
| [ffmpeg-cli][] | exp | no | Driver for [FFmpeg][] [CLI][] tool |
153+
| [ipcam][] | yes | yes | Driver for IP / network camera |
154+
| [gstreamer][] | yes | no | Driver for [GStreamer][] framework |
155+
| [openimaj][] | yes | no | Driver for [OpenIMAJ][] framework |
156+
| [v4l4j][] | yes | no | Driver for [V4L4j][] library |
157+
| [jmf][] | yes | yes | Driver for [JMF][] / [FMJ][] frameworks |
158+
| [lti-civil][] | yes | yes | Driver for [LTI-CIVIL][] library |
159+
| [javacv][] | no | no | Driver for [JavaCV][] library |
160+
| [vlcj][] | yes | yes | Driver for [vlcj][] library |
161+
| [ffmpeg-cli][] | exp | no | Driver for [FFmpeg][] [CLI][] tool |
162162

163163
* Central = Maven Central Repository
164164
* _exp_ = experimental
@@ -190,7 +190,7 @@ I initially started working on Webcam Capture as a simple proof-of-concept after
190190

191191
## License
192192

193-
Copyright (C) 2012 - 2015 Bartosz Firyn
193+
Copyright (C) 2012 - 2015 Bartosz Firyn (https://github.com/sarxos)
194194

195195
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
196196

webcam-capture-drivers/driver-vlcj/README.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
# webcam-capture-driver-vlcj
22

3-
This is capture driver which uses [vlcj](http://www.capricasoftware.co.uk/projects/vlcj/index.html)
4-
library from [Caprica Software Limited](http://www.capricasoftware.co.uk/)
5-
to gain access to the camera device.
3+
This is capture driver which uses [vlcj](http://www.capricasoftware.co.uk/projects/vlcj/index.html) library from [Caprica Software Limited](http://www.capricasoftware.co.uk/) to gain access to the camera device.
64

7-
Because vlcj saves every frame to the persistent storage (temporary directory on your hard drive)
8-
before it is returned by the API method call,
9-
the image capture rate is pretty small, indicated by tests to be around ~12 FPS, but it can pe
10-
possibly higher or lower depending on the hardware used (e.g. different on hard drive, SSD and
11-
flash memory).
12-
13-
**NOTE!** On Windows one needs to provide list of webcam devices manually because
14-
```vlclib``` does not implement video devices discovery on this platform (please see [this example](https://github.com/sarxos/webcam-capture/blob/master/webcam-capture-drivers/driver-vlcj/src/example/java/WebcamPanelForWindows.java)
15-
to find out how this should be done).
5+
**NOTE!** On Windows one needs to provide list of webcam devices manually because ```vlclib``` does not implement video devices discovery on this platform (please see [this example](https://github.com/sarxos/webcam-capture/blob/master/webcam-capture-drivers/driver-vlcj/src/example/java/WebcamPanelForWindows.java) to find out how this should be done).
166

177
The vlcj library is distributed according to the terms of the [GPL](http://www.gnu.org/licenses/gpl.html) license.
188

@@ -22,7 +12,7 @@ Not yet available.
2212

2313
## Capture Driver License
2414

25-
Copyright (C) 2012 - 2014 Bartosz Firyn <https://github.com/sarxos>
15+
Copyright (C) 2012 - 2015 Bartosz Firyn <https://github.com/sarxos>
2616

2717
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2818

webcam-capture-drivers/driver-vlcj/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
<artifactId>vlcj</artifactId>
3232
<version>2.4.1</version>
3333
</dependency>
34+
<dependency>
35+
<groupId>ch.qos.logback</groupId>
36+
<artifactId>logback-classic</artifactId>
37+
<scope>provided</scope>
38+
</dependency>
3439
<dependency>
3540
<groupId>junit</groupId>
3641
<artifactId>junit</artifactId>

webcam-capture-drivers/driver-vlcj/src/example/java/VlcjDirectTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ private static BufferedImage convert(Memory[] buffers, BufferFormat format) {
7575
ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
7676
ComponentSampleModel sampleModel = new ComponentSampleModel(dataType, width, height, pixelStride, scanlineStride, bgrBandOffsets);
7777
ComponentColorModel colorModel = new ComponentColorModel(colorSpace, bits, false, false, transparency, dataType);
78+
7879
DataBufferByte dataBuffer = new DataBufferByte(data, bytes.length, offsets);
7980
WritableRaster raster = Raster.createWritableRaster(sampleModel, dataBuffer, null);
8081
BufferedImage image = new BufferedImage(colorModel, raster, false, null);
@@ -119,7 +120,6 @@ public void display(DirectMediaPlayer player, Memory[] buffers, BufferFormat for
119120
":v4l2-width=320",
120121
":v4l2-height=240",
121122
":v4l2-fps=30",
122-
":v4l2-quality=20",
123123
":v4l2-adev=none",
124124
};
125125

webcam-capture-drivers/driver-vlcj/src/example/java/WebcamPanelExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ public static void main(String[] args) throws InterruptedException {
1919

2020
WebcamPanel panel = new WebcamPanel(webcam);
2121
panel.setFPSDisplayed(true);
22+
panel.setImageSizeDisplayed(true);
2223

2324
JFrame window = new JFrame("Webcam Panel");
2425
window.add(panel);
25-
window.setResizable(false);
2626
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
2727
window.pack();
2828
window.setVisible(true);

0 commit comments

Comments
 (0)