
Recherche avancée
Médias (91)
-
Collections - Formulaire de création rapide
19 février 2013, par
Mis à jour : Février 2013
Langue : français
Type : Image
-
Les Miserables
4 juin 2012, par
Mis à jour : Février 2013
Langue : English
Type : Texte
-
Ne pas afficher certaines informations : page d’accueil
23 novembre 2011, par
Mis à jour : Novembre 2011
Langue : français
Type : Image
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
-
Richard Stallman et la révolution du logiciel libre - Une biographie autorisée (version epub)
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (81)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette 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. -
Librairies et binaires spécifiques au traitement vidéo et sonore
31 janvier 2010, parLes logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
Binaires complémentaires et facultatifs flvtool2 : (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs
Sur d’autres sites (8566)
-
writeImages and renaming the images using PHP
3 mai 2015, par Kiran Kumar DashI am working on a multimedia project. So, I am having a case where I am producing a sequence of images from a string input using he code below :
<?php
/*** a new Imagick object ***/
$aniGif = new Imagick();
/*** set the image format to gif ***/
$aniGif->setFormat( "gif" );
/*** a new ImagickPixel object for the colors ***/
$color = new ImagickPixel( "white" );
/*** set color to white ***/
$color->setColor( "white" );
$colorarray =array("white", "red", "blue" , "aqua", "fuchsia", "gray", "lime", "maroon", "navy", "orange", "purple", "silver", "teal", "yellow", "green", "maroon", "green", "olive");
/*** the text for the image ***/
$string = "Hello Kiran Kumar";
/*** a new draw object ***/
$draw = new ImagickDraw();
/*** set the draw font to helvetica ***/
$draw->setFont( "./SociaLAnimaL.ttf" );
/*** set the draw font to helvetica ***/
$draw->setFontSize( "100" );
/*** loop over the text ***/
for ( $i = 0; $i <= strlen( $string ); $i++ )
{
/*** grab a character ***/
$part = substr( $string, 0, $i );
/*** a new ImagickPixel object for the colors ***/
$color = new ImagickPixel( "white" );
/*Generate random number for random color*/
$randomNumber = rand(0,16);
/*** create a new gif frame ***/
$aniGif->newImage( 1920, 1200, $colorarray[$randomNumber] );
/*** add the character to the image ***/
$aniGif->annotateImage( $draw, 960, 600, 0, $part );
/*** set the frame delay to 30 ***/
$aniGif->setImageDelay( 30 );
}
/*** write the file ***/
$aniGif->writeImages($directory.'kiran.jpg', $out);
echo 'all done';
?>Now the problem is the writeimages object is generating images as kiran-0.jpg, kiran-1.jpg, kiran-2.jpg and so on. but what I am expecting is kiran001.jpg, kiran002.jpg, kiran003.jpg...and so on so that I can create a video out of it in while maintaining the sequence.Here is the code for video creation :
<?php
$ffmpeg= "/home/kiran/bin/ffmpeg";
echo exec("$ffmpeg -f image2 -framerate 2/1 -pattern_type glob -i \"/var/www/html/fftest/getthumbnail/tmp/animate/est/*.jpg\" -i \"/var/www/html/fftest/getthumbnail/audios/audio1.mp3\" -c:v libx264 -c:a copy -shortest -s 1920x1080 -r 60 -vf \"format=yuv420p\" \"/var/www/html/fftest/getthumbnail/output/animatedaudiocolor21.avi\" 2>&1" , $output, $return);
?>As you can see I am using -pattern type glob to select all the images, but this is getting confused with he naming sequence of kiran-0, kiran-1.
So, what I am expecting here is how can I use writeimage object o name my images as the way mentioned above. so that I can use kiran%03d.jpg in my ffmpeg command instead of *.jpg.
Or if any one can help me providing a code so that I can rename all the images in the expected manner.I tried the below code to rename all images :
<?php
$fileFolder="/fftest/getthumbnail/tmp/animate/test";
$directory = $_SERVER['DOCUMENT_ROOT'].$fileFolder.'/';
$i = 001;
$handler = opendir($directory);
while ($file = readdir($handler)) {
if ($file != "." && $file != "..") {
$newName = 'kiran'.$i ;
rename($directory.$file, $directory.$newName); // here; prepended a $directory
$i++;
}
}
closedir($handler);
?>But the code is unable to rename the images in sequence.
Help please...
-
PHP Foreach query only displays final result for slideshow ?
22 janvier 2023, par ShaneRibzUsing a query I pull the most liked video's on a localhosted stream webpage, and use FFMPEG to create a thumbnail if one isnt already existing and the video length.


The query succesfully pulls the 4 most liked video's and displays them in a carousel. FFMPEG succesfully creates each thumbnail, and gets the length of each video.


Somewhere, for whatever reason I cant figure out, only the final slide in the carousel displays the thumbnail as its background.


Sorry if my code is messy, I'm learning how to better optimize.


<?php
 $sql = "use info";
 $pdo->exec($sql);
 $stmt = $pdo->query("SELECT * FROM `files` ORDER BY `like` DESC LIMIT 4");
 $filelist = $stmt->fetchAll(PDO::FETCH_ASSOC);
 $h = 0;
 foreach ($filelist as $row) {
 if ($h < 25){
 $h++;
 
 $name = $row['name'];
 $location = $row['location'];
 $type = $row['type'];
 $uploadby = $row['uploadby'];
 $like = $row['like'];
 $id = $row['fileid'];
 $cat1 = $row['Cat1'];
 $cat2 = $row['Cat2'];
 
 $ffmpeg = 'F:\\xampp\ffmpeg.exe'; 
 $location = str_replace("/","\\", $location);
 $video = 'F:\xampp\htdocs\\'. $location; 
 $bigloc = "F:\\xampp\htdocs\\thumb\big";
 $smallloc = "F:\\xampp\htdocs\\thumb\small";
 $image = $bigloc . "\\" . $name . ".jpg"; 
 $image2 = $smallloc . "\\" . $name. ".jpg"; 
 
 if (file_exists($image) and (file_exists($image2))) {
 
 } else {
 echo $image . " does not exist";
 $cmd="$ffmpeg -ss 00:25:00 -i ". "\"" . $video . "\"". " -s 1920x540 -vframes 1 ". "\"" .$image. "\"" . " -report"; 
 $cmd2="$ffmpeg -ss 00:25:00 -i ". "\"" . $video . "\""." -s 270x370 -vframes 1 ". "\"" .$image2. "\"";
 echo "<br />". $cmd . "<br />".$cmd2."<br />";
 exec($cmd);
 exec($cmd2);
 }
 
 $file = "\"". $video. "\"";
 $result = shell_exec('ffmpeg -i ' . escapeshellcmd($file) . ' 2>&1');
 preg_match('/(?<=Duration: )(\d{2}:\d{2}:\d{2})\.\d{2}/', $result, $match);
 $time = $match[1];
 $image = "thumb/big/" . $name . ".jpg"; 
 $image2 = "thumb/small/" . $name. ".jpg";

 ?>

 <div class="single-hero-slider-wrap single-animation-wrap slider-height-hm4 bg-image-hm4 slider-bg-color-black d-flex align-items-center slider-bg-position-1 bg-black" style="&lt;?php echo &#x27;background-image:url(&#x27;. $image.&#x27;);&#x27;;?>">
 <div class="slider-content-hm4 slider-animated">
 <h1 class="title animated"><?php echo $name;?></h1>
 <div class="sub-title-time-wrap">
 <span class="sub-title animated"><?php if ($cat2 != ""){ echo $cat1 .", ". $cat2; }else{ echo $cat1;}?></span>
 <span class="time animated"><?php echo $time;?></span>
 </div>
 <div class="slider-button">
 <a href="http://stackoverflow.com/feeds/tag/movie-details.html" class="btn-style-hm4 animated">Watch Now</a>
 </div>
 </div>
 </div>

 <?php 
 }
 } 
 ?>



When inspecting the source code on my web browser ;
"
style="<?php echo 'background-image:url('. $image.');';?>"
", this will only appear on the final slide. The first 3 slides wont have "background-image" at all.

I feel as though I'm making a silly mistake and just cant see it.


EDIT
I should note, the "$name" and "$time" for each displays properly, its just the background-image that does not.


EDIT 2
Here is the source code :


<div class="single-hero-slider-wrap single-animation-wrap slider-height-hm4 bg-image-hm4 slider-bg-color-black d-flex align-items-center slider-bg-position-1 bg-black" style="background-image: url(&#x27;thumb/big/Alita Battle Angel.png&#x27;);">
</div>


The "background-image" shows in source, but during inspect element it does not. No errors populate either.


-
How to create a random video from a random picture annd random audio file
20 août 2019, par Francesco MiliziaI am working on a batch conversion process where I need to add a random picture (a
.jpg
) on a random.mp3
and make an.mp4
.This is the code I am using in terminal Mac OS X putting all the
.mp3
and the.jpg
in the same folder :for f in *.mp3; do /usr/local/Cellar/ffmpeg/4.1_1/bin/ffmpeg -r 1 -loop 1 -i abc5.jpg -i "$f" -c:a copy -c:v libx264 -vf scale=1280:720 -shortest "${f%mp3}mp4"; done
It works great, but I don’t know how to add another random feature for the
.jpg
files, so every time I have to put a different.jpg
and change the name (usually in the file not in the script). I also know this must be something with for ((..., but I don’t know how to add it properly.for f in *.mp3; do /usr/local/Cellar/ffmpeg/4.1_1/bin/ffmpeg -r 1 -loop 1 -i abc5.jpg -i "$f" -c:a copy -c:v libx264 -vf scale=1280:720 -shortest "${f%mp3}mp4"; done