Recherche avancée

Médias (91)

Autres articles (93)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (5243)

  • what FFMPEG performance settings to use for processing videos for the web

    21 mai 2020, par eAbi

    I have a few questions regarding usage of ffmpeg for processing videos for the web. I'm a beginner so please bear with me (although I read some docs on the internet)

    



    Performance

    



      

    • First of all, given the fact that FFMPEG utilizes all cores at 100%, what is the actual parallelism efficiency ?
    • 


    



    Let's assume the following scenario. I have a video (fullHD, doesn't matter what encoders / compression format was used to obtain the video) and I want to resize (downscale) to various sizes (e.g. 240px, 480px and 720px height) using mp4 format (thus using libx264 with aac codecs).

    



    Using ffmpeg, I see that all of my laptop's cores (8) are used at 100% and I was wondering what scenarios can improve the overall performance of the whole processing task. So this leads us to basically 2 scenarios : Assuming the video mentioned above as input, for obtaining the 3 output videos (@ 240px, 480px and 720px height sizes), we :

    



      

    1. Process input video and obtain 1 output video at a time, and let all the cores work at the same time at 100% ;
    2. 


    3. Process the video to obtain all output videos in parallel, by bounding each output video to a single processor core which'll work at 100% ;
    4. 


    



    So the question is actually reduced to the parallelism efficiency of the ffmpeg program.

    



    This means that letting ffmpeg process the task procVideo - which takes 1 input video to produce 1 single output video (transcoding/downscaling and so on) - on N processor cores doesn't mean it finish the task N times faster than letting it run the same task bound to a single core. So if the efficiency is smaller than 100%, it's better to have N procVideo tasks in parallel, each bound to a single core, rather than doing the task sequentially for each output video.

    




    



    Codecs

    



    Other than the above performance problem, the usage of codecs bugs me. I am trying to obtain mp4 videos because of the wide implementation of the format in html5 browsers.

    



    So having a video as input in any format, I want to convert it to mp4. So I'm using libx264 codec with aac.

    



      

    • Use libx264, x264 or h264 for video encoding/decoding ?
    • 


    • Use libfdk_aac, libaacplus or aac for audio encoding/decoding to aac ?
    • 


    



    Also, I would like to know what are the licesing fees for each of the above codec, as the online resources on these are quite limited / hard to understand.

    



    If anyone could shed some light on those questions, I would really be grateful ! Thanks for your time !

    


  • Why does File upload for moving image and Audio to tmp PHP folder work on Windows but only image upload portion works on Mac using MAMP ?

    31 mai 2021, par Yazdan

    So according to my colleague who tested this on Windows says it works perfectly fine , but in my case when I use it on a Mac with MAMP for Moodle , the image files get uploaded to the correct destination folder without an issue whereas the audio files don't move from the tmp folder to the actual destination folder and to check if this was the case ... I just changed and gave a fixed path instead of $fileTmpLoc and the file made it to the correct destination. Sorry I know the first half of the code isn't the main issue but I still wanted to post the whole code so one could understand it easily, moreover I am just beginning to code so please "have a bit of patience with me" . Thanks in advance

    


    &#xA;// this file contains upload function &#xA;// checks if the file exists in server&#xA;include("../db/database.php");&#xA;require_once(dirname(__FILE__) . &#x27;/../../../config.php&#x27;);&#xA;global $IP;&#xA;&#xA;$ajaxdata = $_POST[&#x27;mediaUpload&#x27;];&#xA;&#xA;$FILENAME = $ajaxdata[1];&#xA;$IMAGE=$ajaxdata[0];&#xA;// an array to check which category the media belongs too&#xA;$animal= array("bird","cat","dog","horse","sheep","cow","elephant","bear","giraffe","zebra");&#xA;$allowedExts = array("mp3","wav");&#xA;$temp = explode(".", $_FILES["audio"]["name"]);&#xA;$extension = end($temp);&#xA;&#xA;&#xA;&#xA;$test = $_FILES["audio"]["type"]; &#xA;&#xA;&#xA;if (&#xA;   $_FILES["audio"]["type"] == "audio/wav"||&#xA;   $_FILES["audio"]["type"] == "audio/mp3"||&#xA;   $_FILES["audio"]["type"] == "audio/mpeg"&#xA;   &amp;&amp;&#xA;   in_array($extension, $allowedExts)&#xA;   )&#xA;   {&#xA;&#xA;       // if the name detected by object detection is present in the animal array&#xA;       // then initialize target path to animal database or to others&#xA;       if (in_array($FILENAME, $animal)) &#xA;       { &#xA;           $image_target_dir = "image_dir/";&#xA;           $audio_target_dir = "audio_dir/";&#xA;       } &#xA;       else&#xA;       { &#xA;           $image_target_dir = "other_image_dir/";&#xA;           $audio_target_dir = "other_audio_dir/";&#xA;       } &#xA;       // Get file path&#xA;       &#xA;       $img = $IMAGE;&#xA;       // decode base64 image&#xA;       $img = str_replace(&#x27;data:image/png;base64,&#x27;, &#x27;&#x27;, $img);&#xA;       $img = str_replace(&#x27; &#x27;, &#x27;&#x2B;&#x27;, $img);&#xA;       $image_data = base64_decode($img);&#xA;&#xA;       //$extension  = pathinfo( $_FILES["fileUpload"]["name"], PATHINFO_EXTENSION ); // jpg&#xA;       $image_extension = "png";&#xA;       $image_target_file =$image_target_dir . basename($FILENAME . "." . $image_extension);&#xA;       $image_file_upload = "http://localhost:8888/moodle310/blocks/testblock/classes/".$image_target_file;&#xA;       &#xA;       &#xA;       $audio_extension ="mp3";&#xA;       $audio_target_file= $audio_target_dir . basename($FILENAME. "." . $audio_extension) ;&#xA;       $audio_file_upload = "http://localhost:8888/moodle310/blocks/testblock/classes/".$audio_target_file;&#xA;&#xA;       // file size limit&#xA;       if(($_FILES["audio"]["size"])&lt;=51242880)&#xA;       {&#xA;&#xA;           $fileName = $_FILES["audio"]["name"]; // The file name&#xA;           $fileTmpLoc = $_FILES["audio"]["tmp_name"]; // File in the PHP tmp folder&#xA;           $fileType = $_FILES["audio"]["type"]; // The type of file it is&#xA;           $fileSize = $_FILES["audio"]["size"]; // File size in bytes&#xA;           $fileErrorMsg = $_FILES["audio"]["error"]; // 0 for false... and 1 for true&#xA;           &#xA;           if (in_array($FILENAME, $animal)) &#xA;           { &#xA;               $sql = "INSERT INTO mdl_media_animal (animal_image_path,animal_name,animal_audio_path) VALUES (&#x27;$image_file_upload&#x27;,&#x27;$FILENAME&#x27;,&#x27;$audio_file_upload&#x27;)";&#xA;           } else {&#xA;               $sql = "INSERT INTO mdl_media_others (others_image_path,others_name,others_audio_path) VALUES (&#x27;$image_file_upload&#x27;,&#x27;$FILENAME&#x27;,&#x27;$audio_file_upload&#x27;)";&#xA;           }&#xA;&#xA;           // if file exists&#xA;           if (file_exists($audio_target_file) || file_exists($image_target_file)) {&#xA;               echo "alert";&#xA;           } else {&#xA;               // write image file&#xA;               if (file_put_contents($image_target_file, $image_data) ) {&#xA;                   // ffmpeg to write audio file&#xA;                   $output = shell_exec("ffmpeg -i $fileTmpLoc -ab 160k -ac 2 -ar 44100 -vn $audio_target_file");&#xA;                   echo $output;&#xA;               &#xA;                   // $stmt = $conn->prepare($sql);&#xA;                   $db = mysqli_connect("localhost", "root", "root", "moodle310"); &#xA;                   // echo $sql;&#xA;                   if (!$db) {&#xA;                       echo "nodb";&#xA;                       die("Connection failed: " . mysqli_connect_error());&#xA;                   }&#xA;                   // echo"sucess";&#xA;                   if(mysqli_query($db, $sql)){&#xA;                   // if($stmt->execute()){&#xA;                       echo $fileTmpLoc;&#xA;                       echo "sucess";  &#xA;                       echo $output;&#xA;                   }&#xA;                   else {&#xA;                       // echo "Error: " . $sql . "<br />" . mysqli_error($conn);&#xA;                       echo "failed";&#xA;                   }&#xA;&#xA;               }else {&#xA;                   echo "failed";&#xA;               }&#xA;&#xA;               &#xA;           &#xA;           &#xA;           }&#xA;   &#xA;    // $test = "ffmpeg -i $outputfile -ab 160k -ac 2 -ar 44100 -vn bub.wav";&#xA;       } else&#xA;       {&#xA;         echo "File size exceeds 5 MB! Please try again!";&#xA;       }&#xA;}&#xA;else&#xA;{&#xA;   echo "PHP! Not a video! ";//.$extension." ".$_FILES["uploadimage"]["type"];&#xA;   }&#xA;&#xA;?>&#xA;

    &#xA;

    I am a student learning frontend but a project of mine requires a fair bit of backend. So forgive me if my question sounds silly.

    &#xA;

    What I meant by manually overriding it was creating another folder and a index.php file with echo "hello"; $output = shell_exec("ffmpeg -i Elephant.mp3 -ab 160k -ac 2 -ar 44100 -vn bub.mp3"); echo $output; so only yes in this case Elephant.mp3 was changed as the initial tmp path so in this case as suggested by Mr.CBroe the permissons shouldn't be an issue.

    &#xA;

    Okay I checked my Apache_error.logonly to find out ffmpeg is indeed the culprit ... I had installed ffmpeg globally so I am not sure if it is an access problem but here is a snippet of the log

    &#xA;

    I checked my php logs and found out that FFmpeg is the culprit.&#xA;Attached is a short log file

    &#xA;

    [Mon May 31 18:11:33 2021] [notice] caught SIGTERM, shutting down&#xA;[Mon May 31 18:11:40 2021] [notice] Digest: generating secret for digest authentication ...&#xA;[Mon May 31 18:11:40 2021] [notice] Digest: done&#xA;[Mon May 31 18:11:40 2021] [notice] Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/1.0.2o PHP/7.2.10 configured -- resuming normal operations&#xA;sh: ffmpeg: command not found&#xA;sh: ffmpeg: command not found&#xA;sh: ffmpeg: command not found&#xA;

    &#xA;

  • pulling file size, in mb, in batch, then use it as a conditionnal for further commands

    6 juillet 2021, par Youcef

    I'm new and very novice with batch and don't fully understand how conditionals and executions work within it. So please bear with me.&#xA;I'm starting up with these two lines

    &#xA;

    "%~dp0\ffmpeg.exe" -i "%~1" -threads 8 -ss 00:04:03.000 -to 00:04:17.000 -c:v libvpx -crf 4 -r 30 -b:v 2050K -vf scale=-1:520 -an -f webm -pass 1 -y NUL&#xA;"%~dp0\ffmpeg.exe" -i "%~1" -threads 8 -ss 00:04:03.000 -to 00:04:17.000 -c:v libvpx -crf 4 -r 30 -b:v 2050K -vf scale=-1:520 -an -pass 2 -y "%~n1.webm"&#xA;

    &#xA;

    most of it you don't need to worry about. I'm just using ffmpeg commands to produce a webm from a drag & dropped video file (the "% 1" at the start). It works ! I'm only missing the batch portion of this (conditionals/variables) to do what I want to do :

    &#xA;

    I'm trying to algorithmically pick the best bitrate (which is the -b:v 2050K) to get as close to 3mb as possible. (I known by using constant bitrate, there is a way to force a specific file size, it is lower quality though)

    &#xA;

    The simplest steps that I could think about to achieve this (and probably in no way the most optimized)
    &#xA;1- run the two lines once with a ridiculous bitrate like 6000k
    &#xA;2- get file size of the first webm (put it into a variable ?)
    &#xA;3- calculate new bitrate with simple rule of three (newbitrate = (oldbitrate x 2.99)/sizeoffirstwebm)
    &#xA;4- run the two lines once a gain with the newbitrate
    &#xA;5- get the file size of the second webm
    &#xA;6- calculate new bitrate with simple rule of three (newbitrate = (oldbitrate*2.99)/sizeofSECONDwebm)
    &#xA;7- produce final webm which should be close to my target file size&#xA;The reason i'm doing that twice is because bitrate and size are closely, but not perfectly, linearly correlated, so it helps me hone on my 3mb target more closely
    &#xA;Sure, it will take like 3 times the time to render anything, but I think it's worth it since I'm already doing that manually.

    &#xA;