Link to home
Start Free TrialLog in
Avatar of DWR200
DWR200

asked on

images to movie

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);
        }
    }
Avatar of zzynx
zzynx
Flag of Belgium image

Avatar of DWR200
DWR200

ASKER

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?
>> 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
Avatar of DWR200

ASKER

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?
>> 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...
Avatar of DWR200

ASKER

ouh. i didnt see that. ill try to figure that out.
ASKER CERTIFIED SOLUTION
Avatar of zzynx
zzynx
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of DWR200

ASKER

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
>> 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);
}
Avatar of DWR200

ASKER

kkk. dude thanks i will try the new code out. but thanks again.
Avatar of DWR200

ASKER

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.
>> 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
Avatar of DWR200

ASKER

ok. been to that website before. but the case now is that im dealing with IP camera. Axis IP camera 211A to be exact.
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.