Hi there. I am what Java terms newcomers and I am working to be about 5 months on a school project. I should be able to control a camera through an IP and save images and videos.
The software has come ready but unfortunately that does not work with the video store. Have now solved the problem that the software freezes but when I start recording the program takes a video on that is also greater from the MB the longer it takes. But when I run it looks as if the program takes only few milliseconds. Does anyone have an idea where the error might be?
I am very grateful for any help.

Greeting David

Get the code for the button in the Main
Java Code:
btnVideoSave = new JButton("Video speichern");
        btnVideoSave.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
        	    VideoSpeichern video = new VideoSpeichern(Daten);
        	    VideoSpeichern = new Thread(video);
        	    VideoSpeichern.start();
        		
        	}
        });
        btnVideoSave.setBounds(670, 327, 89, 23);
        getContentPane().add(btnVideoSave);
Here is the code for saving the video

Java Code:
package RaspiSpy;

import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;

import java.text.SimpleDateFormat;
import java.util.Date;

public class VideoSpeichern implements Runnable {

   	String Daten[];
   	
   	public VideoSpeichern(String [] Daten){
   		
   		this.Daten = Daten;
   	}

    
    public void run(){
        //Thread thisThread = Thread.currentThread();
        
 
    	BufferedInputStream stream = null;
        FileOutputStream fos = null;
    	
        try {
            Date dt = new Date();
            SimpleDateFormat dtformat = new SimpleDateFormat("dd.MM.yyyy 'at' HH.mm.ss");// Datumsformat festlegen
            URL url = new URL("http://" + Daten[0] + ":" + Daten[1]);
            URLConnection conn = url.openConnection();
            stream = new BufferedInputStream(conn.getInputStream());
            
            fos = new FileOutputStream(Daten[4] + "\\"+ dtformat.format(dt) +".mpeg");
            
            // Die ausgelesenen Daten liegen als byte vor, nicht als char
            byte  buffer[] = new byte[256];
            int   nbytes ;
            
            /*
             * Hier wird nicht immer nur ein byte gelesen, sondern gleich
             * maximal 256. Bringt bessere Performance.
             */
            while((nbytes=stream.read(buffer, 0, 256)) != 1) { 
                fos.write(buffer, 0, nbytes);
            }
            
            /*
             * Buffer leeren, Speicher freigeben
             */
            buffer = null;
    } catch(IOException e1) {
        e1.printStackTrace();
    } finally {
        /*
         * Die Streams schließen, egal ob Exception kommt oder nicht
         */
        if(fos != null) {
            try {
                fos.close();
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
        
        if(stream != null) {
            try {
                stream.close();
            } catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    }


}}