Recherche avancée

Médias (0)

Mot : - Tags -/publication

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

Autres articles (67)

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

  • 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

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

Sur d’autres sites (9392)

  • ffmpeg Progress Bar - Encoding Percentage in PHP

    24 mars 2019, par Jimbo

    I’ve written a whole system in PHP and bash on the server to convert and stream videos in HTML5 on my VPS. The conversion is done by ffmpeg in the background and the contents is output to block.txt.

    Having looked at the following posts :

    Can ffmpeg show a progress bar ?

    and

    ffmpeg video encoding progress bar

    amongst others, I can’t find a working example.

    I need to grab the currently encoded progress as a percentage.

    The first post I linked above gives :

    $log = @file_get_contents('block.txt');

    preg_match("/Duration:([^,]+)/", $log, $matches);
    list($hours,$minutes,$seconds,$mili) = split(":",$matches[1]);
    $seconds = (($hours * 3600) + ($minutes * 60) + $seconds);
    $seconds = round($seconds);

    $page = join("",file("$txt"));
    $kw = explode("time=", $page);
    $last = array_pop($kw);
    $values = explode(' ', $last);
    $curTime = round($values[0]);
    $percent_extracted = round((($curTime * 100)/($seconds)));

    echo $percent_extracted;

    The $percent_extracted variable echoes zero, and as maths is not my strong point, I really don’t know how to progress here.

    Here’s one line from the ffmpeg output from block.txt (if it’s helpful)

    time=00:19:25.16 bitrate= 823.0kbits/s frame=27963 fps= 7 q=0.0 size=
    117085kB time=00:19:25.33 bitrate= 823.1kbits/s frame=27967 fps= 7
    q=0.0 size= 117085kB time=00:19:25.49 bitrate= 823.0kbits/s
    frame=27971 fps= 7 q=0.0 size= 117126kB

    Please help me output this percentage, once done I can create my own progress bar. Thanks.

  • Specify percentage instead of time to ffmpeg

    3 mai 2024, par user779159

    To get a thumbnail from an image halfway through the video I can do ffmpeg -ss 100 -i /tmp/video.mp4 -frames:v 1 -s 200x100 image.jpg. By using -ss 100 it gets a thumbnail at 100 seconds (which would be halfway through the video assuming the video is 200 seconds long).

    



    But if I don't know the exact length of the video, in my application code I would need to use something like ffprobe to first determine the length of the video, and then divide it by 2 to get the thumbnail time.

    



    Is there a way to get ffmpeg to get the thumbnail at the percentage of the video you want ? So instead of specifying -ss 100, something like -ss 50% or -ss 20% to get a thumbnail from halfway or 20% into the file ?

    



    I know I can do this through application code, but it would be more efficient if there's a way for ffmpeg to handle this itself.

    


  • How to read percentage from ffmpeg command in java ?

    23 juillet 2019, par Prasab R

    I am trying to convert video file to specific format by executing ffmpeg command. In that process I want to read percentage by using timepattern format. Somehow I am not able to do it.

    I have tried using the below code. Specially I am getting null in the while loop condition.

    import java.io.*;
    import java.util.Scanner;
    import java.util.regex.Pattern;

    class Test {
     public static void main(String[] args) throws IOException {
       ProcessBuilder pb = new ProcessBuilder("ffmpeg","-i","in.webm","out.mp4");
       final Process p = pb.start();

       new Thread() {
         public void run() {

           Scanner sc = new Scanner(p.getErrorStream());

           // Find duration
           Pattern durPattern = Pattern.compile("(?<=Duration: )[^,]*");
           String dur = sc.findWithinHorizon(durPattern, 0);
           if (dur == null)
             throw new RuntimeException("Could not parse duration.");
           String[] hms = dur.split(":");
           double totalSecs = Integer.parseInt(hms[0]) * 3600
                            + Integer.parseInt(hms[1]) *   60
                            + Double.parseDouble(hms[2]);
           System.out.println("Total duration: " + totalSecs + " seconds.");

           // Find time as long as possible.
           Pattern timePattern = Pattern.compile("(?<=time=)[\\d.]*");
           String match;
           while (null != (match = sc.findWithinHorizon(timePattern, 0))) {
             double progress = Double.parseDouble(match) / totalSecs;
             System.out.printf("Progress: %.2f%%%n", progress * 100);
           }
         }
       }.start();

     }
    }

    I am expecting a value in the while condition, but it coming as null.enter code here