i found only example like this - http://dranger.com/ffmpeg/tutorial01.html
my guess it's outdated. or it's not?
You may want to check out the source code of FFmpegFrameGrabber and
FFmpegFrameRecorder:
http://code.google.com/p/javacv/source/browse/trunk/javacv/src/com/googlecode/javacv/FFmpegFrameGrabber.java
http://code.google.com/p/javacv/source/browse/trunk/javacv/src/com/googlecode/javacv/FFmpegFrameRecorder.java
> i found only example like this - http://dranger.com/ffmpeg/tutorial01.html
> my guess it's outdated. or it's not?
Well, the API of FFmpeg is always changing, but it's a good guide I think
Samuel
1. will you plan later to split wrappers such as for ffmpeg stuff to
separate packages? i mean it's not depended on opencv and can be used
widely.
2. as i read you switch from jna to java-cpp also because of speed. is
it really faster or execution speed not so different? i ask because i
thinking is it worth or not to switch my wrapper to java-cpp.
On 26 ноя, 08:56, Samuel Audet <samuel.au...@gmail.com> wrote:
> On 2011-11-26 00:44, eggnot wrote:
>
> > is there any java \ javacv related examples?
>
> You may want to check out the source code of FFmpegFrameGrabber and
> FFmpegFrameRecorder:http://code.google.com/p/javacv/source/browse/trunk/javacv/src/com/go...http://code.google.com/p/javacv/source/browse/trunk/javacv/src/com/go...
>
> > i found only example like this -http://dranger.com/ffmpeg/tutorial01.html
The avcodec.java, avformat.java, etc. are independent from OpenCV. If
the javacv*.jar files are too big for your liking, you may extract those
.java, .class, .so, .dll, .dylib files from the JAR files without
violating the license.
> 2. as i read you switch from jna to java-cpp also because of speed. is
> it really faster or execution speed not so different? i ask because i
> thinking is it worth or not to switch my wrapper to java-cpp.
Yes, it's much faster, at least 20 times faster, e.g.: about 10 ns vs
200 ns for a one argument function, but whether that is significant
depends on how heavy your functions are anyway.
Samuel
thanks.
int[] pixels = new int[numBytes/3];
for(int i=0, b=0; i<numBytes/3; i++,b+=3)
pixels[i] = (buffer.get(b) & 0xFF)<<16 |
(buffer.get(b+1)&0xFF)<<8 |
(buffer.get(b+2)&0xFF);
BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
image.setRGB(0, 0, width, height, pixels, 0, width);
return image;
or do you mean i can get the code from IplImage.getBufferedImage() and
other in opencv_core.java?
i see you doing it in flipCopyWithGamma() with for example
IntBuffer.get(), IntBuffer.put() but can't get the idea. or am i
wrong?
thanks,
> > data to java image after swscale?- Скрыть цитируемый текст -
>
> - Показать цитируемый текст -
how can i have ByteBuffer or so from buffer and numBytes(names are
from FFmpegFrameGrabber.java)
am i get right, i need something to turn pointer(buffer) with
size(numBytes) into ByteBuffer (or byte[] or maybe int[]) ?
other idea is to tell to sws_scale to write to some ecxisting
ByteBuffer/Array with giving buffer as pointer to it...
for both i have no idea how to impliment...
> > - Показать цитируемый текст -- Скрыть цитируемый текст -
Yes, you'll need to do something like that
> seems all that function use native asByteBuffer() from IplImage,
> right?
What function?
> how can i have ByteBuffer or so from buffer and numBytes(names are
> from FFmpegFrameGrabber.java)
what "buffer"? the BytePointer? Just call BytePointer.asBuffer() yes
> am i get right, i need something to turn pointer(buffer) with
> size(numBytes) into ByteBuffer (or byte[] or maybe int[]) ?
> other idea is to tell to sws_scale to write to some ecxisting
> ByteBuffer/Array with giving buffer as pointer to it...
>
> for both i have no idea how to impliment...
We can copy a Buffer into an array with Buffer.get(array), if this want
you need to do.
Samuel
in FFmpegFrameGrabber.java
buffer = new BytePointer(av_malloc(numBytes));
is just not producing correct BytePointer! that's why it's capacity 0
and buffer.asByteBuffer() is causing errors.
with
buffer = new BytePointer(numBytes);
finally
buffer.asByteBuffer()
works well.
i wondering i stuck with such simple thing.
Depending on the platform, that may not allocate memory that is aligned
well enough for FFmpeg, so we should still use av_malloc() to make sure,
e.g.:
buffer = new BytePointer(av_malloc(numBytes)).capacity(numBytes);
should do the trick
> i wondering i stuck with such simple thing.
Don't worry, this is not simple.. Software development is always like
that :)
Samuel