my problems are as follows
1. how to start a external php script from a button then have that button gray out like disabled for some time ?
2. how to show a nice error msg when file is not in folder
this is the code i use to show, the video encoding progress, but when there is no file in folder example output.ogv it shows a big error how would user, sorry no video inside folder right now type of msg
Code: Select all
<?php
$filename = '../Processed/output.ogv';
echo $filename . ': ' . filesize($filename) . ' bytes';
?>
<?php
ok that is for the error, now I'm having issue about the mkvmerge usage I'm not sure why its not working i really believe nothing seems wrong in this script
Code: Select all
<?php
$dir = './files'; // set to current folder
if ($handle = opendir($dir)) {
while(false!== ($file = readdir($handle))) {
if ( is_file($dir.$file) ){
if (preg_match("'\.(avi)$'", $file) ){
$sub_file = str_ireplace(".avi", ".srt", $dir.$file);
$idx_file = str_ireplace(".avi", ".idx", $dir.$file);
$thumb_file = str_ireplace(".avi", ".jpg", $dir.$file);
$out_file = str_ireplace(".avi", ".mp4", $dir.$file);
flv_convert_get_thumb($dir.$file, $sub_file, $idx_file, $out_file);
}
else{
continue;
}
}
}
closedir($handle);
}
function flv_convert_get_thumb($in, $sub_file, $in_idx, $out_vid){
$cmd = 'D:\server\encoder\mkvmerge.exe -o ../Processed/'.$out_vid.' '.$sub_file.' ./files/'.$in.' ';
$res = shell_exec($cmd);
}
?>
Code: Select all
$cmd = 'D:\server\encoder\ffmpeg2theora-0.26.exe ../Processed/'.$in.' -o ../Processed/'.$out_vid.' --videoquality 4 --audioquality 5 --keyint 60 --framerate 26 --croptop 0 --cropbottom 0 --cropleft 0 --cropright 0 --width 720 --height 404 --title "provided by" --artist "mysoogals" --date "2010-4-14"';
$res = shell_exec($cmd);
next I change the static Theora script to dynamic input something like that i think
Code: Select all
<?php
flv_convert_get_thumb('../files/*.avi', '../Processed/output.jpg', '../Processed/output.ogv');
function flv_convert_get_thumb($in, $out_thumb, $out_vid)
{
$cmd = 'D:\server\encoder\ffmpeg.exe -v 0 -y -i ../Processed/'.$in.' -vframes 1 -ss 500 -vcodec mjpeg -f rawvideo -s 286x160 -aspect 16:9 ../Processed/'.$out_thumb;
$res = shell_exec($cmd);
$cmd = 'D:\server\encoder\ffmpeg2theora-0.26.exe ../Processed/'.$in.' -o ../Processed/'.$out_vid.' --videoquality 4 --audioquality 5 --keyint 60 --framerate 26 --croptop 0 --cropbottom 0 --cropleft 0 --cropright 0 --width 720 --height 404 --title "provided by" --artist "mysoogals" --date "2010-4-14"';
$res = shell_exec($cmd);
}
?>
there are only 4 php files with few lines of code,