Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (7)

  • 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" ;

  • 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

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

Sur d’autres sites (4336)

  • Lossless trim and crop of MJPEG video

    28 avril 2021, par prouast

    I am working on a project where I need to trim and crop MJPEG videos without any re-encoding. I have working code that accomplishes this by exporting the relevant frames as JPEGs, cropping them individually, and then joining them back together into an MJPEG.

    


    However, this seems quite inefficient and slow. I am looking for pointers how to improve this approach. For example, would it be possible to store the JPEGs in-memory ?

    


    import ffmpeg
import os
import shutil
import subprocess

def lossless_trim_and_crop(path, output_path, start, end, x, y, width, height, fps):
  # Trim the video in time and export all individual jpeg with ffmpeg + mjpeg2jpeg
  jpeg_folder = os.path.splitext(output_path)[0]
  jpeg_path = os.path.join(jpeg_folder, "frame_%03d.jpg")
  stream = ffmpeg.input(path, ss=start/fps, t=(end-start)/fps)
  stream = ffmpeg.output(stream, jpeg_path, vcodec='copy', **{'bsf:v': 'mjpeg2jpeg'})
  stream.run(quiet=True)
  # Crop all individual jpeg with jpegtran
  for filename in os.listdir(jpeg_folder):
    filepath = os.path.join(jpeg_folder, filename)
    out_filepath = os.path.splitext(filepath)[0] + "_c.jpg"
    subprocess.call(
      "jpegtran -perfect -crop {}x{}+{}+{} -outfile {} {}".format(
        width, height, x, y, out_filepath, filepath), shell=True)
    os.remove(filepath)
  # Join individual jpg back together
  cropped_jpeg_path = os.path.join(jpeg_folder, "frame_%03d_c.jpg")
  stream = ffmpeg.input(cropped_jpeg_path, framerate=fps)
  stream = ffmpeg.output(stream, output_path, vcodec='copy')
  stream.run(quiet=True)
  # Delete jpeg directory
  shutil.rmtree(jpeg_folder)


    


  • AE per frame rendering FFMPEG forming to video

    9 février 2018, par Deckard Cain

    I’m trying to setup an automated per frame rendering system using After Effects and FFMPEG. The idea here is that my slave nodes (running AE), will generate the frames and save them immediately to a Samba share (this way I can team multiple slaves together to tackle the same project file and we aren’t writing an 8GB AVI file, then compressing and deleting it when we could just render 300MB of frames and form it).

    The database and Samba share are running on FreeBSD. This machine will then take those frames and use FFMPEG to combine them into an MP4 video.

    The issue that I’m running into, is that when I render out the After Effects project file directly to an AVI file (one slave, no individual frame rendering), the video length is 1:31. When I render out the exact same project file into individual frames, then run it through FFMPEG to combine and compress them, the output is 1:49.

    I have tried a billion different things to make the length of the video the same, but can’t seem to make it so :/

    aerender.exe -mp -project %PROJECTFILE% -comp %COMPOSITION% -output [########].jpg

    ^Keep in mind, there may be 99999999 frames, or as little as 1 that needs to be rendered (if we need to re-render a specific section because of an asset change)

    ffmpeg -nostdin -i %FRAMELOCATION% -c:v libx264 -preset veryfast -an -y outputVideo.mp4

  • WebM file not seekable in Chrome when loaded through PHP (other browsers work)

    13 avril 2014, par Zoon

    I am having a mind-boggling problem, I just can't seem to resolve.

    Providing a WebM file through PHP is nothing new in my world, and I even know how to work with HTTP 206 Partial Content. But for some reason Chrome does not like it.

    A simple HTML5 video playback

    <video width="640" height="360" poster="picture/preview/V00000006.jpg" controls="controls" preload="preload">
       <source type="video/webm" src="/video/V00000006.webm">
    </source></video>

    where /video/V00000006.webm is rewritten to a PHP-file in Apache, will playback just fine.
    But in Chrome the seekbar is not effective. When clicking on the seekbar the player will freeze and no longer playback until page is refreshed. Firefox handles it just fine !

    If I change /video/V00000006.webm to be a direct link to the same video it works just fine. I even compared the network requests between the two versions (with and without PHP) and there is barely any difference in the first request, but the second is failing in the PHP-delivered video.

    Initial request and seek request for Apache-delivered video file :

        Request URL :http://mytestserver.net/movie1152x720.webm
        Request Method:GET
        Status Code:206 Partial Content
        Request Headers
        Accept :*/*
        Accept-Encoding:identity ;q=1, * ;q=0
        Accept-Language:da-DK,da ;q=0.8,en-US ;q=0.6,en ;q=0.4
        Cache-Control:no-cache
        Connection:keep-alive
        Cookie:PHPSESSID=i562540rek172mnv3nk528acj0 ; userPassword= ; userEmail=
        Host:mytestserver.net
        Pragma:no-cache
        Range:bytes=0-
        Referer :http://mytestserver.net/video.html
        User-Agent:Mozilla/5.0 (X11 ; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36
        Response Headers
        Accept-Ranges:bytes
        Connection:close
        Content-Length:4446451
        Content-Range:bytes 0-4446450/4446451
        Content-Type:video/webm
        Date:Fri, 11 Apr 2014 13:07:30 GMT
        ETag :"d2d0027-43d8f3-b91417c0"
        Last-Modified:Fri, 11 Apr 2014 12:46:31 GMT
        Server:Apache/2.2.3 (CentOS)
    

    Request URL :http://mytestserver.net/movie1152x720.webm
    Request Method:GET
    Status Code:206 Partial Content
    Request Headers
    Accept :*/*
    Accept-Encoding:identity ;q=1, * ;q=0
    Accept-Language:da-DK,da ;q=0.8,en-US ;q=0.6,en ;q=0.4
    Cache-Control:no-cache
    Connection:keep-alive
    Cookie:PHPSESSID=i562540rek172mnv3nk528acj0 ; userPassword= ; userEmail=
    Host:mytestserver.net
    Pragma:no-cache
    Range:bytes=4445881-
    Referer :http://mytestserver.net/video.html
    User-Agent:Mozilla/5.0 (X11 ; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36
    Response Headers
    Accept-Ranges:bytes
    Connection:close
    Content-Length:570
    Content-Range:bytes 4445881-4446450/4446451
    Content-Type:video/webm
    Date:Fri, 11 Apr 2014 13:09:02 GMT
    ETag :"d2d0027-43d8f3-b91417c0"
    Last-Modified:Fri, 11 Apr 2014 12:46:31 GMT
    Server:Apache/2.2.3 (CentOS)

    Initial request and seek request for PHP-streamed video :

        Request URL :http://mytestserver.net/video/V00000006.webm
        Request Method:GET
        Status Code:206 Partial Content
        Request Headers
        Accept :*/*
        Accept-Encoding:identity ;q=1, * ;q=0
        Accept-Language:da-DK,da ;q=0.8,en-US ;q=0.6,en ;q=0.4
        Cache-Control:no-cache
        Connection:keep-alive
        Cookie:PHPSESSID=i562540rek172mnv3nk528acj0 ; userPassword= ; userEmail=
        Host:mytestserver.net
        Pragma:no-cache
        Range:bytes=0-
        Referer :http://mytestserver.net/video.html
        User-Agent:Mozilla/5.0 (X11 ; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36
        Response Headers
        Accept-Ranges:bytes
        Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
        Connection:close
        Content-Length:8566268
        Content-Range:bytes 0-8566267/8566268
        Content-Type:video/webm
        Date:Fri, 11 Apr 2014 13:31:27 GMT
        Expires:Thu, 19 Nov 1981 08:52:00 GMT
        Pragma:no-cache
        Server:Apache/2.2.3 (CentOS)
        X-Powered-By:PHP/5.3.27
    

    Request URL :http://mytestserver.net/video/V00000006.webm
    Request Headers CAUTION : Provisional headers are shown.
    Accept-Encoding:identity ;q=1, * ;q=0
    Cache-Control:no-cache
    Pragma:no-cache
    Range:bytes=4338314-
    Referer :http://mytestserver.net/video.html
    User-Agent:Mozilla/5.0 (X11 ; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36

    Notice how the second request does not complete, Provisional headers are shown.

    I have tried altering the cache headers, setting it to the future, setting them blank and using file attachment headers.

    I tried fiddling around a lot with the serving code, but lately I have ended up with a simple example.

    &lt;?php

    $path = &#39;test.webm&#39;;

    $size=filesize($path);

    $fm=@fopen($path,&#39;rb&#39;);
    if(!$fm) {
     header ("HTTP/1.0 404 Not Found");
     die();
    }

    $begin=0;
    $end = $size-1;

    if(isset($_SERVER[&#39;HTTP_RANGE&#39;])) {
     if(preg_match(&#39;/bytes=\h*(\d+)-(\d*)[\D.*]?/i&#39;, $_SERVER[&#39;HTTP_RANGE&#39;], $matches)) {
       $begin=intval($matches[0]);
       if(!empty($matches[1])) {
         $end=intval($matches[1]);
       }
     }
    }

    if($begin>0||$end&lt;$size)
     header(&#39;HTTP/1.0 206 Partial Content&#39;);
    else
     header(&#39;HTTP/1.0 200 OK&#39;);

    header("Content-Type: video/webm");
    header(&#39;Accept-Ranges: bytes&#39;);
    header(&#39;Content-Length:&#39;.($end-$begin+1));
    header("Content-Disposition: inline;");
    header("Content-Range: bytes $begin-$end/$size");
    header("Content-Transfer-Encoding: binary\n");
    header(&#39;Connection: close&#39;);

    ob_get_clean();
    flush();

    $f = fopen($path, &#39;r&#39;);
    fseek($f, $offset);

    $pos = 0;
    $length = $end-$begin;

    while($pos &lt; $length)
    {
       $chunk = min($length-$pos, 1024);

       echo fread($f, $chunk);
       flush();

       $pos += $chunk;
    }
    ?>

    Please note, entering the PHP-delivered video URL directly into the browser does not make a difference from showing it in a HTML page.

    I hope someone has an answer to why seeking might not work. Let me know if you have any suggestions.

    Thanks !