Hi,
I am making my own personal video upload website, and have got a jQuery upload for copying the file to my server, but I need to convert it to mp4 so that it will play in html5's video player, I have already written some code to do this but I must have changed something that broke it as when I get to the conversion process it last 2-3 seconds and doesn't actually do anything, here is the code
convert.php
Can someone please help me with this, as am not that advanced with ff-mpegPHP Code:<?php
include("../include/session.php");
$file = $_COOKIE['TV_NTWK_IN_UPLOAD_FILE'];
$code = $_COOKIE['TV_NTWK_IN_UPLOAD_CODE'];
$ext = end(explode(".", $file));
mkdir("php/thumbnails/$code/");
exec("ffmpeg -i php/files/$file -vframes 1 php/thumbnails/$code/poster.jpg");
exec("ffmpeg -i php/files/$file -vframes 50 php/thumbnails/$code/1.jpg");
exec("ffmpeg -i php/files/$file -vframes 250 php/thumbnails/$code/2.jpg");
exec("ffmpeg -i php/files/$file -vframes 450 php/thumbnails/$code/3.jpg");
exec("ffmpeg -i php/files/$file -vframes 650 php/thumbnails/$code/4.jpg");
exec("ffmpeg -i php/files/$file -vframes 850 php/thumbnails/$code/5.jpg");
if( !exec("ffmpeg -i php/files/$file -vcodec libx264 php/files/$code.mp4 1>php/stats/$code.txt 2>&1 &") ) {
mysql_query("INSERT INTO ntwk_tv_videos (id, user, title, video_image, video_type, description, timestmp) VALUES ('" . $code . "', '" . $session->accessid . "', 'Your New Video (" . date('F d, Y - H:i:s') . ")', 'poster', '$ext', 'Uploaded: " . date('F d, Y - H:i:s') . "', '" . date('Y-m-d') . "T" . date('H:i:s') . "Z')");
header("Location: modify-info.php?code=$code");
}else{
unlink("php/files/$file");
unlink("php/files/$code.mp4");
unlink("php/thumbnails/$code/");
header("Location: index.php?error=" . base64_encode("Video Failed to Convert!"));
}
?>
also if there is a cleaner and faster way of doing this, that would be great, thanks


Reply With Quote

Bookmarks