Recherche avancée

Médias (91)

Autres articles (75)

  • Encodage et transformation en formats lisibles sur Internet

    10 avril 2011

    MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
    Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
    Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...)

  • Monitoring de fermes de MediaSPIP (et de SPIP tant qu’à faire)

    31 mai 2013, par

    Lorsque l’on gère plusieurs (voir plusieurs dizaines) de MediaSPIP sur la même installation, il peut être très pratique d’obtenir d’un coup d’oeil certaines informations.
    Cet article a pour but de documenter les scripts de monitoring Munin développés avec l’aide d’Infini.
    Ces scripts sont installés automatiquement par le script d’installation automatique si une installation de munin est détectée.
    Description des scripts
    Trois scripts Munin ont été développés :
    1. mediaspip_medias
    Un script de (...)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

Sur d’autres sites (13183)

  • Bicubic interpolation results different from FFMPEG

    18 novembre 2019, par Pedro Pereira

    I just implemented bicubic interpolation for resizing images.
    I have a test image 6x6 pixels (grayscale), its columns are black and white (x3).
    I am comparing the results of my code with the results from the tool ffmpeg and they are not correct. I can not understand why, I think I may be calculating the neighbourhood of pixels wrong or maybe the distance of the resized pixel to the original ones.
    Can someone look into my code (I will simplify it for better reading) and tell me where the error is ?

       // Iterate through each line
       for(int lin = 0; lin < dstHeight; lin++){
           // Original coordinates
           float linInOriginal = (lin - 0.5) / scaleHeightRatio;

           // Calculate original pixels coordinates to interpolate
           int linTopFurther = clamp(floor(linInOriginal) - 1, 0, srcHeight - 1);
           int linTop = clamp(floor(linInOriginal), 0, srcHeight - 1);
           int linBottom = clamp(ceil(linInOriginal), 0, srcHeight - 1);
           int linBottomFurther = clamp(ceil(linInOriginal) + 1, 0, srcHeight - 1);

           // Calculate distance to the top left pixel
           float linDist = linInOriginal - floor(linInOriginal);

           // Iterate through each column
           for(int col = 0; col < dstWidth; col++){
               // Original coordinates
               float colInOriginal = (col - 0.5) / scaleWidthRatio;

               // Calculate original pixels coordinates to interpolate
               int colLeftFurther = clamp(floor(colInOriginal) - 1, 0, srcWidth - 1);
               int colLeft = clamp(floor(colInOriginal), 0, srcWidth - 1);
               int colRight = clamp(ceil(colInOriginal), 0, srcWidth - 1);
               int colRightFurther = clamp(ceil(colInOriginal) + 1, 0, srcWidth - 1);

               // Calculate distance to the top left pixel
               float colDist = colInOriginal - floor(colInOriginal);

               // Gets the original pixels values
               // 1st row
               uint8_t p00 = srcSlice[0][linTopFurther * srcWidth + colLeftFurther];
               // ...

               // 2nd row
               uint8_t p01 = srcSlice[0][linTop * srcWidth + colLeftFurther];
               // ...

               // 3rd row
               // ...

               // 4th row
               // ...

               // Bilinear interpolation operation
               // Y
               float value = cubicInterpolate(
                   cubicInterpolate(static_cast<float>(p00), static_cast<float>(p10), static_cast<float>(p20), static_cast<float>(p30), colDist),
                   cubicInterpolate(static_cast<float>(p01), static_cast<float>(p11), static_cast<float>(p21), static_cast<float>(p31), colDist),
                   cubicInterpolate(static_cast<float>(p02), static_cast<float>(p12), static_cast<float>(p22), static_cast<float>(p32), colDist),
                   cubicInterpolate(static_cast<float>(p03), static_cast<float>(p13), static_cast<float>(p23), static_cast<float>(p33), colDist),
                   linDist);

               dstSlice[0][lin * dstWidth + col] = double2uint8_t(clamp(value, 0.0f, 255.0f));
           }
       }
    </float></float></float></float></float></float></float></float></float></float></float></float></float></float></float></float>
  • Why does ffmpeg not work with some files ?

    18 février 2018, par Hollo1001

    I’m using FFmpeg and PHP to generate thumbnails from video and get their data. It seems to work ok, but some files just output no thumbnails and also no data(specs like time, height...). I have searched a lot online, but have not found anything like that. Have I missed something ? If you have an idea whats wrong, would be cool if you could help me and maybe others how might have such a problem.
    Here is my PHP code for the specs :

    function _get_video_attributes($video, $ffmpeg) {

       $command = $ffmpeg . ' -i ' . $video . ' -vstats 2>&amp;1';
       $output = shell_exec($command);

       $regex_sizes = "/Video: ([^,]*), ([^,]*), ([0-9]{1,4})x([0-9]{1,4}), ([^,]*), ([0-9]{1,4})/"; // or : $regex_sizes = "/Video: ([^\r\n]*), ([^,]*), ([0-9]{1,4})x([0-9]{1,4})/"; (code from @1owk3y)
       if (preg_match($regex_sizes, $output, $regs)) {
           $codec = $regs [1] ? $regs [1] : null;
           $width = $regs [3] ? $regs [3] : null;
           $height = $regs [4] ? $regs [4] : null;
           $fps = $regs [6] ? $regs [6] : null;
       }

       $regex_duration = "/Duration: ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}).([0-9]{1,2})/";
       if (preg_match($regex_duration, $output, $regs)) {
           $hours = $regs [1] ? $regs [1] : null;
           $mins = $regs [2] ? $regs [2] : null;
           $secs = $regs [3] ? $regs [3] : null;
           $ms = $regs [4] ? $regs [4] : null;
       }

       return array('codec' => $codec,
           'width' => $width,
           'height' => $height,
           'hours' => $hours,
           'mins' => $mins,
           'secs' => $secs,
           'ms' => $ms,
           'fps' => $fps,
       );
    }

    And the thumbs :

    if($duration &lt; 10){
           $interval = floor($duration / 2);
           $image = "thumb/".$filenopath."_thumb_".$num.".jpg";
           shell_exec($ffmpeg." -ss ".$interval." -i ".$upfile." -vf select='eq(pict_type,I)' -vframes 1 -vf scale=-1:240 ".$thumb."00".$i.".jpg");
           rename($image,"thumb/".$image);
    }else{
    for ($i = 1; $i &lt;= 6; $i++) {
           $interval = floor(($i - 0.5) * $duration / $i);
           $log  = $ffmpeg." -ss ".$interval." -i ".$upfile." -vf select='eq(pict_type,I)' -vframes 1 -vf scale=-1:240 ".$thumb."00".$i.".jpg".PHP_EOL;
           //file_put_contents('./log'.date("j.n.Y").'.txt', $log, FILE_APPEND);
           shell_exec($ffmpeg." -ss ".$interval." -i ".$upfile." -vf select='eq(pict_type,I)' -vframes 1 -vf scale=-1:240 ".$thumb."00".$i.".jpg");
    }
  • Using ffmpeg to build a streaming server to stream static media files (broadcast behaviour)

    15 février 2018, par MiDaa

    I’ve read some online articles and SO questions, most of them are about streaming MY video to SERVER like youtube or switch.

    This is about a project of interest, here are what it should do.

    • Work on a Linux server
    • Serve media(preferably multiple format like mp4 mkv) files to client through rtp protocol maybe ?
    • Server could set a specific time to start the streaming or end it
    • Server could pause and resume the streaming(?)
    • Multiple clients connect and play the stream at same time(sounds like a basic feature)

    After some research, I found that ffmpeg is a great open-source candidate for such a project but as a newbie in this area, I’m having a tough time understanding how this whole thing work.

    As this(ffmpeg doc) states, it looks like just a one liner command. But I don’t find anything fit my feature listed above.

    Can ffmpeg be used to achieve those ? If not appriciate any suggesstion on where I should be looking at.

    EDIT :

    • Target devices : iPad,iPhone, Android phones should be able to watch the stream using a web browser(assume a modern browser)