Reputation: 4077
How can I convert FLV to WMV? Is there any script around there or some way I can integrate this?
Thank you!!!
Upvotes: 0
Views: 876
Reputation: 15070
I don't think you can do this directly with PHP.
But, you can use external tools called form PHP (ffmpeg
for example).
Here is a code sample:
<?php
$src = "file.flv";
$output = "file.wmv";
ffmpegPath = "/path/to/ffmpeg";
$flvtool2Path = "/path/to/flvtool2";
$ffmpegObj = new ffmpeg_movie($src);
$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
$srcFPS = $ffmpegObj->getFrameRate();
$srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
$srcAR = $ffmpegObj->getAudioSampleRate();
exec($ffmpegPath . " -i " . $src . " -ar " . $srcAR . " -ab " . $srcAB . " -vcodec wmv1 -acodec adpcm_ima_wav -s " . $srcWidth . "x" . $srcHeight . " " . $output. " | " . $flvtool2Path . " -U stdin " . $output);
// Make multiples function
function makeMultipleTwo ($value)
{
$sType = gettype($value/2);
if($sType == "integer")
{
return $value;
} else {
return ($value-1);
}
}
?>
Sources:
http://vexxhost.com/blog/2007/05/20/how-to-convertencode-files-to-flv-using-ffmpeg-php/ http://ubuntuforums.org/showpost.php?p=7315615&postcount=10
Upvotes: 2
Reputation: 145482
All solutions you will find are going to use ffmpeg
, because that's easy to install on servers and even easier to utilize from PHP scripts. Most always you can just do:
exec("ffmpeg -i video.flv video.wmv");
Upvotes: 2