Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (74)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • 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 ) (...)

Sur d’autres sites (15835)

  • convert a normal video to youtube short

    28 mai 2022, par Un1xCr3w

    hello i have videos with width of 1920px and height of 1080 and i wanna crop it at the center and create a youtube short with it

    


    iam using youtube dl wrap node js library
here is my code example

    


    var ffmpeg = require("fluent-ffmpeg");
const fs = require("fs");
let rawdata = fs.readFileSync("./json-files/small.json");
let clips = JSON.parse(rawdata);

function convertIt(fileName) {
  return new Promise((resolve, reject) => {
    ffmpeg(`./media-new/${fileName}`)
      .size("480x640")
      .aspect("9:16")
      .autopad()
      .videoBitrate("4000k")
      .on("end", function () {
        console.log("file has been converted succesfully");
        resolve("foo");
      })
      .on("error", function (err) {
        console.log("an error happened: " + err.message);
        reject(err);
      })
      // save to file
      .save(`./lib/${fileName}`);
  });
}

async function convertToShorts() {
  for (const iterator of clips) {
    await convertIt(`${iterator.id}.mp4`);
  }
}

convertToShorts();


    


  • Evolution #4391 : Squelettes de la dist : améliorer le markup et passer à BEM

    14 octobre 2019, par tcharlss (*´_ゝ`)

    j’utiliserais plutôt un modifier de "menu__item" : <li class="menu__item menu__item--plan"></li>

    Cf. remarque de RastaPopoulos (qui a posté pendant que j’écrivais ma réponse :p)
    Il y a encore beaucoup de guides officieux qui ne sont pas à jour sur ce point.
    Le guide officiel : https://en.bem.info/methodology/naming-convention/

    Pas de HTML5 pour l’instant.

    Pourquoi ?

    Je pensais qu’il y avait encore des points bloquants ou tout du moins genants, mais finalement ça ne semble pas être le cas.
    Donc go go go pour le HTML5, mieux pour la sémantique et l’accessibilité.

    Classes en english avec des exceptions en français

    Why ?

    Français ou anglais, ou mélange des 2, je n’ai pas d’avis vraiment tranché là dessus. Est-ce qu’il y a un consensus à ce sujet ? (dans ce cas, on continue comme ça et on en parle plus :p)
    Mon avis en 2 mots, c’est que c’est en général moins verbeux, et ça rend le code accessible aux non francophones.

    Je ne pense pas que la version cible est la 3.3, 3.4 ou plus à la limite

    Ok pour 3.4. Mais on ne sait jamais, ça pourrait être prêt avant :)
    Je te laisse modifier, j’ai pas le droit d’éditer le ticket.

    pensez-vous que BEM est un truc utilisé par les personnes qui bidouillent leur site à partir de la dist ?

    Bis, cf. remarque de RastaPopoulos qui poste plus vite que son ombre concernant les perfs.
    C’est juste un standard parmis d’autres (OOCSS, SMACSS...), mais il me semble que c’est un des plus simples et un des plus utilisés.

    Après, je ne pense pas que ça forcerait les gens qui bidouillent la dist à l’apprendre et à l’adopter.
    Ce ne sont que des noms de classe, même sans connaître BEM et comprendre comment ces noms sont construits, ça n’empêche pas de bidouiller les styles.

    Rangement

    Il y a un autre point que je n’avais pas abordé, c’est le rangement des squelettes.

    Je pense que les listes d’objets pourraient être mutualisées comme dans spipr, en ajoutant 2 dossiers et en y créant ces squelettes :

    • inclure/liste/
      • articles.html
      • rubriques.html
      • etc.
    • inclure/resume/
      • article.html
      • rubrique.html
      • etc.

    Après, je me demande si on ne pourrait pas aller plus loin, et reprendre le rangement de z-core pour les blocs principaux.
    Attention, je parle bien uniquement de rangement, pas de mettre z-core en dépendance.

    C’est à dire concrètement :

    • header/
      • dist.html
    • footer/
      • dist.html
    • content/
      • sommaire.html
      • article.html
      • rubrique.html
      • etc.
    • aside/
      • sommaire.html
      • article.html
      • rubrique.html
      • etc.

    Ce qui fait que le squelette des pages en serait simplifié, exemple pour sommaire.html :

    <span class="CodeRay"><span class="tag">span> <span class="attribute-name">class</span>=<span class="string"><span class="delimiter">"</span><span class="content">page</span><span class="delimiter">"</span></span><span class="tag">></span>

       <span class="tag">span> <span class="attribute-name">class</span>=<span class="string"><span class="delimiter">"</span><span class="content">header</span><span class="delimiter">"</span></span> <span class="attribute-name">id</span>=<span class="string"><span class="delimiter">"</span><span class="content">header</span><span class="delimiter">"</span></span> <span class="attribute-name">role</span>=<span class="string"><span class="delimiter">"</span><span class="content">banner</span><span class="delimiter">"</span></span><span class="tag">></span>
           <span class="tag">span><span class="error">{</span><span class="attribute-name">fond</span>=<span class="attribute-value">header</span><span class="error">/</span><span class="attribute-name">dist</span><span class="error">,</span> <span class="attribute-name">home</span>=<span class="attribute-value">oui</span><span class="error">}</span> <span class="tag">/></span>
       <span class="tag"></span>

       <span class="tag">span> <span class="attribute-name">class</span>=<span class="string"><span class="delimiter">"</span><span class="content">content</span><span class="delimiter">"</span></span> <span class="attribute-name">id</span>=<span class="string"><span class="delimiter">"</span><span class="content">content</span><span class="delimiter">"</span></span><span class="tag">></span>

           <span class="tag">span> <span class="attribute-name">class</span>=<span class="string"><span class="delimiter">"</span><span class="content">main</span><span class="delimiter">"</span></span> <span class="attribute-name">id</span>=<span class="string"><span class="delimiter">"</span><span class="content">main</span><span class="delimiter">"</span></span> <span class="attribute-name">role</span>=<span class="string"><span class="delimiter">"</span><span class="content">main</span><span class="delimiter">"</span></span><span class="tag">></span>
               <span class="tag">span><span class="error">{</span><span class="attribute-name">fond</span>=<span class="attribute-value">content</span><span class="error">/</span><span class="attribute-name">sommaire</span><span class="error">,</span> <span class="attribute-name">env</span><span class="error">}</span><span class="tag">></span>
           <span class="tag"></span>

           <span class="tag">span> <span class="attribute-name">class</span>=<span class="string"><span class="delimiter">"</span><span class="content">aside</span><span class="delimiter">"</span></span> <span class="attribute-name">id</span>=<span class="string"><span class="delimiter">"</span><span class="content">aside</span><span class="delimiter">"</span></span><span class="tag">></span>
               <span class="tag">span><span class="error">{</span><span class="attribute-name">fond</span>=<span class="attribute-value">aside</span><span class="error">/</span><span class="attribute-name">sommaire</span><span class="error">,</span> <span class="attribute-name">env</span><span class="error">}</span><span class="tag">></span>
           <span class="tag"></span>

       <span class="tag"></span>

       <span class="tag">span> <span class="attribute-name">class</span>=<span class="string"><span class="delimiter">"</span><span class="content">footer</span><span class="delimiter">"</span></span> <span class="attribute-name">id</span>=<span class="string"><span class="delimiter">"</span><span class="content">footer</span><span class="delimiter">"</span></span> <span class="attribute-name">role</span>=<span class="string"><span class="delimiter">"</span><span class="content">contentinfo</span><span class="delimiter">"</span></span><span class="tag">></span>
           <span class="tag">span><span class="error">{</span><span class="attribute-name">fond</span>=<span class="attribute-value">footer</span><span class="error">/</span><span class="attribute-name">dist</span><span class="error">,</span> <span class="attribute-name">self</span>=<span class="error">#</span><span class="attribute-value">SELF</span><span class="error">}</span> <span class="tag">/></span>
       <span class="tag"></span>

    <span class="tag"></span>
    </span></span></span></span></span></span></span></span></span></span></span>

    Bon, je sais pas, je réfléchis tout haut.
    Peut-être que ça pourrait apporter aussi un peu de confusion.

    Branche et dépôt GIT

    Concernant le dépôt, je n’ai pas les droits pour créer une branche sur https://git.spip.net/SPIP/dist , du coup je bosse dans un fork : https://git.spip.net/tcharlss/dist/src/branch/bem

    Pour celleux intéressées à contribuer, c’est quoi la meilleurs méthode ? Je vous ajoute comme collaborateurs sur ce dépôt ?
    Ou alors il faut faire une vraie branche 3.4 dans le dépôt de l’orga SPIP ?

  • 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