Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (44)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (7209)

  • How to configure proc_open "pipes" for ffmpeg stdin/stderr on Windows ?

    10 septembre 2018, par GDP

    Firstly, I’ve spent the week googling and trying variations of dozens and dozens of answers for Unix, but it’s been a complete bust, I need an answer for Windows, so this is not a duplicate question of the Unix equivalents.

    We’re trying to create a scheduled task that will process a queue of tasks in PHP, and maintain an array of up to 10 ffmpeg instances at a time. I’ve tried exec, shell_exec and proc_open , coupled with/without start /B without any "complete" luck.
    I’m also quite certain that it has to do with setting up the descriptorspec and pipes (which I’m completely unfamiliar with), and here’s why :

    Per https://trac.ffmpeg.org/wiki/PHP,

    The part that says ">/dev/null" will redirect the standard OUTPUT
    (stdout) of the ffmpeg instance to /dev/null (effectively ignoring the
    output) and "2>/dev/null" will redirect the standard ERROR (stderr) to
    /dev/null (effectively ignoring any error log messages). These two can
    be combined into a shorter representation : ">/dev/null 2>&1". If you
    like, you can ?read more about I/O Redirection.

    An important note should be mentioned here. The ffmpeg command-line
    tool uses stderr for output of error log messages and stdout is
    reserved for possible use of pipes (to redirect the output media
    stream generated from ffmpeg to some other command line tool). That
    being said, if you run your ffmpeg in the background, you’ll most
    probably want to redirect the stderr to a log file, to be able to
    check it later.

    One more thing to take care about is the standard INPUT (stdin).
    Command-line ffmpeg tool is designed as an interactive utility that
    accepts user’s input (usually from keyboard) and reports the error log
    on the user’s current screen/terminal. When we run ffmpeg in the
    background, we want to tell ffmpeg that no input should be accepted
    (nor waited for) from the stdin. We can tell this to ffmpeg, using I/O
    redirection again "

    echo "Starting ffmpeg...\n\n";
    echo shell_exec("ffmpeg -y -i input.avi output.avi null >/dev/null 2>/var/log/ffmpeg.log &");
    echo "Done.\n";

    This example actually uses shell_exec, though we want to use proc_open so that we can use a loop to check if the process has completed or not.

    Here’s a basic sample loop of what I’ve tried. The problem in executing this is that the actual ffmpeg processing completes, but the process is hung "waiting for something". When I use debugging, and step out of the loop and terminate the process after a few minutes, the ffmpeg output is written and the script carries on. (From the command line, ffmpeg takes less than a minute to complete)

    $descriptorspec = array(
       array('pipe', 'r'),
       array('pipe', 'w'),
       array('pipe', 'w'),
    );
    $pipes = null;
    $cwd = null;
    $env = null;
    $process = proc_open('start /B ffmpeg.exe -i input.mov output.mp4 -nostdin', $descriptorspec, $pipes, $cwd, $env);
    $status = proc_get_status($process);
    while($status['running']) {
       sleep (60);
       $status = proc_get_status($process);
    }
    proc_terminate($process);

    Also, as documented at ffmpeg Main-options :

    Enable interaction on standard input. On by default unless standard
    input is used as an input. To explicitly disable interaction you need
    to specify -nostdin.

    The -nostdin option seems to indicate that it addresses my problem, but it has no apparent affect. In all solutions for Unix that I’ve found, it appears to still require some form of this this unix added : null or 2>&1.

    So, with that somewhat exhaustive prologue, can someone explain how to properly configure the proc_open function to satisfy how ffmpeg.exe interacts with I/O ? If there is a better or more appropriate approach, I’m happy to do that, but the important thing is to be able to loop thru an array of processes to check if they’re complete, so that other faster processes can complete in the meantime.

    UPDATE
    After exhaustive R&D, it seems that the I/O is not the issue in making this happen (the -nostdin option seems to work as advertised). The premise of my design was to use proc_get_status() to determine when ffmpeg was finished. The flaw in that approach is that apparently that does NOT return the actual PID of the ffmpeg process...it returns the parent PID. So, when proc_get_status() returned that the video conversion was complete, it was in fact still running, not hung. This was further complicated by testing on larger video files. The larger the video, the longer the "residual" time was that it took to actually finish — the I/O wasn’t the issue - watching the Parent PID instead of the child PID was the problem. So, without getting into much lower level system internals with Windows, this doesn’t appear to be possible with PHP directly. I’ve decided to abandon this approach, but hopefully this discovery will save someone else some time and trouble.

  • Using a pipe character | with child_process spawn

    19 avril 2020, par Titan

    I'm running nodejs on a raspberry pi and I want to run a child process to spawn a webcam stream.

    



    Outside of node my command is :

    



    raspivid -n -mm matrix -w 320 -h 240 -fps 18 -g 100 -t 0 -b 5000000 -o - | ffmpeg -y -f h264 -i - -c:v copy -map 0:0 -f flv -rtmp_buffer 100 -rtmp_live live "rtmp://example.com/big/test"


    



    With child_process I have to break each argument up

    



    var args = ["-n", "-mm", "matrix", "-w", "320", "-h", "240", "-fps", "18", "-g", "100", "-t", "0", "-b", "5000000", "-o", "-", "|", "ffmpeg", "-y", "-f", "h264", "-i", "-", "-c:v", "copy", "-map", "0:0", "-f", "flv", "-rtmp_buffer", "100", "-rtmp_live", "live", "rtmp://example.com/big/test"];


    



    camera.proc = child.spawn('raspivid', args);


    



    However it chokes on the | character :

    



    error, exit code 64
