fasca / javadrone

Automatically exported from code.google.com/p/javadrone
0 stars 0 forks source link

DroneVideoListener writing to file #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
To save video stream to file we need to implement DroneVideoListener, writing 
frames as video file.

This will allow us to add capture functionality to UI.\

Original issue reported on code.google.com by kroko...@gmail.com on 22 May 2011 at 11:18

GoogleCodeExporter commented 9 years ago
Here is a nice free java class for creating AVI MJPEG files, maybe it helps: 
http://www.monceaux.org/coding/MJPEGGenerator.java

Original comment by normen667 on 23 May 2011 at 9:09

GoogleCodeExporter commented 9 years ago
Saw the current video recorder.. Wouldn't it be better if it stored the frames 
directly into the MJPEG interleaver instead of saving images first? It would 
only have to be extended to count the fame number by itself.

Original comment by normen667 on 25 May 2011 at 12:23

GoogleCodeExporter commented 9 years ago
Looks like the class we are using MJPEGGenerator is not designed to stream 
video to file. It is using fixed number of frames which should be passed in 
constructor. There are few ways we can go about it:

1. Modify class to update headers with correct number of frames when stream is 
closed.

2. Use JMF. They have pure Java impl. 
http://en.wikipedia.org/wiki/Java_Media_Framework Should do the trick but seems 
to be a bit heavy for what we are trying to achieve. A plus is that linux and 
windows users can use optimized version using platform-dependent codecs 
implementation, gaining better performance.

3. I found this class which seems to be suitable for what we are trying to do: 
http://www.randelshofer.ch/blog/2010/10/writing-quicktime-movies-in-pure-java/

Original comment by kroko...@gmail.com on 31 May 2011 at 1:05

GoogleCodeExporter commented 9 years ago
Just go back in the stream and write the image count later when its finished 
recording?

Original comment by normen667 on 31 May 2011 at 6:58

GoogleCodeExporter commented 9 years ago
Also I think having the run method synchronized is not a good idea, its 
constantly blocking the object when the thread is run..

Original comment by normen667 on 31 May 2011 at 9:03

GoogleCodeExporter commented 9 years ago
We put number of frames as 0 and resulting AVI files are playable with both VLC 
and QuickTime player. 
Looks like it is OK.

Original comment by kroko...@gmail.com on 31 May 2011 at 8:40