Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Script ffmpeg  (Read 5633 times)

0 Members and 1 Guest are viewing this topic.

Spoter

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Script ffmpeg
« on: December 08, 2010, 08:06:54 pm »

As Video2flash-ffmpeg plugin does not work on my server, I have asked the services manager for my server, and he sends me a working script for conversion, anyone could help me to integrate it into CPG1.5.10? Thanks

Logged

Spoter

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Script ffmpeg
« Reply #1 on: December 08, 2010, 08:08:43 pm »

<?php
ini_set("display_errors",1);
// Set our source file
$srcFile = "/web/htdocs/www.domain.com/home/test.avi";
$destFile = "/web/htdocs/www.domain.com/home/test.flv";
$ffmpegPath = "/usr/local/bin/ffmpeg";
$flvtool2Path = "/usr/bin/flvtool2";
// Create our FFMPEG-PHP class
$ffmpegObj = new ffmpeg_movie($srcFile);
// Save our needed variables
$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
$srcFPS = $ffmpegObj->getFrameRate();
$srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
$srcAR = $ffmpegObj->getAudioSampleRate();
// Call our convert using exec()
$command = $ffmpegPath ." -i " . $srcFile ." -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . "- | " . $flvtool2Path . " -U stdin " . $destFile;
exec($command,$out);
chmod($destFile,0755);
echo "<br><br><b>Comando</b>$command<br>";
// Make multiples function
function makeMultipleTwo ($value)
{
$sType = gettype($value/2);
if($sType == "integer")
{
return $value;
} else {
return ($value-1);
}
}
?>
Logged

papukaija

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 333
Re: Script ffmpeg
« Reply #2 on: December 09, 2010, 09:11:24 pm »

add_file_data_success plugin hook should work for new files. You'll need to run the your script manually for existing files. Please don't forget to post a link to your gallery which seems to be this.
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 20 queries.