Recherche avancée

Médias (1)

Mot : - Tags -/biographie

Autres articles (111)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • Les notifications de la ferme

    1er décembre 2010, par

    Afin d’assurer une gestion correcte de la ferme, il est nécessaire de notifier plusieurs choses lors d’actions spécifiques à la fois à l’utilisateur mais également à l’ensemble des administrateurs de la ferme.
    Les notifications de changement de statut
    Lors d’un changement de statut d’une instance, l’ensemble des administrateurs de la ferme doivent être notifiés de cette modification ainsi que l’utilisateur administrateur de l’instance.
    À la demande d’un canal
    Passage au statut "publie"
    Passage au (...)

  • Initialisation de MediaSPIP (préconfiguration)

    20 février 2010, par

    Lors de l’installation de MediaSPIP, celui-ci est préconfiguré pour les usages les plus fréquents.
    Cette préconfiguration est réalisée par un plugin activé par défaut et non désactivable appelé MediaSPIP Init.
    Ce plugin sert à préconfigurer de manière correcte chaque instance de MediaSPIP. Il doit donc être placé dans le dossier plugins-dist/ du site ou de la ferme pour être installé par défaut avant de pouvoir utiliser le site.
    Dans un premier temps il active ou désactive des options de SPIP qui ne le (...)