Invalid command line option (|)


    



    How do I use this pipe character as an argument ?

    


  • execFile function with node and ffmpeg shaves off 1 second of video created

    10 octobre 2018, par Amin Baig

    I am using the latest node js and windows 10. I am creating a 5 seconds video from a single image using ffmpeg in the node js child process. Following is the code :

    const execFile = require('child_process').execFile;

    // Command to transform
    //ffmpeg -framerate 30 -loop 1 -t 5 -i 1.jpg -i 3D_Transition_02.mp4 -filter_complex "[0]format=rgba,scale=1280:720,split[img][a]; [1]format=rgb24,negate,scale=1280:720[tr];[a][tr]overlay=format=gbrp[al];[img][al]alphamerge,setsar=1,format=yuva444p" -an -c:v libvpx -crf 10 -b:v 0 -quality realtime -auto-alt-ref 0 a1vp8.mkv

    let str = "[0]format=rgba,scale=1280:720,split[img][a]; [1]format=rgb24,negate,scale=1280:720[tr];[a][tr]overlay=format=gbrp[al];[img][al]alphamerge,setsar=1,format=yuva444p";

    const child = execFile('ffmpeg', ['-framerate', '30', '-loop', '1', '-t', '5', '-i', '1.jpg', '-i', '3D_Transition_02.mp4', '-filter_complex', str, '-an', '-c:v', 'libvpx', '-crf', '10', '-b:v', '0', '-quality', 'realtime', '-auto-alt-ref', '0', 'a2vp8.mkv'], (error, stdout, stderr) => {
       if (error) {
           console.error('Error:', stderr);
           throw error;
       }
       console.log('Success', stdout);
    });

    console.log('Video created');

    The video is created successfully but...as you can see in the command it should be 5 seconds long. The first time i created the video it was 5 seconds long, but on the second and later attempts it’s 4 seconds long(in the gom player it shows a blank area in the play seek bar) !!!

    When I right click and view details of the file it is 5 seconds long.

    the behavior is the I first get the console message : video created, and then after a few seconds (when the file is rendered) I get the std out "Success" message.

    Any ideas why it’s behaving like this ? I also tried the execFileSync and it also created a 4 second video (at least as per the gom player play seek bar).