Recherche avancée

Médias (1)

Mot : - Tags -/école

Autres articles (111)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (10616)

  • ffmpeg delogo works not good when delogo at boundary

    13 mars 2017, par Yang Zhang

    I am trying using ffmpeg delogo filter to hide the logo, but I found when the logo is appears at boundary, delogo filter seems works not good. please check following images.

    enter image description here
    enter image description here

    I also read a bit of source, seems the algorithm need subtract 1 pixel boundary. in the second image, the delogo result is looks strange, bottom is white. I want to make it invisible, is it possible ?

    thanks

  • what is the good function php to deal with ffmpeg and progress bar [duplicate]

    17 mai 2014, par Abed Soliman

    This question already has an answer here :

    I ask about ffmpeg and progressbar

    I used exec function with ffmpeg and output the result to txt file

    and using some of code I found here to

    <center>



       &lt;?php

       define('RAPIDLEECH', 'yes');
       define('CONFIG_DIR', 'configs/');
       require_once('configs/config.php');
       define ( 'TEMPLATE_DIR', 'templates/'.$options['template_used'].'/' );
       // Include other useful functions
       require_once('classes/other.php');
       error_reporting(0);

       login_check();

       include(TEMPLATE_DIR.'header.php');

       echo ('<br /><br /><br /><b>AudioXtractor</b>, un complemento <br /> que te permite extraer el audio de tus videos.<br /><br /><br />');

       putenv('GDFONTPATH=' . realpath('.')); ?>

       <br />

       <form method="post"><center>
       <table>
         <td>Movie:
       <select>

       &lt;?php
       $exts=array(".ac3", ".avi", ".f4v", ".flv", ".mkv", ".mov", ".mp4", ".mpg", ".mpeg", ".rmvb", ".srt", ".swf", ".wav", ".wmv");
       $ext="";
       function vidlist($dir)
       {
       $results = array();
       $handler = opendir($dir);
       while ($file = readdir($handler))
       {
       if (strrchr($file,'.')!="")
       {
       $ext=strtolower(strrchr($file,'.'));
       }
       if ($file != '.' &amp;&amp; $file != '..' &amp;&amp; in_array($ext,$GLOBALS["exts"]))
       {
       $results[] = $file;
       }
       }
       closedir($handler);
       sort($results);
       return $results;
       }
       function Output($command) {
       $output = array($command);
       exec($command.' 2>&amp;1', $output);
       return ($output);
       }
       $files = vidlist("./files/");
       foreach($files as $file)
       {
           echo '<option value="'.$file.'">'.$file.'</option>';
       }

       ?>


       </select></td></table>

       <br /> >
       New MP3's name:
       <input type="text" value="nuevoaudio" />
       <br /> >
       <br />
       <br />

       <center><input type="submit" style="font-size:16px; font-weight:bold; cursor:pointer;" value="Extract" />
       

       </center></center></form>


       &lt;?php
       if ($_POST['video']!="")

           $video = 'files/';
           $video=array();    
           $video[0] = $_POST['video'];

       if ($_POST['nvdo']!="")

           $nvdo = 'files/';
           $nvdo=array();      
           $nvdo[0] = $_POST['nvdo'];



       foreach ($video as $vdo)
       foreach ($nvdo as $nvd)

       if (isset($_POST["analize"])) {

           exec("ffmpeg -i files/$vdo -ab 192k files/$nvd.mp3 -y 2> files/$nvd.txt");

           $ext=strtolower(strrchr($vdo,'.'));

       /////////////////////////////////////////////////////my code //////////////////////////////////////////

       $content = @file_get_contents("files/$nvd.txt");


           //get duration of source
           preg_match("/Duration: (.*?), start:/", $content, $matches);

           $rawDuration = $matches[1];

           //rawDuration is in 00:00:00.00 format. This converts it to seconds.
           $ar = array_reverse(explode(":", $rawDuration));
           $duration = floatval($ar[0]);
           if (!empty($ar[1])) $duration += intval($ar[1]) * 60;
           if (!empty($ar[2])) $duration += intval($ar[2]) * 60 * 60;

           //get the time in the file that is already encoded
           preg_match_all("/time=(.*?) bitrate/", $content, $matches);

           $rawTime = array_pop($matches);

           //this is needed if there is more than one match
           if (is_array($rawTime)){$rawTime = array_pop($rawTime);}

           //rawTime is in 00:00:00.00 format. This converts it to seconds.
           $ar = array_reverse(explode(":", $rawTime));
           $time = floatval($ar[0]);
           if (!empty($ar[1])) $time += intval($ar[1]) * 60;
           if (!empty($ar[2])) $time += intval($ar[2]) * 60 * 60;

           //calculate the progress
           $progress = round(($time/$duration) * 100);




           echo '<br /><br />¡Su video fue convertido correctamente! <br /><br />Link al archivo:';

           echo ' <a href="http://stackoverflow.com/feeds/tag/files/'.$nvd.'.mp3">'.$nvd.'.mp3</a><br />' . "<br />";
           echo "Duration: " . $duration . "<br />";
           echo "Current Time: " . $time . "<br />";
           echo "Progress: " . $progress . "%" . "<br />";

       //////////////////////////////////////my coed //////////////////////////////////////////////
       }

       ?>
       <br /><br /><a href="http://stackoverflow.com/feeds/tag/index.php">Volver al RapidLeech</a>

       <br /><br /><br />Formatos Aceptados: <br /><b>.ac3, .avi, .f4v, .flv, .mkv, .mov, .mp3,<br /> .mp4, .mpg, .mpeg, .rmvb, .srt, .swf, .wav, .wmv</b>
       <br /><br />
       </center>

       &lt;?php



       ?>

    so i ask some one he told me the exec stop php script and never give me

    You can't get the progress directly if you are using exec, because the php script is stopped until ffmpeg closes. (Because exec returns the whole execution output)

    You should use popen, for being able to get the output from the process in real time (without reading any file) for parse and show the progressbar

    Here is a example for get the output:

    When you get the progress info from ffmpeg, you can use your code for parse it and show your progressbar

    this is my popen script

    &lt;?php

    $handle = popen ("ffmpeg.exe -i files/fz.mp4 -ab 192k files/vdf.mp3 2>&amp;1 ", 'r');
    $handles = (string)$handle;
    $line = "";

    while (false !== ($char = fgetc($handle)))
    {
     if ($char == "\r")
     {
       // You could now parse the $line for status information.
       echo "$line\n";
       $line = "";
     } else {
       $line .= $char;
     }
     ob_flush();
     flush();
    }
    pclose ($handle);


       //get duration of source
       preg_match("/Duration: (.*?), start:/", $handles, $matches);

       $rawDuration = $matches[1];

       //rawDuration is in 00:00:00.00 format. This converts it to seconds.
       $ar = array_reverse(explode(":", $rawDuration));
       $duration = floatval($ar[0]);
       if (!empty($ar[1])) $duration += intval($ar[1]) * 60;
       if (!empty($ar[2])) $duration += intval($ar[2]) * 60 * 60;

       //get the time in the file that is already encoded
       preg_match_all("/time=(.*?) bitrate/", $handles, $matches);

       $rawTime = array_pop($matches);

       //this is needed if there is more than one match
       if (is_array($rawTime)){$rawTime = array_pop($rawTime);}

       //rawTime is in 00:00:00.00 format. This converts it to seconds.
       $ar = array_reverse(explode(":", $rawTime));
       $time = floatval($ar[0]);
       if (!empty($ar[1])) $time += intval($ar[1]) * 60;
       if (!empty($ar[2])) $time += intval($ar[2]) * 60 * 60;

       //calculate the progress
       $progress = round(($time/$duration) * 100);




       echo '<br /><br />¡Su video fue convertido correctamente! <br /><br />Link al archivo:';


       echo "Duration: " . $duration . "<br />";
       echo "Current Time: " . $time . "<br />";
       echo "Progress: " . $progress . "%" . "<br />";

    //////////////////////////////////////my coed //////////////////////////////////////////////

    ?>

    so i dont under stand what is good for ffmpeg progressbAR

    is exec or popen

    so please give me hints for ffmpeg real time progressbar

    what is good for progressbar

    is html5 progress bar

    or javascript progress bar

  • Can't play at a good framerate with JavaAV

    31 mars 2017, par TW2

    I have a problem in framerate when I use JavaAV (which use JavaCPP + ffmpeg). When I set my framerate as mentionned at DemuxerExample.java, the frame change each 47000ms which is too long and false. It’s better when I set 1000 / demuxer.getFrameRate() * 1000 ( 47ms) but it’s also false. I can’t have a good framerate. Here is my player class :

    package gr.av;

    import hoary.javaav.Audio;
    import hoary.javaav.AudioFrame;
    import hoary.javaav.Demuxer;
    import hoary.javaav.Image;
    import hoary.javaav.JavaAVException;
    import hoary.javaav.MediaFrame;
    import hoary.javaav.VideoFrame;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.image.BufferedImage;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.LineUnavailableException;
    import javax.sound.sampled.SourceDataLine;
    import javax.sound.sampled.UnsupportedAudioFileException;
    import javax.swing.JPanel;

    public class Player extends JPanel {

       VideoThread videoTHREAD;
       AudioThread audioTHREAD;
       BufferedImage img = null;

       public Player() {
           init();
       }

       private void init(){        
           videoTHREAD = new VideoThread(this);
           audioTHREAD = new AudioThread();
       }

       public void setImage(BufferedImage img){
           this.img = img;
           repaint();
       }

       @Override
       public void paint(Graphics g){
           if(img != null){
               g.drawImage(img, 0, 0, null);
           }else{
               g.setColor(Color.blue);
               g.fillRect(0, 0, getWidth(), getHeight());
           }
       }

       public void setFilename(String filename){
           videoTHREAD.setFilename(filename);
           audioTHREAD.setFilename(filename);
       }

       public void play(){
           videoTHREAD.playThread();
           audioTHREAD.playThread();
       }

       public void stop(){
           videoTHREAD.stopThread();
           audioTHREAD.stopThread();
       }

       public static class VideoThread extends Thread {

           //The video filename and a controller
           String filename = null;
           private volatile boolean active = false;

           //Panel to see video
           Player player;

           public VideoThread(Player player) {
               this.player = player;
           }

           public void setFilename(String filename){
               this.filename = filename;
           }

           public void playThread(){
               if(filename != null &amp;&amp; active == false){
                   active = true;
                   this.start();
               }
           }

           public void stopThread(){
               if(active == true){
                   active = false;
                   this.interrupt();
               }            
           }

           public void video() throws JavaAVException, InterruptedException, IOException, UnsupportedAudioFileException{            
               Demuxer demuxer = new Demuxer();
               demuxer.open(filename);

               MediaFrame mediaFrame;
               while (active &amp;&amp; (mediaFrame = demuxer.readFrame()) != null) {
                   if (mediaFrame.getType() == MediaFrame.Type.VIDEO) {

                       VideoFrame videoFrame = (VideoFrame) mediaFrame;

                       player.setImage(Image.createImage(videoFrame, BufferedImage.TYPE_3BYTE_BGR));

                       double FPS = demuxer.getFrameRate() * 1000d;
                       long ms = (long)(1000d / FPS);
                       System.out.println("FPS = " + FPS + " ; Milliseconds = " + ms);
                       java.util.concurrent.TimeUnit.MILLISECONDS.sleep(ms);
                   }
               }
               demuxer.close();
           }

           @Override
           public void run() {
               if(filename != null){
                   try {
                       video();
                   } catch (JavaAVException | InterruptedException | IOException | UnsupportedAudioFileException ex) {
                          Logger.getLogger(Player.class.getName()).log(Level.SEVERE, null, ex);
                   }
               }
           }

       }

       public static class AudioThread extends Thread {

           //The video filename and a controller
           String filename = null;
           private volatile boolean active = false;

           //Audio
           AudioFormat format = new AudioFormat(44000, 16, 2, true, false);
           AudioInputStream ais;
           DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
           SourceDataLine soundLine;

           public AudioThread() {            
           }

           public void setFilename(String filename){
               this.filename = filename;
           }

           public void playThread(){
               if(filename != null &amp;&amp; active == false){
                   active = true;
                   soundON();
                   this.start();
               }
           }

           public void stopThread(){
               if(active == true){
                   active = false;
                   soundOFF();
                   this.interrupt();
               }            
           }

           public void audio() throws JavaAVException, IOException {            
               Demuxer demuxer = new Demuxer();
               demuxer.open(filename);

               MediaFrame mediaFrame;
               while (active &amp;&amp; (mediaFrame = demuxer.readFrame()) != null) {
                   if (mediaFrame.getType() == MediaFrame.Type.AUDIO) {
                       AudioFrame audioFrame = (AudioFrame) mediaFrame;
                       byte[] bytes = Audio.getAudio16(audioFrame);

                       try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
                           ais = new AudioInputStream(bais, format, bytes.length / format.getFrameSize());
                           try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
                               int nBufferSize = bytes.length * format.getFrameSize();
                               byte[] abBuffer = new byte[nBufferSize];

                               while (true){
                                   int nBytesRead = ais.read(abBuffer);
                                   if (nBytesRead == -1)
                                       break;

                                   baos.write(abBuffer, 0, nBytesRead);
                               }

                               byte[] abAudioData = baos.toByteArray();
                               soundLine.write(abAudioData, 0, abAudioData.length);
                           }
                           ais.close();
                       }

                   }
               }

               demuxer.close();
           }

           @Override
           public void run() {
               if(filename != null){
                   try {
                       audio();
                   } catch (JavaAVException | IOException ex) {
                       Logger.getLogger(Player.class.getName()).log(Level.SEVERE, null, ex);
                   }
               }
           }

           private void soundON(){
               try {
                   soundLine = (SourceDataLine) AudioSystem.getLine(info);
                   soundLine.open(format);
                   soundLine.start();
               } catch (LineUnavailableException ex) {
                   Logger.getLogger(Player.class.getName()).log(Level.SEVERE, null, ex);
               }
           }

           private void soundOFF(){
               soundLine.drain();
               soundLine.stop();
               soundLine.close();
           }

       }

    }