I got the code to work but its still no good because it only works with wmv files. Why does the script not convert mp4 into flv or maybe I just dont know how?
Printable View
I got the code to work but its still no good because it only works with wmv files. Why does the script not convert mp4 into flv or maybe I just dont know how?
By default, vShare will not reconvert a .flv file or a .mp4 (it doesn't reconvert .flv files because it's already in the proper format. The original reason why it doesn't reconvert .mp4 files is because the flash standard allows for playback of those files. However, this, in my opinion, is a mistake because the only version of MP4 that is compatible with flash is H.264 and not the entire MPEG-4 suite of encodings). You would have to modify vShare to have it reconvert all files if you want the hardcoded mod to work on those files.
Hello bplex, so I was kind of guessing in the right direction as to what you said. I wouldn't know where to begin with that, would this be in the same file video_conversion.php and can you point me in the right direction?
No. It would be in the functions_upload.php. You would have to modify it such that it converts all files and not just files other than .flv and .mp4.
Thanks, I kinda laughed when opened that, like I might need neo to help me out with this one :) Thats some serious php coding, but I should be looking for .flv, upload, convert somewhere along those line in there im guessing.
Here is a section of the code where I am guessing the modification needs to be done. I just want to make sure I am in the right place.
I see the section that says:
$outExtn = '.flv';
$rand_flv_name = $rand_name . '.flv';
if ($file_extn == 'mp4')
{
$rand_flv_name = $rand_name . '.mp4';
$outExtn = '.mp4';
}
I am lost please help anyone.
PHP Code:
$log_text = '<h1>STARTING VIDEO CONVERSION (process_queue.id = ' . $vid . ')</h1>';
write_log($log_text, $log_file_name, $debug, 'html');
$sql = "SELECT * FROM
`process_queue` AS `process_queue`,
`users` AS `users` WHERE
process_queue.id=$vid AND
process_queue.user=users.user_name";
$result = mysql_query($sql) or mysql_die($sql);
$download_info = mysql_fetch_assoc($result);
$video_file_name = $download_info['file'];
$re_process_vid = $download_info['vid'];
$status = $download_info['status'];
if ($status == 2)
{
$sql = "UPDATE `process_queue` SET
`status`='4' WHERE
`id`='$vid'";
mysql_query($sql) or mysql_die($sql);
}
else
{
$log_text = '<h2>STOP: can only process when status = 2. Current status is: ' . $status . '</h2>';
write_log($log_text, $log_file_name, $debug, 'html');
exit();
}
$video_src = VSHARE_DIR . '/video/' . $video_file_name;
$log_text = '<p>File: ' . $video_src . '</p>';
write_log($log_text, $log_file_name, $debug, 'html');
if (! file_exists($video_src))
{
$log_text = '<h2>ERROR: file not found - ' . $video_src . '</h2>';
write_log($log_text, $log_file_name, $debug, 'html');
$err = 1;
}
else
{
$pos = strrpos($video_file_name, '.');
$file_extn = strtolower(substr($video_file_name, $pos + 1, strlen($video_file_name) - $pos));
$log_text = '<p>$file_extn = ' . $file_extn . '</p>';
write_log($log_text, $log_file_name, $debug, 'html');
$seo_name = seo_name($download_info['title']);
$seo_name_org = $seo_name;
$i = 1;
while (check_field_exists($seo_name, 'video_seo_name', 'videos'))
{
$seo_name = $seo_name_org . '-' . $i;
$i ++;
}
if ($re_process_vid == 0)
{
$log_text = '<p>$re_process_vid = ' . $re_process_vid . '</p>';
write_log($log_text, $log_file_name, $debug, 'html');
$rand1 = $_SERVER['REQUEST_TIME'];
$rand2 = mt_rand();
$rand_name = $rand1 . $rand2;
$outExtn = '.flv';
$rand_flv_name = $rand_name . '.flv';
if ($file_extn == 'mp4')
{
$rand_flv_name = $rand_name . '.mp4';
$outExtn = '.mp4';
}
while (check_field_exists($rand_flv_name, 'video_flv_name', 'videos') == 1)
{
$rand1 = time();
$rand2 = mt_rand();
$rand_name = $rand1 . $rand2;
$rand_flv_name = $rand_name . $outExtn;
}
$log_text = '<p>$rand_flv_name = ' . $rand_flv_name . '</p>';
write_log($log_text, $log_file_name, $debug, 'html');
$video_folder = floor($convert_vid / 1000) + 1;
$video_folder = md5($video_folder);
$video_folder = substr($video_folder, 1, 10);
$video_folder = trim($video_folder);
$video_folder .= '/';
if (! is_dir(VSHARE_DIR . '/flvideo/' . $video_folder))
{
mkdir(VSHARE_DIR . '/flvideo/' . $video_folder);
}
It took me a long time to figure this out but on vShare 2.7 you would need to edit /include/functions_upload.php. Find and delete the code below ( it is past the middle of the file )
or just change the 'flv' extention to something like 'txt' . It should look like thisCode:if ($file_extn == 'flv')
{
$log_text = "<h2>MOVING UPLOADED FLV: $video_src => $video_flv</h2>";
write_log($log_text, $log_file_name, $debug, 'html');
if (! copy($video_src, $video_flv))
{
$log_text = 'ERROR: moving uploaded file failed';
write_log($log_text, $log_file_name, $debug, 'html');
}
}
else
I hope this helps.Code:if ($file_extn == 'txt')
~zelda180~
www.80TOONS.com
what about this piece right above that one?PHP Code:
if ($file_extn == 'flv' || $file_extn == 'mp4')
{
$log_text = "<h2>MOVING UPLOADED FLV: $video_src => $video_flv</h2>";
write_log($log_text, $log_file_name, $debug, 'html');
if (! copy($video_src, $video_flv))
{
$log_text = 'ERROR: moving uploaded file failed';
write_log($log_text, $log_file_name, $debug, 'html');
How come no one else replied to this? It must not work.