![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2
![]() |
convert image sequence to quicktime movie
Hi,
I'm using the Quicktime for Java API, and I'm having trouble with an application I'm working on. Basically, I need to take an image sequence, and convert that sequence to a quicktime movie. I need to do that from the command line, not sure if that's possible? I've written all the code that manages the application, gets a list of ordered files to use for the sequence, pretty much 95% is done, but I just can't convert the sequence to quicktime!!! I can do this: private ArrayList<QTFile> files; ... QTSession.open(); QTFile outFile = new QTFile(outFileTmp); files.get(0).convertToMovieFile(outFile,0,0); QTSession.close(); Which works fine for creating a *.mov that just has a single image... The Quicktime for Java documentation is very hard to decipher! Most of the code is deprecated!!! Hope someone can help! Any responses would be greatly appreciated! Thanks! Rich |
|
|
|
|
|
#2 |
|
11 years old
Join Date: Nov 2007
Posts: 79
Rep Power: 1
![]() |
Re: convert image sequence to quicktime movie
http://lists.apple.com/archives/Quic.../msg00056.html
This is the same question, and it seems to also have an answer. |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2
![]() |
Re: convert image sequence to quicktime movie
Hey man!
Thanks, that was helpful! Made some progress, but i've still got a problem getting this to work! //create movie file from sequence.
QTSession.open();
ImageInfo ii = ImageUtils.create(tmpFiles[0]);
BufferedImage bi = (BufferedImage)ii.image;
System.out.println("Image: (" + bi.getWidth() + "," + bi.getHeight() + ")");
ByteArrayOutputStream bos = new ByteArrayOutputStream();
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos);
JPEGEncodeParam jpegParams = encoder.getDefaultJPEGEncodeParam(bi);
jpegParams.setQuality(1.0f,false);
encoder.encode(bi);
byte[] dataBytes = bos.toByteArray();
//test
QTHandle qtHandle = new QTHandle(dataBytes);
Movie movie = Movie.fromHandle(qtHandle);
movie.convertToFile(new QTFile("c:\\tmp\\qthandle_test.mov"),0,0,0);
QTSession.close();Compiles with a few warnings (the com.... packages), but when I run this is the output: quicktime.std.StdQTException[QTJava:7.3.0g],-2002=badPublicMovieAtom,QT.vers:7308000
at quicktime.std.StdQTException.checkError(StdQTException.java:38)
at quicktime.std.movies.Movie.fromHandle(Movie.java:252)
at quicktime.std.movies.Movie.fromHandle(Movie.java:222)
at daily.ComposeDaily.<init>(ComposeDaily.java:89)
at Daily.main(Daily.java:79)Hope you can help! Thanks! |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3
![]() |
Re: convert image sequence to quicktime movie
Have you considered using JMF?
|
|
|
|
|
|
#5 |
|
Professional Programmer
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2
![]() |
Re: convert image sequence to quicktime movie
Hey Harakim,
Thanks for the reply! Well, I found a sample application that used JMF, i'll take another look at it! I've made quite a bit of progress with the quicktime app, I can open the movie file, but nothing is displayed... Image image = ...
BufferedImage bi = (BufferedImage)image;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos);
JPEGEncodeParam jpegParams = encoder.getDefaultJPEGEncodeParam(bi);
jpegParams.setQuality(1.0f,false);
encoder.encode(bi);
byte[] dataBytes = bos.toByteArray();
QTFile movFile = new QTFile(new java.io.File("c:\\tmp\\A_NEW_FILE.mov"));
Movie movie = Movie.createMovieFile(movFile,StdQTConstants.kMoviePlayer,
StdQTConstants.createMovieFileDeleteCurFile |
StdQTConstants.createMovieFileDontCreateResFile);
int timeScale = 1;
Track videoTrack = movie.addTrack(width,height,0);
VideoMedia videoMedia = new VideoMedia(videoTrack,timeScale);
videoMedia.beginEdits();
ImageDescription imgDesc = new ImageDescription(QDConstants.k32ARGBPixelFormat);
imgDesc.setWidth(width);
imgDesc.setHeight(height);
QTHandle imageHandle = new QTHandle(dataBytes.length,true);
imageHandle.lock();
videoMedia.addSample(imageHandle,0,dataBytes.length,1,imgDesc,1,0);
videoMedia.endEdits();
videoTrack.insertMedia(0,0,videoMedia.getDuration(),1);
OpenMovieFile omf = OpenMovieFile.asWrite(movFile);
movie.addResource(omf,StdQTConstants.movieInDataForkResID,movFile.getName());
QTSession.close();Not sure why, but I suspect that it's the way I'm creating the image? Hope someone can help! Will look at the JMF now! Thanks! |
|
|
|
|
|
#6 |
|
Hobbyist Programmer
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3
![]() |
Re: convert image sequence to quicktime movie
I don't have time to look at this now, unfortunately. How time sensitive is this? I can probably rig up some code that does this in JMF if that's ok.
|
|
|
|
|
|
#7 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: convert image sequence to quicktime movie
We're sorry that you have the defiite answer, but don't have time to explain. Life sucks, and so do fakers.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#8 |
|
Hobbyist Programmer
Join Date: May 2006
Location: West Jordan, Utah, United States
Posts: 176
Rep Power: 3
![]() |
Re: convert image sequence to quicktime movie
|
|
|
|
|
|
#9 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: convert image sequence to quicktime movie
I don't have an answer for the OP. Do you? If so, give it. If you don't have time, why are you effing around here? Get back to work.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#10 |
|
Professional Programmer
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2
![]() |
Re: convert image sequence to quicktime movie
Hey guys!
Chill! No, it's still a problem. It's also fairly urgent as well! I downloaded the JMF sample, "JpegImagesToMov" - compiled, seemed fine. Then I ran it with this command: -w 640 -h 480 -f 24 -o c:\tmp\OUTPUT.mov c:\tmp\cube_seq\cube_test.001.jpg I got this error: init: deps-jar: compile: run: - create processor for the image datasource ... Setting the track format to: JPEG - create DataSink for: c:\tmp\OUTPUT.mov Cannot create the DataSink: javax.media.NoDataSinkException: Cannot find a DataSink for: com.sun.media.multiplexer.BasicMux$BasicMuxDataSource@186d4c1 Failed to create a DataSink for the given output MediaLocator: c:\tmp\OUTPUT.mov BUILD SUCCESSFUL (total time: 0 seconds) I'm quite happy to solve this problem on my own! Thanks for the kind offer though, but I can't accept it! I think my main problem is that I'm new to Java, and I don't understand about converting an image to a byte array... Hope you will be able to help! Thanks! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Image float, wrap text, oh boy! | DaveQB | HTML / XHTML / CSS | 1 | May 20th, 2006 12:34 AM |
| Image Viewer (Urgent Bèta testing) | SoniX | Visual Basic .NET | 8 | Sep 21st, 2005 5:25 PM |
| raw image conversion | jasoncrab | C++ | 1 | Aug 25th, 2005 10:11 PM |
| Rent a movie. | Broax | Coder's Corner Lounge | 13 | Jul 24th, 2005 1:44 PM |
| Checking source codes of image, audio and video files | on_auc | C++ | 3 | Feb 21st, 2005 8:36 PM |