Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (22)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

  • 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

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

Sur d’autres sites (4803)

  • proc_open hangs when trying to read from a stream

    7 juillet 2015, par eithedog

    I’ve encountered the issue with proc_open on Windows, when trying to convert a wmv file (to flv), using ffmpeg, however I suspect I’ll encounter the same scenario whenever certain conditions occur.
    Basically my code is as follows :

    $descriptorspec = array
    (
       array("pipe", "r"),
       array("pipe", "w"),
       array("pipe", "w")
    );

    $pipes = array();
    $procedure = proc_open('cd "C:/Program Files/ffmpeg/bin" && "ffmpeg.exe" -i "C:/wamp/www/project/Wildlife.wmv" -deinterlace -qdiff 2 -ar 22050 "C:/wamp/www/project/Wildlife.flv"', $descriptorspec, $pipes);
    var_dump(stream_get_contents($pipes[1]));

    Now, this code will cause PHP to hang indefinitely (it doesn’t matter if instead of stream_get_contents I’ll use fgets or stream_select, the behavior is consistent).

    The reason for it (I suspect) is that, while STDOUT stream is open succesfully, the process doesn’t write anything to it (even though running the same command in cmd displays output) and as such, trying to read from such stream, would cause the same issue as described here, so - PHP waits for the stream to have anything in it, process doesn’t write anything to it.

    However (additional fun), setting stream_set_timeout or stream_set_blocking doesn’t have any effect.

    As such - can somebody confirm/deny on what is going on, and, if possible, show how can I cater for such situation ? I’ve looked at PHP bugs, and all proc_open hangs ones seem to be fixed.

    For time being I’ve implemented such solution :

    $timeout = 60;
    while (true) {
       sleep(1);

       $status = proc_get_status($procedure);
       if (!$status['running'] || $timeout == 0) break;

       $timeout--;
    }

    However, I’d really not like to rely on something like this as :

    1. I will have processes that run for longer than a minute - such processes will be falsely reported to be of the above mentioned type
    2. I want to know when the ffmpeg has finished converting the video - currently I’ll only know that process is still running after a minute, and I can’t really do anything to check if there’s any output (as it will hang PHP).

    Also, I don’t really want to wait a full minute for the process to be checked (for example - converting the given video from command line takes <10s), and I’ll have videos that take more time to be converted.


    Per comment from @Sjon, here’s stream_select I was using, which blocks due to same issue - STDOUT not being written to :

    $descriptorspec = array
    (
       array("pipe", "r"),
       array("pipe", "w"),
       array("pipe", "w")
    );

    $pipes = array();
    $procedure = proc_open('cd "C:/Program Files/ffmpeg/bin" &amp;&amp; "ffmpeg.exe" -i "C:/wamp/www/sandbox/Wildlife.wmv" -deinterlace -qdiff 2 -ar 22050 "C:/wamp/www/sandbox/Wildlife.flv"', $descriptorspec, $pipes);

    $read = array($pipes[0]);
    $write = array($pipes[1], $pipes[2]);
    $except = array();

    while(true)
    if(($num_changed_streams = stream_select($read, $write, $except, 10)) !== false)
    {
       foreach($write as $stream)
           var_dump(stream_get_contents($stream));

       exit;
    }
    else
       break;

    Per conversation with @Sjon - reading from buffered streams on Windows is broken. The solution in the end is to use stream redirection via shell, and then read the created files - as such

    $descriptorspec = array
    (
       array("pipe", "r"),
       array("pipe", "w"),
       array("pipe", "w")
    );

    $pipes = array();
    $procedure = proc_open('cd "C:/Program Files/ffmpeg/bin" &amp;&amp; "ffmpeg.exe" -i "C:/wamp/www/sandbox/Wildlife.mp4" -deinterlace -qdiff 2 -ar 22050 "C:/wamp/www/sandbox/Wildlife.flv" > C:/stdout.log 2> C:/stderr.log', $descriptorspec, $pipes);

    proc_close($procedure);

    $output = file_get_contents("C:/stdout.log");
    $error = file_get_contents("C:/stderr.log");

    unlink("C:/stdout.log");
    unlink("C:/stderr.log");

    As the stream is buffered, in the file we will get unbuffered output (something I was after as well). And we don’t need to check if the file changes, because the result from shell is unbuffered and synchronous.

  • Is the values in avcC box in .mp4 video files affected only by FFmpeg version ?

    5 novembre 2015, par a man

    I am studying on the source identification of video files especially about those from smartphones.

    I got to know that the values in avcC box in .mp4 video files have the encoding options(h.264) which decoder must know when processing the encoded stream.

    And I guess most of the smartphone uses the customized FFmpeg to encode the raw stream. I want to know if the values in the avcC box are affected only by the version of FFmpeg(if not customized version is used).

    I didn’t delve into this but think that the libavcodec.so in FFmpeg fill the values in avcC box when doing encoding(is this right ?).

    So what I want to ask is if two different smartphones use the same libavcodec.so(even in the case whether other .so files, .apk file used for the recording, etc are different) and two video files which have the same resolution were filmed from each smartphone, do the values in avcC box the same ?
    I think this question may equal to "are the values in avcC box affected by other FFmpeg library or other layers in overall Android framework" ?

    ++ there is one more question ! Is there any case that two videos which have same resolution from the same smartphone have different values in avcC box ? (I suggest the the difference of encoding option originating from low-battery mode, execution conditions of other apps, etc and if any core developer customize FFmpeg for that.)

    It would be a great help if anyone let me know the answer !

  • APPLY Strong to Buffer rule. Quit Switching Bit rates MPEG DASH

    14 juillet 2015, par Vinay

    I am using mpeg dash for adaptive bit rate streaming of video from my server.

    I have used ffmpeg and MP4Box to generate 4 different quality video files from my source .mp4

    The .mpd file generated has the below code

    &lt;?xml version="1.0"?>

    <mpd xmlns="urn:mpeg:dash:schema:mpd:2011" minbuffertime="PT1.500000S" type="static" mediapresentationduration="PT0H3M1.42S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
    <programinformation moreinformationurl="http://gpac.sourceforge.net">
     
    </programinformation>

    <period duration="PT0H3M1.42S">
     <adaptationset segmentalignment="true" maxwidth="1920" maxheight="1080" maxframerate="24" par="16:9" lang="und" subsegmentstartswithsap="1">
      <representation mimetype="video/mp4" codecs="avc1.64000d" width="320" height="240" framerate="24" sar="1:1" startwithsap="1" bandwidth="375715">
       <baseurl>400_dashinit.mp4</baseurl>
       <segmentbase indexrangeexact="true" indexrange="904-1403">
         <initialization range="0-903"></initialization>
       </segmentbase>
      </representation>
      <representation mimetype="video/mp4" codecs="avc1.640015" width="420" height="270" framerate="24" sar="1:1" startwithsap="1" bandwidth="644824">
       <baseurl>700_dashinit.mp4</baseurl>
       <segmentbase indexrangeexact="true" indexrange="905-1404">
         <initialization range="0-904"></initialization>
       </segmentbase>
      </representation>
      <representation mimetype="video/mp4" codecs="avc1.64001f" width="1024" height="576" framerate="24" sar="1:1" startwithsap="1" bandwidth="1349484">
       <baseurl>1500_dashinit.mp4</baseurl>
       <segmentbase indexrangeexact="true" indexrange="905-1404">
         <initialization range="0-904"></initialization>
       </segmentbase>
      </representation>
      <representation mimetype="video/mp4" codecs="avc1.64001f" width="1280" height="720" framerate="24" sar="1:1" startwithsap="1" bandwidth="2264379">
       <baseurl>2500_dashinit.mp4</baseurl>
       <segmentbase indexrangeexact="true" indexrange="905-1404">
         <initialization range="0-904"></initialization>
       </segmentbase>
      </representation>
      <representation mimetype="video/mp4" codecs="avc1.640028" width="1920" height="1080" framerate="24" sar="1:1" startwithsap="1" bandwidth="3633049">
       <baseurl>4000_dashinit.mp4</baseurl>
       <segmentbase indexrangeexact="true" indexrange="906-1405">
         <initialization range="0-905"></initialization>
       </segmentbase>
      </representation>
     </adaptationset>
    </period>
    </mpd>

    I am using video.js along with dash.js to playback the mpeg dash content on client side. The issue is that the video doesn’t playback perfectly when i simulate network conditions from chrome dev tools.

    It works at times and it doesn’t at others. For ex the stream starts with bit rate of 400kbps and then detects enough bandwidth available so it switches to 2500kbps. Then when i bring down my bandwidth to 400kbps again then the video freezes at some point of time.

    At times the video freezes after few initial seconds of playback when it tries to switch the stream. I think there might be some command line parameter that i am missing while generating my video files via ffmpeg or generating .mpd file via MP4Box.

    below are the commands i use for ffmpeg and MP4Box

    ffmpeg -y -i inputfile -c:a libfdk_aac -ac 2 -ab 128k -c:v libx264 -r 24 – g 24 -b:v 1500k -maxrate 1500k -bufsize 1000k -vf "scale=-1:720" outputfile.mp4


    MP4Box -dash [DURATION] -rap -frag-rap -profile [PROFILE] -out [path/to/outpout.file] [path/to/input1.file] [path/to/input2.file] [path/to/input3.file]

    Also while i am generating .mpd files via MP4Box i am getting below warning in console

    [DASH]: Files have non-proportional track layouts (320x240 vs 420x270) but sample size and aspect ratio match, assuming precision issue
    [DASH]: Files have non-proportional track layouts (320x240 vs 1024x576) but sample size and aspect ratio match, assuming precision issue
    [DASH]: Files have non-proportional track layouts (320x240 vs 1280x720) but sample size and aspect ratio match, assuming precision issue
    [DASH]: Files have non-proportional track layouts (320x240 vs 1920x1080) but sample size and aspect ratio match, assuming precision issue

    Whenever the video stops playing the chrome console has these logs

    Number of times the buffer has run dry: 25
    Apply STRONG to buffer rule.
    Quit switching bit rates.

    I don’t have any clue as to why the buffers run dry and it stops switching the bit rates.

    Anything that is predominantly wrong in the process ?