Recherche avancée

Médias (91)

Autres articles (27)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

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

Sur d’autres sites (7461)

  • Playing H.264 video in an application through ffmpeg using DXVA2 acceleration

    28 avril 2012, par cloudraven

    I am trying to output H.264 video in a Windows application. I am moderately familiar with FFMPEG and I have been successful at getting it to play H.264 in a SDL window without a problem. Still, I would really benefit from using Hardware Acceleration (probably through DXVA2)

    I am reading raw H264 video, no container, no audio ... just raw video (and no B-frames, just I and P). Also, I know that all the systems that will use this applications have Nvidia GPUs supporting at least VP3.
    Given that set of assumptions I was hoping to cut some corners, make it simple instead of general, just have it working for my particular scenario.

    So far I know that I need to set the hardware acceleration in the codec context by filling the hwaccel member through a call to ff_find_hwaccel. My plan is to look at Media Player Classic Home Cinema which does a pretty good job at supporting DXVA2 using FFMPEG when decoding H.264. However, the code is quite large and I am not exactly sure where to look. I can find the place where ff_find_hwaccel is called in h264.c, but I was wondering where else should I be looking at.

    More specifically, I would like to know what is the minimum set of steps that I have to code to get DXVA2 through FFMPEG working ?

    EDIT : I am open to look at VLC or anything else if someone knows where I can find the "important" piece of code that does the trick. I just mentioned MPC-HC because I think it is the easiest to get to compile in Windows.

  • PHP - Read and write the same file hangs

    2 février 2016, par Adracat

    I’m trying to use FFMPEG to make some works with video on the server, and something I need to do is to get the progress of the process.

    I searched a little and I found this solution which tells to write the log into a file and then reading and parsing it.

    The problem

    What is driving me crazy is that I tell FFMPEG - with exec - (process A) to write the log into a file, but when I try to read it - with file_get_contents() - (process B) it does not show the contents until process A is finished (or interrupted the PHP script).

    So, when process A finishes or it says "PHP script timeout", then I can read the file as times as I want, refreshing the page (process B) and showing the contents at the time.

    What I’ve tried

    I’ve tried to use fopen() to create the file with w, w+ and a parameters, using - and without using - fclose(). I’ve tried to use also flock() just in case it gets faster to read to process B if it knows it’s already locked and does not have to wait, but then FFMPEG is not able to write into the file.

    I’ve searched for multithreading too, but I think there must be an easier and simpler way.

    I’ve used also CURL and HTTP context, as this link suggests, but no luck.

    I’ve tried, too, to use PHP-FFMPEG but it’s not supporting the last FFMPEG version, so I cannot use it.

    When I said before "(or interrupted the PHP script)" is because I tried to wait and, when PHP got a timeout, process B worked alright and the file was still updating.

    The code

    Process A (fileA.php)

    exec('ffmpeg -y -i input_file.mp4 output_file.avi 2> C:\Full\Path\To\File\log.txt 1>&2');

    Process B (fileB.php)

    $content = file_get_contents($file);

    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);

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

    }

    The process

    I just open fileA.php on a Chrome tab and, after a few seconds, I open fileB.php on another Chrome tab (and it stays as loading).

    What I need

    I need to be able to load the file and show the information I want to show while the file is being written (by exec and FFMPEG or other PHP scripts), so I can update the progress percentage with some AJAX calls.

    Extra information

    At this point, I’m using PHP 5.4 on a IIS 7.5 with Windows 7 Professional.

    Thank you everyone for your time, help and patience !

    Best regards.

  • FFMPEG (2.5.7 ) Progress Bar from PHP

    6 mars 2016, par kunal

    i want to have the Progress bar of FFmpeg encoding.This is the Code which i am using to get the percentage value of encoding Process.

    &lt;?php
    $content = @file_get_contents("with-logo/output.txt");
    //echo $content;
    if($content) {
       preg_match("/Duration: (.*?), start:/", $content, $matches);

       $rawDuration = $matches[1];

       $ar = array_reverse(explode(":", $rawDuration));
       $duration = floatval($ar[0]);
       //echo $duration;
       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 "Duration: " . $duration . "<br />";
       echo "Current Time: " . $time . "<br />";
       echo "Progress: " . $progress . "%";
    }
    ?>

    here is relevant log line form my FFMPEG Log files for Better Understanding.

    Stream mapping:
     Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
     Stream #0:1 -> #0:1 (pcm_s24le (native) -> aac (native))
    Press [q] to stop, [?] for help

    frame=   11 fps=0.0 q=0.0 size=       0kB time=00:00:00.41 bitrate=   0.9kbits/s    
    frame=   22 fps= 21 q=0.0 size=       0kB time=00:00:00.85 bitrate=   0.4kbits/s    
    frame=   33 fps= 21 q=0.0 size=       0kB time=00:00:01.30 bitrate=   0.3kbits/s    
    frame=   43 fps= 20 q=0.0 size=       0kB time=00:00:01.69 bitrate=   0.2kbits/s  

    and this code is not returning the Value for Duration and as a result of this i am getting PHP warning and code is not calculating the Current percentage.

    here is the PHP warning , which i am getting-

    PHP Warning:  Division by zero in /var/www/html/mm/progressbar.php

    i think we can also calculate the percentage from the timebut i have no idea, how can i make it work ?

    or any help to solve the Problem with Duration.

    thanks for the help !