Recherche avancée

Médias (91)

Autres articles (111)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

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

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

Sur d’autres sites (9503)

  • PHP : Convert file with FFMPEG and upload to S3 using shell_exec() and aws cli tools

    18 septembre 2017, par andreaem

    I need a script that handle the upload of a video file from dropzone.js, convert to m4v then generate 5 thumbnails using the name of file appending -(number) to each jpg file (eg : file-1.jpg, file-2.jpg, file-3.jpgetc) and finally upload to s3 using shell_script (or maybe if there is a better way to do this).

    Recap

    1. Upload file in a temp dir
    2. Convert file to .m4v
    3. Generate 5 thumbnails from video
    4. Upload the converted video to Amazon S3
    5. Delete local video file

    Here is my code, at the moment I don’t know where the file goes and nothing seems to be uploaded to Amazon S3 (doing the upload in command-line works, so the credentials are ok).

    Dropzone.js

    $("#dZUpload").dropzone({
        url: "/ajax/admin/admin.acceptVideo.php",
        maxFilesize: 200,
        renameFile: new Date,
        acceptedFiles: "video/*",
        addRemoveLinks: true,
        success: function (file, response) {
             var imgName = response;                              file.previewElement.classList.add("dz-success");
             console.log("Successfully uploaded :" + imgName);
             $('#form_video').val(file);
        },
        error: function (file, response) {file.previewElement.classList.add("dz-error");
        }
    }).autoDiscover = false;
       Dropzone.prototype.defaultOptions.dictRemoveFile = "Rimuovi file";
       Dropzone.on("addedfile", function(file) {
           var cancelLink = Dropzone.createElement('<a>Cancel upload</a>');
        file.previewElement.appendChild(cancelLink);
        cancelLink.addEventListener("click", function(e) {
        e.preventDefault();
        myDropzone.cancelUpload(file);
    });
    });

    PHP

    $target_dir = "/var/www/html/example.com/web/temp/";
    $target_file = $target_dir . basename($_FILES["file"]["name"]);
    $uploadOk = 1;
    $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
    // Check if image file is a actual image or fake image
    if(isset($_POST["submit"])) {
       $check = getimagesize($_FILES["file"]["tmp_name"]);
       if($check !== false) {
           echo "File is a video - " . $check["mime"] . ".";
           $uploadOk = 1;
       } else {
           echo "File is not an image.";
           $uploadOk = 0;
       }
    }
    // Check if file already exists
    if (file_exists($target_file)) {
       echo "Sorry, file already exists.";
       $uploadOk = 0;
    }
    // Check file size
    if ($_FILES["fileToUpload"]["size"] > 200000000) {
       echo "Sorry, your file is too large.";
       $uploadOk = 0;
    }
    // Allow certain file formats
    if($imageFileType != "mp4" &amp;&amp; $imageFileType != "mov" &amp;&amp; $imageFileType != "avi" &amp;&amp; $imageFileType != "m4v" ) {
       echo "Sorry, only MP4 MOV AVI M4V files are allowed.";
       $uploadOk = 0;
    }
    // Check if $uploadOk is set to 0 by an error
    if ($uploadOk == 0) {
       echo "Sorry, your file was not uploaded.";
    // if everything is ok, try to upload file
    } else {
       if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
           S3Up(VideoConvert(basename( $_FILES["file"]["name"]),random_int('1','9999')));
           echo "The file ". basename( $_FILES["file"]["name"]). " has been uploaded.";
       } else {
           echo "Sorry, there was an error uploading your file.";
       }
    }

    function VideoConvert($video, $id) {
       shell_exec('ffmpeg -i ' . $video . ' /var/www/html/example.com/web/temp/' . $id . '.m4v');
       for ($i=0;$i &lt;= 5;$i++) {
           shell_exec('ffmpeg -i ' . $video .' -vf "select=gte(n\,' . $i .'00)" -vframes 1 ' .$id . '-' . $i. '.jpg');
       }

       return '/var/www/html/example.com/web/temp/' . $id . '.m4v';
    }

    function S3Up($video) {
       shell_exec('aws s3 cp ' . $video .' s3://example-video/ --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers');
       sleep(1);
       //shell_exec('rm '. $video);
    }

    Here is my error.log line relating to s3 upload :

    error.log

    example.mp4: No such file or directory
    Traceback (most recent call last):
     File "/usr/local/bin/aws", line 19, in <module>
       import awscli.clidriver
     File "/usr/local/lib/python2.7/dist-packages/awscli/clidriver.py", line 17, in <module>
       import botocore.session
     File "/usr/local/lib/python2.7/dist-packages/botocore/session.py", line 26, in <module>
       import botocore.credentials
     File "/usr/local/lib/python2.7/dist-packages/botocore/credentials.py", line 22, in <module>
       from dateutil.parser import parse
    ImportError: No module named dateutil.parser
    </module></module></module></module>

    How can I improve this ? I’ve tried using aws php api but got some problems with credentials, cli tools don’t have.

    Behavior

    At the moment dropzone.js stop uploading at 50% if I put a file of 8 MB, php maxUploadSize directive is set to 201M, php upload temp folder is inside the site root directory and permissions set to 7777. File where uploaded if I put a smallest file of 200Kb but don’t convert and make a 0 byte file.

  • checkasm : updated tests for sw_scale

    13 août 2022, par Swinney, Jonathan
    checkasm : updated tests for sw_scale
    

    Change the reference to exactly match the C reference in swscale,
    instead of exactly matching the x86 SIMD implementations (which
    differs slightly). Test with and without SWS_ACCURATE_RND - if this
    flag isn't set, the output must match the C reference exactly,
    otherwise it is allowed to be off by 2.

    Mark a couple x86 functions as unavailable when SWS_ACCURATE_RND
    is set - apparently this discrepancy hasn't been noticed in other
    exact tests before.

    Add a test for yuv2plane1.

    Signed-off-by : Jonathan Swinney <jswinney@amazon.com>
    Signed-off-by : Martin Storsjö <martin@martin.st>

    • [DH] libswscale/x86/swscale.c
    • [DH] tests/checkasm/sw_scale.c
  • lavc/flacdsp : optimise RVV vector type for lpc16

    14 mai 2024, par Rémi Denis-Courmont
    lavc/flacdsp : optimise RVV vector type for lpc16
    

    This calculates the optimal vector type value at run-time based on the
    hardware vector length and the FLAC LPC prediction order. In this
    particular case, the additional computation is easily amortised over
    the loop iterations :

    T-Head C908 :
    C V before V after
    1 48.0 214.7 95.2
    2 64.7 214.2 94.7
    3 79.7 213.5 94.5
    4 96.2 196.5 94.2 #
    5 111.0 195.7 118.5
    6 127.0 211.2 102.0
    7 143.7 194.2 101.5
    8 175.7 193.2 101.2 #
    9 176.2 224.2 126.0
    10 191.5 192.0 125.5
    11 224.5 191.2 124.7
    12 223.0 190.2 124.2
    13 239.2 189.5 123.7
    14 253.7 188.7 139.5
    15 286.2 188.0 122.7
    16 284.0 187.0 122.5 #
    17 300.2 186.5 186.5
    18 314.0 185.5 185.7
    19 329.7 184.7 185.0
    20 343.0 184.2 184.2
    21 358.7 199.2 183.7
    22 371.7 182.7 182.7
    23 387.5 181.7 182.0
    24 400.7 181.0 181.2
    25 431.5 180.2 196.5
    26 443.7 195.5 196.0
    27 459.0 178.7 196.2
    28 470.7 177.7 194.2
    29 470.0 177.0 193.5
    30 481.2 176.2 176.5
    31 496.2 175.5 175.7
    32 507.2 174.7 191.0 #

    # Power of two boundary.

    With 128-bit vectors, improvements are expected for the first two
    test cases only. For the other two, there is overhead but below noise.
    Improvements should be better observable with prediction order of 8
    and less, or on hardware with larger vector sizes.

    • [DH] libavcodec/riscv/flacdsp_init.c
    • [DH] libavcodec/riscv/flacdsp_rvv.S