Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

images to movie

Posted on 2007-07-25
15
Medium Priority
?
307 Views
Last Modified: 2010-08-05
Hi guys.

im able to save images from the streaming media live from an ip camera using FileOutputStream. howeer now i need to like merge all those images n make it into a movie. (eg .mov). anyone has any java codes to do this??


public void readJPG(){ //read the embedded jpeg image
        try{
            JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(dis);
            image = decoder.decodeAsBufferedImage();
           
            String s="a"+counter+".jpg";
            counter++;
            String filename="c:\\find\\"+s;
            BufferedImage smaller = toBufferedImage(getScaledInstanceAWT(image, 1.0/3.0));//scalling image size
           
            try {
                OutputStream out = new FileOutputStream(filename);
                JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
                encoder.encode(smaller);
                out.close();
            } catch (Exception e) {
                System.out.println(e);
            }
           
        }catch(Exception e){e.printStackTrace();disconnect();}
    }
   
    public void readLine(int n, DataInputStream dis){ //used to strip out the header lines
        for (int i=0; i<n;i++){
            readLine(dis);
        }
    }
0
Comment
Question by:DWR200
  • 8
  • 7
15 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 19563660
0
 

Author Comment

by:DWR200
ID: 19571296
hey thanks. i look trhough the codes. but where is the part to actually retrieve the images? i stored the saved images in a specific folder. any codes to modify to retrieve images from a specific source?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 37

Expert Comment

by:zzynx
ID: 19572293
>> but where is the part to actually retrieve the images?
I don't understand. Didn't you say:
>> im able to save images from the streaming media
0
 

Author Comment

by:DWR200
ID: 19579508
yes im able to save the images. but how do i implement the the source you give to me? cos the codes you give me at some point need to read the images right to make it into a movie?
0
 
LVL 37

Expert Comment

by:zzynx
ID: 19581047
>> at some point need to read the images right to make it into a movie?

Since the usage of the program is:

java JpegImagesToMovie -w <width> -h <height> -f <frame rate> -o <output URL> <input JPEG file 1> <input JPEG file 2> ...

I thought you don't need to bother about that...
0
 

Author Comment

by:DWR200
ID: 19589537
ouh. i didnt see that. ill try to figure that out.
0
 
LVL 37

Accepted Solution

by:
zzynx earned 1500 total points
ID: 19590730
>> ouh. i didnt see that

The link I gave in my 2nd post also talks about this usage:

=====BAD ==============================================

-w 320 -h 240 -f 1 -o file:/c:/temp/fooMov.mov file:/c:/temp/foo1.jpg file:/c:/temp/foo2.jpg

===== GOOD ======================================

-w 320 -h 240 -f 1 -o file:/c:/temp/fooMov.mov c:/temp/foo1.jpg c:/temp/foo2.jpg
0
 

Author Comment

by:DWR200
ID: 19590976
yes. i managed to do it. thank you. but however.i have to change some codes man. i have like a few hundreds images man. i cant posible type every single file directory. haiz
0
 
LVL 37

Expert Comment

by:zzynx
ID: 19591036
>> yes. i managed to do it.
Good to hear.
>> but however.i have to change some codes man.
>> i have like a few hundreds images
Then use one txt file that contains the files to process:

ToProcess.txt
------------------
c:/dir1/dir2/whatever/file1.jpg
c:/dir1/whatever/file2.jpg
c:/dir1/file97.jpg
...

Reading Text from a File:

try {
   BufferedReader in = new BufferedReader(new FileReader("c:/dir1/dir2/ToProcess.txt"));
   String str;
   while ((str = in.readLine()) != null) {
       process(str);
   }
   in.close();
} catch (IOException e) {
}

in which the method process(str)
just does the filling of the vector "inputFiles" with the read jpg file name:

private process(String str) {
     inputFiles.add(str);
}
0
 

Author Comment

by:DWR200
ID: 19597208
kkk. dude thanks i will try the new code out. but thanks again.
0
 

Author Comment

by:DWR200
ID: 19597421
zzynx, can i ask u something. is it posible to record video stream using java coding? because that is actually the specs of my project. and i cant find any solution of recording stream of video. right now all i can find is this which is to save the images and make it into movie file.

hope that you any suggestions or solutions would be better.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 19598159
>> zzynx, can i ask u something.
Sure

>> is it posible to record video stream using java coding?
According to this (http://www.mutong.com/fischer/java/usbcam/) it is possible
Like I always say: "In programming (no matter what language) everything is possible" ;°)

btw, thanx 4 axxepting
0
 

Author Comment

by:DWR200
ID: 19598306
ok. been to that website before. but the case now is that im dealing with IP camera. Axis IP camera 211A to be exact.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 19598318
It must be possible.
But I'm not the right person to help you with this specific problem.
Try posting a new Q concerning this item.
I'm sure other experts will be able to help you.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question