Recherche avancée

Médias (0)

Mot : - Tags -/clipboard

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (27)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Les statuts des instances de mutualisation

    13 mars 2010, par

    Pour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
    Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

Sur d’autres sites (7011)

  • ffmpeg not returning duration, cant play video until complete. Stream images 2 video via PHP

    17 février 2014, par John J

    I am real struggling with ffmpeg. I am trying to convert images to video, I have an ip camera which I am recording from. The recordings are mjpegs 1 frame per image.

    I am trying to create a script in php so I can recreate a video from date to date, this requires inputting the images via image2pipe and then creating the video.

    The trouble is, ffmpeg does return the duration and start stats, so I have no way of working out when the video is done or what percentage is done. The video won't play until its finished, and its not a very good UE.

    Any ideas of how I can resolve this, the video format can be anything I am open to suggestions.

    PHP :

    //Shell command
    exec('cat /image/dir/*.jpg | ffmpeg -y -c:v mjpeg -f image2pipe -r 10 -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart myvids/vidname.mp4 1>vidname.txt 2>&1')

    //This is loaded via javascript when the video is loaded (which is failing due to stats being wrong
    $video_play = "<video width="\&quot;320\&quot;" height="\&quot;240\&quot;" src="\&quot;myvids/vidname.mp4\&quot;" type="\&quot;video/mp4\&quot;\" controls="\&quot;controls\&quot;" preload="\&quot;none\&quot;"></video>";

    Javascript :

    //Javascript to create the loop until video is loaded
    <code class="echappe-js">&lt;script&gt;<br />
              $(document).ready(function() {<br />
                   var loader = $(&quot;#clip_load&quot;).percentageLoader();<br />
                   $.ajaxSetup({ cache: false }); // This part addresses an IE bug. without it, IE will only load the first number and will never refresh<br />
                   var interval = setInterval(updateProgress,1000);<br />
                   function updateProgress(){ $.get( &quot;&amp;#39;.base_url().&amp;#39;video/getVideoCompile_Process?l=&amp;#39;.$vid_name.&amp;#39;-output.txt&amp;amp;t=per&quot;, function( data ) { if(data=&gt;\&amp;#39;100\&amp;#39;){ $(&quot;#clip_load&quot;).html(\&amp;#39;&amp;#39;.$video_play.&amp;#39;\&amp;#39;); clearInterval(interval); }else{loader.setProgress(data); } });                    }<br />
               });<br />
               &lt;/script&gt;

    PHP (page is called via javascript :

    //This is the script which returns the current percentage
    $logloc = $this->input->get(&#39;l&#39;);
    $content = @file_get_contents($logloc);

    if($content){
       //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);
       if ($this->input->get(&#39;t&#39;)==&#39;per&#39;){
           echo $progress;
       }else{
               echo "Duration: " . $duration . "<br />";
               echo "Current Time: " . $time . "<br />";
       echo "Progress: " . $progress . "%";}
    }else{ echo "cannot locate";}

    Thanks

  • Using ffmpeg with Imagick

    19 mars 2014, par user3240613

    I am trying to generate thumbnails from videos in imagick, by extracting a single frame from them, using the ffmpeg application.

    I use this code currently :

    $image->newPseudoImage( null, null, &#39;ffmpeg:video.mp4[50]&#39;);

    It works. But it is not an ideal solution.
    I want to generate the thumbnail from a 50% position in the video, but i do not know how long the video is, so I can't do something like ffmpeg:video.mp4[500001]. And even if I knew the length, I still couldn't do it because running this ffmpeg:video.mp4[1000] takes almost 20 seconds to execute (ffmpeg:video.mp4[50] takes one or two seconds only).

    When i try to add some extra parameters like "ffmpeg:video.mp4[50] -ss 50" it returns error.

    The only other option I can think of, is using the exec to directly execute the ffmpeg command in the shell like "ffmpeg -i video.mp4 -vframes 1 -o screenshot.jpg" or something like that. Would that actually be more efficient solution than using the newpseudoimage method ?

  • x264 encoding with libav

    25 mars 2014, par user3453729

    I try to encode raw image data to x264 with libav :

    AVPacket vpkt = { 0 };
    av_init_packet(&amp;vpkt);

    int got;
    int ret = avcodec_encode_video2(vcodec, &amp;vpkt, frameyuv.get(), &amp;got);

    if (!ret &amp;&amp; got &amp;&amp; vpkt.size) {
       if (vpkt.pts != AV_NOPTS_VALUE) {
           vpkt.pts = av_rescale_q(vpkt.pts, vcodec->time_base, videost->time_base);
       }
       if (vpkt.dts != AV_NOPTS_VALUE) {
           vpkt.dts = av_rescale_q(vpkt.dts, vcodec->time_base, videost->time_base);
       }

       vpkt.stream_index = videost->index;

       if(vcodec->coded_frame->key_frame) {
           vpkt.flags |= AV_PKT_FLAG_KEY;
       }
       /* -> will return -22 if max_b_frames > 0 */
       ret = av_interleaved_write_frame(oc, &amp;vpkt);
    }

    Runs fine when vcodec->max_b_frames is set to 0, but on any other value av_interleaved_write_frame returns -22 (invalid argument).

    /* will fail */
    c->max_b_frames = 3;
    /* -> ok*/
    c->max_b_frames = 0;

    Why ? Am i missing something ?

    Codec options are

    AVDictionary *opts = NULL;
    av_dict_set(&amp;opts, "vprofile", "baseline", 0);

    /* ... */
    c->codec_type = AVMEDIA_TYPE_VIDEO;
    c->bit_rate = 500 * 1000;
    c->width = VideoWidth;
    c->height = VideoHeight;
    c->time_base.den = fps;
    c->time_base.num = 1;
    c->pix_fmt = AV_PIX_FMT_YUV420P;

    Container format is mp4.