Sur d’autres sites (8958)

  • Meteor Spawn_Child_Process for FFMpeg [duplicate]

    2 mars 2013, par user2009114

    Hi I am trying to use Meteor and javascript (Node) to spawn an ffmpeg transcoding event and then stream it live through HTML5 video tags. However, though I can get it working with node.js it seems to hang on the Meteor server and not stream anything though it does seem to be transcoding okay. It appears that the transcoding thread hangs up the server, or is not even a different thread at all ? I am pasting the relevant server side code followed by the client code calling it. One JQuery function calls the transcoding process and the PollForPlaylist is called from the video tags by the hls/. Any help would be much appreciated in solving this. I am wondering if there is a meteor function which I can call to spawn a thread for the ffmpeg function ? Or maybe there is another way to push data to the video tag through jQuery ?

    var spawnNewProcess = function(file, playlistPath) {
       var outputUrlPrefix = '/segment/';
       var args = ['-i', file, '-async', '1', '-acodec', 'libmp3lame', '-b:a', 128 + 'k', '-vf', 'scale=min(' + targetWidth + '\\, iw):-1', '-b:v', videoBitrate + 'k', '-ar', '44100', '-ac', '2', '-vcodec', 'libx264', '-x264opts', 'level=3.0', '-profile:v', 'baseline', '-preset:v' ,'superfast', '-threads', '0', '-flags', '-global_header', '-map', '0', '-f', 'segment', '-segment_time', '10', '-segment_list', 'stream.m3u8', '-segment_format', 'mpegts', '-segment_list_flags', 'live', 'stream%05d.ts'];

       var encoderChild = childProcess.spawn(transcoderPath, args, {cwd: outputPath});

       console.log(transcoderPath + args);

       encoderProcesses[file] = encoderChild;
       currentFile = file;

       console.log('Spawned transcoder instance');

       if (debug) {
           encoderChild.stderr.on('data', function(data) {
               console.log(data.toString());
           });
       }

       encoderChild.on('exit', function(code) {
           console.log('Transcoder exited with code ' + code);

           delete encoderProcesses[file];
       });

       // Kill any "zombie" processes
       setTimeout(function() {
           if (encoderProcesses[file]) {
               console.log('Killing long running process');

               killProcess(encoderProcesses[file]);
           }
       }, processCleanupTimeout);
    };

    var pollForPlaylist = function(file, response) {
       var numTries = 0;
       console.log("IN POLL FOR PLAYLIST");

       var tryOpenFile = function() {
           if (numTries > 20) {
               console.log('Gave up trying to open m3u8 file');
               response.writeHead(500);
               response.end();
           }
           else {
               console.log("IN ELSE");
               fs.readFile(playlistPath, function (err, data) {
                   console.log("Trying to read file");
                   if (err || data.length === 0) {
                       numTries++;
                       setTimeout(tryOpenFile, 200);
                       console.log("ERROR, number of tries", numTries);
                   }
                   else {
                       if (!debug) {
                           response.setHeader('Content-Type', 'application/x-mpegURL');
                       }
                       console.log('response: ' + data);
                       response.write(data);
                       response.end();
                   }
               });
           }
       };
           console.log("Try open");
           tryOpenFile();
    };

    var killProcess = function(processToKill, callback) {
       processToKill.kill();

       setTimeout(function() {
           processToKill.kill('SIGKILL');
       }, 5000);

       processToKill.on('exit', function(code) {
           if (callback) callback();
       });
    }

    var handlePlaylistRequest = function(file, request, response) {
       if (!file) {
           request.writeHead(400);
           request.end();
       }

       if (lock) {
           console.log('Ongoing spawn process not finished, denying request');
           response.writeHead(503);
           response.end();
           return;
       }

       file = path.join('/', file); // Remove ".." etc
       file = path.join(rootPath, file);

       console.log("PLAYLIST PATH", playlistPath);
       if (currentFile != file) {
           lock = true;

           console.log('New file to encode chosen');

           // Make sure old one gets killed
           if (encoderProcesses[currentFile]) {
               killProcess(encoderProcesses[currentFile], function() {
                   fs.unlink(playlistPath, function (err) {
                       spawnNewProcess(file, playlistPath, outputPath);
                       lock = false;
                   });
               });
           }
           else {
               fs.unlink(playlistPath, function (err) {
                   spawnNewProcess(file, playlistPath, outputPath);
                   lock = false;
               });
           }
           currentFile = file;
       }
    };

    The Client side code which calls this is :

    var videoNode = document.querySelector('video');
    $.get('hls/?file='+file);
    videoNode.src = "hls/" + file;
  • Anomalie #3362 (Nouveau) : Erreur de syntaxe CSS du style embarqué

    9 décembre 2014, par Fred Barboteu

    Ligne 139 dans ajaxCallback.js (SPIP 3.0.14) :
    ...

    ...
    Il manque les "px" sur left et top : provoque l’affichage d’une erreur CSS, et l’absence d’effet du positionnement souhaité.

  • Manage multipe IP cameras at the same time

    4 juin 2015, par Alessio

    How I can manage multiple GoPro cameras at the same time ? I want to stream three videos of three GoPro cameras at the same time and record the videos on the hard disk.

    I have written a tool in Java for one GoPro and it works correctly.

    Help me please !

    This is the code :

    public class GoProStreamer extends JFrame {

    private static final String CAMERA_IP = "10.5.5.9";
    private static int PORT = 8080;
    private static DatagramSocket mOutgoingUdpSocket;
    private Process streamingProcess;
    private Process writeVideoProcess;
    private KeepAliveThread mKeepAliveThread;

    private JPanel contentPane;

    public GoProStreamer() {
       setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       setBounds(800, 10, 525, 300);

       contentPane = new JPanel();
       contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
       contentPane.setLayout(new BorderLayout(0, 0));
       setContentPane(contentPane);

       JButton btnStop = new JButton("Stop stream");
       JButton btnStart = new JButton("Start stream");
       JButton btnRec = new JButton("Rec");
       JButton btnStopRec = new JButton("Stop Rec");
       //      JButton btnZoomIn = new JButton("Zoom In sincrono");
       //      JButton btnZoomOut = new JButton("Zoom out sincrono");
       //      JButton btnZoomIn1 = new JButton("Zoom In Camera 1");
       //      JButton btnZoomOut1 = new JButton("Zoom out Camera 1");
       //      JButton btnZoomIn2 = new JButton("Zoom in Camera 2");
       //      JButton btnZoomOut2 = new JButton("Zoom out Camera 2");
       //      JButton btnZoomIn3 = new JButton("Zoom in camera 3");
       //      JButton btnZoomOut3 = new JButton("Zoom out Camera 3");

       btnStop.setEnabled(false);
       btnRec.setEnabled(false);
       btnStopRec.setEnabled(false);
       //      btnZoomIn.setEnabled(false);
       //      btnZoomOut.setEnabled(false);
       //      btnZoomIn1.setEnabled(false);
       //      btnZoomOut1.setEnabled(false);
       //      btnZoomIn2.setEnabled(false);
       //      btnZoomOut2.setEnabled(false);
       //      btnZoomIn3.setEnabled(false);
       //      btnZoomOut3.setEnabled(false);

       JPanel panel = new JPanel();
       //      JPanel panel2 = new JPanel();
       //      JPanel panel3 = new JPanel();
       //      JPanel panel4 = new JPanel();

       panel.add(btnStart);
       panel.add(btnStop);
       panel.add(btnRec);
       panel.add(btnStopRec);
       //      panel2.add(btnZoomIn1);
       //      panel3.add(btnZoomOut1);
       //      panel2.add(btnZoomIn2);
       //      panel3.add(btnZoomOut2);
       //      panel2.add(btnZoomIn3);
       //      panel3.add(btnZoomOut3);
       //      panel4.add(btnZoomIn);
       //      panel4.add(btnZoomOut);

       contentPane.add(panel, BorderLayout.SOUTH);
       //  contentPane.add(panel2, BorderLayout.NORTH);
       //  contentPane.add(panel3, BorderLayout.CENTER);

       btnStart.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent arg0) {
               startStreamService();
               keepAlive();
               startStreaming();

               btnStart.setEnabled(false);
               btnStop.setEnabled(true);
               btnRec.setEnabled(true);
               btnStopRec.setEnabled(false);
               //              btnZoomIn.setEnabled(true);
               //              btnZoomOut.setEnabled(true);
               //              btnZoomIn1.setEnabled(true);
               //              btnZoomOut1.setEnabled(true);
               //              btnZoomIn2.setEnabled(true);
               //              btnZoomOut2.setEnabled(true);
               //              btnZoomIn3.setEnabled(true);
               //              btnZoomOut3.setEnabled(true);
           }
       });

       btnStop.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent arg0) {
               stopStreaming();
               stopKeepalive();

               btnStart.setEnabled(true);
               btnStop.setEnabled(false);
               btnRec.setEnabled(false);
               btnStopRec.setEnabled(false);
           }
       });

       btnRec.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent arg0) {
               startRec();

               btnStart.setEnabled(false);
               btnStop.setEnabled(false);
               btnRec.setEnabled(false);
               btnStopRec.setEnabled(true);
           }
       });

       btnStopRec.addActionListener(new ActionListener() {
           public void actionPerformed(ActionEvent arg0) {
               stopRec();

               btnStart.setEnabled(false);
               btnStop.setEnabled(true);
               btnRec.setEnabled(true);
               btnStopRec.setEnabled(false);
           }
       });
    }

    private void startStreamService() {
       HttpURLConnection localConnection = null;
       try {
           String str = "http://" + CAMERA_IP + "/gp/gpExec?p1=gpStreamA9&c1=restart";
           localConnection = (HttpURLConnection) new URL(str).openConnection();
           localConnection.addRequestProperty("Cache-Control", "no-cache");
           localConnection.setConnectTimeout(5000);
           localConnection.setReadTimeout(5000);
           int i = localConnection.getResponseCode();
           if (i >= 400) {
               throw new IOException("sendGET HTTP error " + i);
           }
       }
       catch (Exception e) {

       }
       if (localConnection != null) {
           localConnection.disconnect();
       }
    }

    @SuppressWarnings("static-access")
    private void sendUdpCommand(int paramInt) throws SocketException, IOException {
       Locale localLocale = Locale.US;
       Object[] arrayOfObject = new Object[4];
       arrayOfObject[0] = Integer.valueOf(0);
       arrayOfObject[1] = Integer.valueOf(0);
       arrayOfObject[2] = Integer.valueOf(paramInt);
       arrayOfObject[3] = Double.valueOf(0.0D);
       byte[] arrayOfByte = String.format(localLocale, "_GPHD_:%d:%d:%d:%1f\n", arrayOfObject).getBytes();
       String str = CAMERA_IP;
       int i = PORT;
       DatagramPacket localDatagramPacket = new DatagramPacket(arrayOfByte, arrayOfByte.length, new InetSocketAddress(str, i));
       this.mOutgoingUdpSocket.send(localDatagramPacket);
    }

    private void startStreaming() {
       Thread threadStream = new Thread() {
           @Override
           public void run() {
               try {
                   streamingProcess = Runtime.getRuntime().exec("ffmpeg-20150318-git-0f16dfd-win64-static\\bin\\ffplay -i http://10.5.5.9:8080/live/amba.m3u8");
                   InputStream errorStream = streamingProcess.getErrorStream();
                   byte[] data = new byte[1024];
                   int length = 0;
                   while ((length = errorStream.read(data, 0, data.length)) > 0) {
                       System.out.println(new String(data, 0, length));
                       System.out.println(System.currentTimeMillis());
                   }

               } catch (IOException e) {

               }
           }
       };
       threadStream.start();
    }

    private void startRec() {
       Thread threadRec = new Thread() {
           @Override
           public void run() {
               try {
                   writeVideoProcess = Runtime.getRuntime().exec("ffmpeg-20150318-git-0f16dfd-win64-static\\bin\\ffmpeg -re -i http://10.5.5.9:8080/live/amba.m3u8 -c copy -an Video_GoPro_" + Math.random() + ".avi");
                   InputStream errorRec = writeVideoProcess.getErrorStream();
                   byte[] dataRec = new byte[1024];
                   int lengthRec = 0;
                   while ((lengthRec = errorRec.read(dataRec, 0, dataRec.length)) > 0) {
                       System.out.println(new String(dataRec, 0, lengthRec));
                       System.out.println(System.currentTimeMillis());
                   }
               } catch (IOException e) {

               }
           }
       };
       threadRec.start();
    }

    private void keepAlive() {
       mKeepAliveThread = new KeepAliveThread();
       mKeepAliveThread.start();
    }

    class KeepAliveThread extends Thread {
       public void run() {
           try {
               Thread.currentThread().setName("gopro");
               if (mOutgoingUdpSocket == null) {
                   mOutgoingUdpSocket = new DatagramSocket();
               }
               while ((!Thread.currentThread().isInterrupted()) && (mOutgoingUdpSocket != null)) {
                   sendUdpCommand(2);
                   Thread.sleep(2500L);
               }
           }
           catch (SocketException e) {

           }
           catch (InterruptedException e) {

           }
           catch (Exception e) {

           }
       }
    }

    private void stopStreaming() {
       if (streamingProcess != null) {
           streamingProcess.destroy();
           streamingProcess = null;
       }
       stopKeepalive();
       mOutgoingUdpSocket.disconnect();
       mOutgoingUdpSocket.close();
    }

    private void stopRec() {
       writeVideoProcess.destroy();
       writeVideoProcess = null;
    }

    private void stopKeepalive() {
       if (mKeepAliveThread != null) {
           mKeepAliveThread.interrupt();
           try {
               mKeepAliveThread.join(10L);
               mKeepAliveThread = null;
           }
           catch (InterruptedException e) {
               Thread.currentThread().interrupt();
           }
       }
    }

    public static void main(String[] args) {
       GoProStreamer streamer = new GoProStreamer();
       streamer.setVisible(true);
       streamer.setTitle("Pannello di controllo");
    }

    }