Why after my project on ip camera records in vlcj build ​​to the JAR file it can not running?

 

Why after my project on ip camera records in vlcj build ​​to the JAR file, it can not run? Please help me
 
 
 
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//Saran dari http://myrobotlab.org/forum
//Sumber http://caprica.github.io/vlcj/
package apps.user.gui;
 
import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import java.awt.BorderLayout;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.*;
import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;
 
/**
 *
 * @author Dedy
 */
public class CctvUser extends javax.swing.JFrame {
     public final EmbeddedMediaPlayerComponent mediaPlayerComponent;
 
    /**
     * Creates new form CctvUser
     */
    public CctvUser() {
        //initComponents();
        JFrame frame = new JFrame("Closed Circuit Television (CCTV)"); 
        frame.setIconImage(new javax.swing.ImageIcon(getClass().
        getResource("/apps/user/image/cctv.png")).getImage());//Memberi favicon di jframe   
        frame.setSize(1050, 600);
        frame.setVisible(true);                    
        
        NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), "/apps/user/dll/");//Load dll vlc
        Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);    
        
        mediaPlayerComponent = new EmbeddedMediaPlayerComponent();   
        frame.setContentPane(mediaPlayerComponent);                 
        
        File dir = new File(System.getProperty("user.home"), "Videos");
        dir.mkdirs();
        DateFormat df = new SimpleDateFormat("yyyyMMdd-HHmmss");
        String fileName = dir.getAbsolutePath() + "/Capture-" + df.format(new Date()) + ".mpeg";          
        String [] options =  {":sout=#transcode{vcodec=mpgv,vb=4094,scale=1,acodec=mpg,ab=128,channels=2,samplerate=44100}:duplicate{dst=file{dst=" + fileName + "},dst=display}"};
        mediaPlayerComponent.getMediaPlayer().playMedia("D:\\2.MP4",options);       
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {
 
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
 
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 395, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 364, Short.MAX_VALUE)
        );
 
        pack();
    }// </editor-fold>                        
 
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CctvUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CctvUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CctvUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CctvUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
 
        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {
 
            public void run() {
                new CctvUser();                
            }
        });
    }
    // Variables declaration - do not modify                     
    // End of variables declaration                   
}
 
GroG's picture

This code "looks" like it

This code "looks" like it tries to play  "D:\\2.MP4"  

Did you prevously stream this file and record it from an IP camera?

I'm not sure why it would not work - the first test I would do is to see if VLC.exe can play it.  If it can then your options are incorrect.  If it can not play it then the recording is not good.

Dedy_hidayat's picture

  mediaPlayerComponent.getM

 

mediaPlayerComponent.getMediaPlayer().playMedia("D:\\2.MP4",options);   //For testing am use my video file in directory
 
PROBLEM :
if am running this file from NETBEANS it's works but after build to jar file it's not works What Happen?? Please help me
 
 
 
 
 
 
 
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//Saran dari http://myrobotlab.org/forum
//Sumber http://caprica.github.io/vlcj/
package apps.user.gui;
 
import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;
import java.awt.BorderLayout;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.*;
import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;
 
/**
 *
 * @author Dedy
 */
public class CctvUser extends javax.swing.JFrame {
     public final EmbeddedMediaPlayerComponent mediaPlayerComponent;
 
    /**
     * Creates new form CctvUser
     */
    public CctvUser() {
        initComponents();
        JFrame frame = new JFrame("Closed Circuit Television (CCTV)"); 
        frame.setIconImage(new javax.swing.ImageIcon(getClass().
        getResource("/apps/user/image/cctv.png")).getImage());//Memberi favicon di jframe   
        frame.setSize(1050, 600);
        frame.setVisible(true);                    
        
        NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(), "C:/Program Files/VideoLAN/VLC");//Load dll vlc
        Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);    
        
        mediaPlayerComponent = new EmbeddedMediaPlayerComponent();   
        frame.setContentPane(mediaPlayerComponent);                 
        
        File dir = new File(System.getProperty("user.home"), "Videos");
        dir.mkdirs();
        DateFormat df = new SimpleDateFormat("yyyyMMdd-HHmmss");
        String fileName = dir.getAbsolutePath() + "/Capture-" + df.format(new Date()) + ".mpeg";          
        String [] options =  {":sout=#transcode{vcodec=mpgv,vb=4094,scale=1,acodec=mpg,ab=128,channels=2,samplerate=44100}:duplicate{dst=file{dst=" + fileName + "},dst=display}"};
        mediaPlayerComponent.getMediaPlayer().playMedia("D:\\2.MP4",options);    //For testing am use my video file in directory 
 
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {
 
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
 
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 395, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 364, Short.MAX_VALUE)
        );
 
        pack();
    }// </editor-fold>                        
 
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CctvUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CctvUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CctvUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CctvUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
 
        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {
 
            public void run() {
                new CctvUser();                
            }
        });
    }
    // Variables declaration - do not modify                     
    // End of variables declaration                   
}

 

GroG's picture

whats the error you get when

whats the error you get when you try to run the jar?

Dedy_hidayat's picture

what should i do..??

yes my error when am try to jar, but when am running in netbeans this work's.

what should i do...??

GroG's picture

What IS the error Dedy?  What

What IS the error Dedy?  What information is there when it does not work ?