Recherche avancée

Médias (91)

Autres articles (28)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Le plugin : Podcasts.

    14 juillet 2010, par

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

Sur d’autres sites (4270)

  • using FFMPEG to convert to MP4 with maximum browsers compatibilty

    6 mars 2016, par Karim

    I’m converting from WMV to FLV using FFMPEG, and my problem is that the FLV videos are so big ! the 15 minutes video’s size ranges between 150MB and 1GB !
    I’m using the following FFMPEG command to convert and split WMV videos :

    nohup nice -1 ffmpeg -y -ss 00:00:00 -t 00:15:00 -async 1 -i INPUT.WMV -acodec libmp3lame OUTPUT.FLV

    And I’ve tried converting to MP4 before and the video size was much smaller than the FLV video.

    So my questions are :

    • Would the MP4 videos have any
      compatibility issues browsers ?
    • Would it work on iPhone, iPad ? (I
      know FLV videos doesn’t work on
      iPhones or iPads)
    • What is the best FFMPEG command to
      convert to MP4 without losing the
      quality of the video ?
  • PHP FFmpeg video aspect ratio problem [SOLVED]

    29 août 2011, par Herr Kaleun

    i compiled the new version of FFMPEG and the padding commands have been deprecated.
    As i try to get familiar with the new -vf pad= commands, i want to ask, how can i
    convert a video without changing it's aspect ratio.

    I've checked numerous solutions from stackoverflow, nothing seemed to work.
    Can someone, please post a working PHP example or cmd line. I would be VERY happy.

    Please note that the videos in question, could be 4:3 and also be 16:9

    Let's say, i convert a 16:9 video to 640x480 format. It will need some bars at
    the top and at the bottom. That is what i want to do.

    Thanks

    EDIT :
    I solved the problem on my own. The FFmpeg documentation is a little bit weird so
    you have to experiment yourself a little bit.
    The padding formula is like :

       $pad_horizontal = $target_width     + $pad_left + $pad_right;
       $pad_vertical   = $target_height;
       // blah
       $command .= " -vf pad=$pad_horizontal:$pad_vertical:". $pad_left .":". $pad_top  .":black";

    Pay special attention at the $pad_vertical part since the paddings there are better
    not added so that the padding calculation of ffmpeg is not broken.

    Here is the full source code to the demo

    <?

       /***********************************************************************************
       get_dimensions()

       Takes in a set of video dimensions - original and target - and returns the optimal conversion
       dimensions.  It will always return the smaller of the original or target dimensions.
       For example: original dimensions of 320x240 and target dimensions of 640x480.
       The result will be 320x240 because converting to 640x480 would be a waste of disk
       space, processing, and bandwidth (assuming these videos are to be downloaded).

       @param $original_width:     The actual width of the original video file which is to be converted.
       @param $original_height:    The actual height of the original video file which is to be converted.
       @param $target_width:       The width of the video file which we will be converting to.
       @param $target_height:      The height of the video file which we will be converting to.
       @param $force_aspect:       Boolean value of whether or not to force conversion to the target's
                             aspect ratio using padding (so the video isn't stretched).  If false, the
                             conversion dimensions will retain the aspect ratio of the original.
                             Optional parameter.  Defaults to true.
       @return: An array containing the size and padding information to be used for conversion.
                   Format:
                   Array
                   (
                       [width] => int
                       [height] => int
                       [padtop] => int // top padding (if applicable)
                       [padbottom] => int // bottom padding (if applicable)
                       [padleft] => int // left padding (if applicable)
                       [padright] => int // right padding (if applicable)
                   )
       ***********************************************************************************/
       function get_dimensions($original_width,$original_height,$target_width,$target_height,$force_aspect)
       {
           if(!isset($force_aspect))
           {
               $force_aspect = true;
           }
           // Array to be returned by this function
           $target = array();
           $target['padleft'] = 0;
           $target['padright'] = 0;
           $target['padbottom'] = 0;
           $target['padtop'] = 0;



           // Target aspect ratio (width / height)
           $aspect = $target_width / $target_height;
           // Target reciprocal aspect ratio (height / width)
           $raspect = $target_height / $target_width;

           if($original_width/$original_height !== $aspect)
           {
               // Aspect ratio is different
               if($original_width/$original_height > $aspect)
               {
                   // Width is the greater of the two dimensions relative to the target dimensions
                   if($original_width < $target_width)
                   {
                       // Original video is smaller.  Scale down dimensions for conversion
                       $target_width = $original_width;
                       $target_height = round($raspect * $target_width);
                   }
                   // Calculate height from width
                   $original_height = round($original_height / $original_width * $target_width);
                   $original_width = $target_width;
                   if($force_aspect)
                   {
                       // Pad top and bottom
                       $dif = round(($target_height - $original_height) / 2);
                       $target['padtop'] = $dif;
                       $target['padbottom'] = $dif;
                   }
               }
               else
               {
                   // Height is the greater of the two dimensions relative to the target dimensions
                   if($original_height < $target_height)
                   {
                       // Original video is smaller.  Scale down dimensions for conversion
                       $target_height = $original_height;
                       $target_width = round($aspect * $target_height);
                   }
                   //Calculate width from height
                   $original_width = round($original_width / $original_height * $target_height);
                   $original_height = $target_height;
                   if($force_aspect)
                   {
                       // Pad left and right
                       $dif = round(($target_width - $original_width) / 2);
                       $target['padleft'] = $dif;
                       $target['padright'] = $dif;
                   }
               }
           }
           else
           {
               // The aspect ratio is the same
               if($original_width !== $target_width)
               {
                   if($original_width < $target_width)
                   {
                       // The original video is smaller.  Use its resolution for conversion
                       $target_width = $original_width;
                       $target_height = $original_height;
                   }
                   else
                   {
                       // The original video is larger,  Use the target dimensions for conversion
                       $original_width = $target_width;
                       $original_height = $target_height;
                   }
               }
           }
           if($force_aspect)
           {
               // Use the target_ vars because they contain dimensions relative to the target aspect ratio
               $target['width'] = $target_width;
               $target['height'] = $target_height;
           }
           else
           {
               // Use the original_ vars because they contain dimensions relative to the original's aspect ratio
               $target['width'] = $original_width;
               $target['height'] = $original_height;
           }
           return $target;
       }

       function get_vid_dim($file)
       {
           $command = '/usr/bin/ffmpeg -i ' . escapeshellarg($file) . ' 2>&1';
           $dimensions = array();
           exec($command,$output,$status);
           if (!preg_match(&#39;/Stream #(?:[0-9\.]+)(?:.*)\: Video: (?P<videocodec>.*) (?P<width>[0-9]*)x(?P<height>[0-9]*)/&#39;,implode("\n",$output),$matches))
           {
               preg_match(&#39;/Could not find codec parameters \(Video: (?P<videocodec>.*) (?P<width>[0-9]*)x(?P<height>[0-9]*)\)/&#39;,implode("\n",$output),$matches);
           }
           if(!empty($matches[&#39;width&#39;]) &amp;&amp; !empty($matches[&#39;height&#39;]))
           {
               $dimensions[&#39;width&#39;] = $matches[&#39;width&#39;];
               $dimensions[&#39;height&#39;] = $matches[&#39;height&#39;];
           }
           return $dimensions;
       }


       $command    = &#39;/usr/bin/ffmpeg -i &#39; . $src . &#39; -ab 96k -b 700k -ar 44100 -f flv -s &#39; . &#39;640x480 -acodec mp3 &#39;. $video_output_dir . $video_filename . &#39; 2>&amp;1&#39;;


       define( &#39;VIDEO_WIDTH&#39;,      &#39;640&#39; );
       define( &#39;VIDEO_HEIGHT&#39;,     &#39;480&#39; );

       $src_1              = getcwd() .&#39;/&#39;. &#39;test_video1.mpeg&#39;;
       $video_filename1    = &#39;video1.flv&#39;;

       $src_2              = getcwd() .&#39;/&#39;. &#39;test_video2.mp4&#39;;
       $video_filename2    = &#39;video2.flv&#39;;

       $src_3              = getcwd() .&#39;/&#39;. &#39;test_video3.mp4&#39;;
       $video_filename3    = &#39;video3.flv&#39;;

       convert_video( $src_1, $video_filename1 );
       convert_video( $src_2, $video_filename2 );
       convert_video( $src_3, $video_filename3 );

       function convert_video( $src = &#39;&#39;, $video_filename = &#39;&#39; )
       {

           $video_output_dir   = getcwd() .&#39;/&#39;;

           @unlink ( $video_output_dir . $video_filename );

           $original   = get_vid_dim($src);
           $target     = get_dimensions( $original[&#39;width&#39;], $original[&#39;height&#39;], VIDEO_WIDTH, VIDEO_HEIGHT, TRUE );

           echo &#39;<pre>&#39;;
           print_r( $original );
           echo &#39;</pre>&#39;;
           echo &#39;<pre>&#39;;
           print_r( $target );
           echo &#39;</pre>&#39;;



           $target_width   = $target[&#39;width&#39;];
           $target_height  = $target[&#39;height&#39;];

           $pad_left       = $target[&#39;padleft&#39;];
           $pad_right      = $target[&#39;padright&#39;];
           $pad_bottom     = $target[&#39;padbottom&#39;];
           $pad_top        = $target[&#39;padtop&#39;];

           $pad_horizontal = $target_width     + $pad_left + $pad_right;
           $pad_vertical   = $target_height; //    + $pad_top + $pad_bottom;


           $command = &#39;/usr/bin/ffmpeg -i &#39; . $src;

           // $command .= " -s {$target_width}x{$target_height} ";

           $command .= " -vf pad=$pad_horizontal:$pad_vertical:". $pad_left .":". $pad_top  .":black";

           $command .= &#39; -ab 96k -b 700k -ar 44100&#39;;
           $command .= &#39; -f flv &#39;;
           $command .= &#39; -qscale 4&#39;;

           $command .= &#39; -ss 30&#39;;
           $command .= &#39; -t 5&#39;;

           $command .= &#39; -ac 2 -ab 128k -qscale 5 &#39;;
           $command .= &#39; &#39; . $video_output_dir . $video_filename;


           exec( $command, $output, $status );

           echo &#39;<pre>&#39;;
           print_r( $command );
           echo &#39;</pre>&#39;;

           if ( $status == 0 )
           {
               echo &#39;<br />Convert OK. <br />&#39;;
           }
           else
           {
               echo &#39;<pre>&#39;;
               print_r( $output );
               echo &#39;</pre>&#39;;
           }

           echo &#39;<br />&#39;;
           echo &#39;<br />&#39;;

       }





    ?>
    </height></width></videocodec></height></width></videocodec>

    Thank you and have fun :)

  • FFmpeg fade effects between frames

    15 novembre 2016, par Rajat

    I want to create a slideshow of my images with fade in & fade out transitions between them and i am using FFmpeg fade filter.

    If I use command :

    ffmpeg -i input.mp4 "fade=in:5:8" output.mp4

    To create the output video with fade effect, then it gives output video with first 5 frames black and than images are shown with fade in effect but i want fade:in:out effect between frame change.

    How can i do that ?

    Please tell a solution for Centos server because i am using FFmpeg on this server only