help with php, I'm confused here
Posted: Sun Apr 18, 2010 2:35 am
hi Neo, can you help me with my latest project to kill you-tube
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
the error, i think i need to add some type of error checking ? but how would i do that, i mean right now the file encoding is done with a static input.avi here i'm feeling confused do i need to change the encoding script into dynamic input ?

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
ok for the last part, this is the static video encoding script using theora cli , the problem with this when i try to move the code below into the dynamic input script you help me with before it doesn't seem to work, I'm really confused here
you see i'm already confused here, i think my issues are, need to add some type of error check for the folder thing when file is not there,
next I change the static Theora script to dynamic input something like that i think
here are the files i'm working with, if you have time please check them out http://www.mediafire.com/?igtkmjmln34
there are only 4 php files with few lines of code,

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,