
Recherche avancée
Autres articles (4)
-
Menus personnalisés
14 novembre 2010, parMediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
Menus créés à l’initialisation du site
Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...) -
Mise à disposition des fichiers
14 avril 2011, parPar défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...) -
MediaSPIP Player : problèmes potentiels
22 février 2011, parLe lecteur ne fonctionne pas sur Internet Explorer
Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)
Sur d’autres sites (2053)
-
FFMPEG MP4 conversion takes so long its not practical
30 avril 2018, par Chrisco420365I want to start out by saying that I’m not just stating the fact that FFMPEG to MP4 conversion is so slow, but I’m hoping someone here can help me with this as I’ve searched around and haven’t really found out what to do in order to fix my problem.
So I found a script that seems to do the job for me, it inputs several video file formats and will in turn convert to MP4 which I will later allow the web user to watch online.
Two main things are done in this script by FFMPEG, a still image is captured in .jpg format and the video is converted to MP4. After some tweaking the script seems to work but at first I thought that it wasn’t working, that it was simply halting my server.
Let me back up for a minute... I am using FFMPEG on my development server, which is really just my crappy laptop with XAMPP installed on Windows 10 and only 2GB of RAM. Once I have the site working perfectly I will move from my crappy laptop development environment to probably a entry level dedicated server hosting plan from Godaddy or other, since at first I expect the traffic to my website to be very low.
The problem I am having is I am testing out the script that I will show you, and even with a 10MB video, it takes over 2 minutes to finish. Meanwhile the upload progress bar shows 100% since the upload is in fact complete, but no message for the user to know that something is going on behind the scenes. Obviously that I can figure out how to fix myself, maybe even just put a message letting them know that it will be a few minutes. When I tried a video that is 120MB, it took over 5 minutes which means I had to not only modify my php.ini file to allow for such script execution times, but it also makes it so that I can do nothing on the website while this is happening.
Not only can I not even so much as scroll the page up or down, but if I try to open another tab and load my website it just sits there with a blank screen as if its trying to access my site. Obviously it’s because FFMPEG is using up all system resources during its conversion of the video file. If I open file explorer and click once on the video file that is being created, and continue clicking once on it I’ll see the file size of this file slowly get larger and larger, which is obvious since the file is being filled. This problem of course is with no users on it other than myself since its in its development stage, so I wonder what it will be like on a dedicated server with users online. Will the other users not be able to do anything for however many minutes until whoever is uploading a video has their video finished ?
Should it be necessary for me to increase the max execution time in the php.ini file to more than 5 minutes for a 120MB file ? What will happen if a user tries to upload a file larger than 120MB ? Should I cut them off at 500MB perhaps ?
I love the fact that my users will be able to upload videos and I can get thumbnails and even convert to MP4 to display using HTML5 but not thrilled if noone, including the user uploading the video, can use the site as the system resources are pegged. The last time I uploaded a video on YouTube I think I remember a message saying that it would take several minutes to finish but I don’t remember the website just completely stopping for several minutes. Perhaps this is because I’m running on my insignificant laptop ?
While searching for answers to this I did come across some people complaining about it being slow but didn’t find any solutions and in fact don’t think I saw people saying it completely locked up the website until finished. As I said, I’d hate for others not to be able to get to my website or be kicked off simply because someone is uploading a video.
Perhaps this is a common issue that can be resolved with a powerful enough dedicated server once I move to production ? I would greatly appreciate any and all suggestions on how to resolve this so the user may at least continue using other areas of our website, while the conversion is taking place. I can send them an alert once the conversion is finished. If there are any suggestions as to a minimum dedicated server specs that would help alleviate this from happening, I am all ears ! :) Thanks !
Here is the script that I’m currently using :
<?php
include_once($_SERVER['DOCUMENT_ROOT'].'/includes/dbc.php');
// size input prevents buffer overrun exploits.
function sizeinput($input, $len){
(int)$len;
(string)$input;
$n = substr($input, 0,$len);
$ret = trim($n);
$out = htmlentities($ret, ENT_QUOTES);
return $out;
}
//Check the file is of correct format.
function checkfile($input){
$ext = array('mpg', 'wma', 'mov', 'flv', 'mp4', 'avi', 'qt', 'wmv', 'rm');
$extfile = substr($input['name'],-4);
$extfile = explode('.',$extfile);
$good = array();
$extfile = $extfile[1];
if(in_array($extfile, $ext)){
$good['safe'] = true;
$good['ext'] = $extfile;
}else{
$good['safe'] = false;
}
return $good;
}
$user_id = $_SESSION['user_id'];
// if the form was submitted process request if there is a file for uploading
if($_POST && array_key_exists("vid_file", $_FILES)){
//$uploaddir is for videos before conversion
$uploaddir = 'temp/';
//$live_dir is for videos after converted to flv
$live_dir = 'library/';
//$live_img is for the first frame thumbs.
$live_img = 'thumbs/';
$seed = time();
$upload = $seed;
$uploadfile = 'temp/'.$upload.'.mp4';
$vid_title = sizeinput($_POST['vidTitle'], 50);
$vid_title = sanitizeString($vid_title);
$vid_desc = sizeinput($_POST['vidDesc'], 2000);
$vid_desc = sanitizeString($vid_desc);
$vid_cat = (int)$_POST['vidCat'];
$safe_file = checkfile($_FILES['vid_file']);
if($safe_file['safe'] == 1){
if (move_uploaded_file($_FILES['vid_file']['tmp_name'], 'temp/'.$upload.'.mp4')) {
echo "File was successfully uploaded.<br />";
//$base = basename($uploadfile, $safe_file['ext']);
$new_file = $seed.'.mp4';
$new_image = $seed.'.jpg';
$new_image_path = "thumbs/".$seed.'.jpg';
$new_flv = "library/".$new_file;
//exec('ffmpeg -i '.$uploadfile.' -an -ss 00:00:01-r 1 -vframes 1 -f mjpeg -y '.$new_image_path);
exec('ffmpeg -i '.$uploadfile.' -f mjpeg -vframes 1 -s 300x300 -an '.$new_image_path.'');
//ececute ffmpeg generate flv
exec('ffmpeg -i '.$uploadfile.' -f mp4 '.$new_flv);
//execute ffmpeg and create thumb
echo 'Thank You For Your Video!<br />';
//create query to store video
$sql = "INSERT INTO videos (`user_id`, `title`,`desc`, `file`, `thumb`) VALUES('".$user_id."','".$vid_title."','".$vid_desc."','".$new_file."','".$new_image."')";
echo '<img src="http://stackoverflow.com/feeds/tag/'.$new_image_path.'" style='max-width: 300px; max-height: 300px' /><br />
<h3>'.$vid_title.'</h3>';
mysqli_query($link, $sql) or die(mysqli_error($mysql));
} else {
echo "Possible file upload attack!\n";
print_r($_FILES);
}
}else{
echo 'Invalid File Type Please Try Again. You file must be of type
.mpg, .wma, .mov, .flv, .mp4, .avi, .qt, .wmv, .rm';
}
}
?> -
Interfacing to an Xbox Optical Drive
1er octobre 2013, par Multimedia Mike — xboxThe next generation Xbox is going to hit the streets soon. But for some reason, I’m still interested in the previous generation’s unit (i.e., the original Xbox). Specifically, I’ve always wondered if it’s possible to use the original Xbox’s optical drive in order to read Xbox discs from Linux. I was never curious enough to actually buy an Xbox just to find out but I eventually came across a cast-off console on a recycle pile.
I have long known that the Xbox has what appears to be a more or less standard optical drive with a 40-pin IDE connector. The only difference is the power adapter which I surmise is probably the easiest way to turn a bit of standardized hardware into a bit of proprietary hardware. The IDE and power connectors look like this :
Thus, I wanted to try opening an Xbox and plugging the optical drive into a regular PC, albeit one that supports IDE cables, and allow the Xbox to supply power to the drive. Do you still have hardware laying around that has 40-pin IDE connectors ? I guess my Mac Mini PPC fits the bill, but I’ll be darned if I’m going to pry that thing open again. I have another IDE-capable machine buried in my closet, last called into service when I needed a computer with a native RS-232 port 3 years ago. The ordeal surrounding making this old computer useful right now can be another post entirely.
Here’s what the monstrosity looks like thanks to characteristically short IDE cable lengths :
Process :
- Turn on Xbox first
- Turn on PC
Doing these things in the opposite order won’t work since the kernel really wants to see the drive when booting up. Inspecting the
'dmesg'
log afterward reveals interesting items :<br />
hdd: PHILIPS XBOX DVD DRIVE, ATAPI CD/DVD-ROM drive<br />
hdd: host max PIO5 wanted PIO255(auto-tune) selected PIO4<br />
hdd: UDMA/33 mode selected<br />
[...]<br />
hdd: ATAPI DVD-ROM drive, 128kB Cache<br />Why is that interesting ? When is the last time to saw disk devices prefixed by ‘hd’ rather than ‘sd’ ? Blast from the past. Oh, and the optical drive’s vendor string clearly indicates that this is an Xbox drive saying ‘hi !’.
Time To Read
When I first studied an Xbox disc in a normal optical drive, I noticed that I was able to read 6992 2048-byte sectors — about 14 MB of data — as reported by the disc table of contents (TOC). This is just enough data to play a standard DVD video animation that kindly instructs the viewer to please use a proper Xbox. At this point, I estimated that there must be something special about Xbox optical drive firmware that knows how to read alternate information on these discs and access further sectors.I ran my TOC query tool with an Xbox Magazine demo disc in the optical drive and it reported substantially more than 6992 sectors, enough to account for more than 2 GB of data. That’s promising. I then tried running
'dd'
against the device and it was able to read… about 14 MB, an exact quantity of bytes that, when divided by 2048 bytes/sector, yields 6992 sectors.Future (Past ?) Work
Assuming Google is your primary window into the broader internet, the world is beginning to lose its memory of things pertaining to the original Xbox (Microsoft’s naming scheme certainly doesn’t help searches). What I’m saying is that it can be difficult to find information about this stuff now. However, I was able to learn that a host needs to perform a sort of cryptographic handshake with the drive at the SCSI level before it is allowed to access the forbidden areas of the disc. I think. I’m still investigating this and will hopefully post more soon. -
How to install ffmpeg
8 octobre 2017, par user5913892I want to make a "mini" editor video. My goal is, cut some part of the video and then save it and also create an undo button. Now , I was looking for the best solution (This operation have to be done in a website) and I found that I have to use ffmpeg. I didn’t know if ffmpeg was already installed on my server and I use this php script to discover it :
<?php
/**
* Test script for FFmpeg
*
* @author Andycoder /wdevblog.net.ru/>
*/
ini_set('display_errors',1);
error_reporting(E_ALL);
$is_windows = strpos( php_uname(), "Windows" ) !== false;
$ffmpeg_path = !empty( $_POST['ffmpeg_path'] ) && strpos( $_POST['ffmpeg_path'], 'ffmpeg' ) !== false ? trim( $_POST['ffmpeg_path'] ) : '';
if( !$ffmpeg_path && !$is_windows ){
$ffmpeg_path = trim( shell_exec( 'which ffmpeg' ) );
}
function getCodecs( $ffmpeg_path = '' ) {
$lines = array();
$encoders = array();
exec( "{$ffmpeg_path} -codecs", $lines);
foreach ($lines as $line) {
if (preg_match('/^\s+([A-Z .]+)\s+(\w{2,})\s+(.*)$/', $line, $m)) {
$type = trim($m[1]);
if (strpos($type, 'E') !== false) {
$encoder = trim($m[2]);
if (strpos($encoder, ',') !== false) {
foreach (split(',', $encoder) as $e) {
$encoders[] = $e;
}
} else {
$encoders[] = $encoder;
}
}
}
}
sort($encoders);
return $encoders;
}
function getPHPPath(){
$is_windows = strpos( strtolower(php_uname()), 'windows' ) !== false;
if( $is_windows ){
$output = dirname(ini_get('extension_dir')) . "/php.exe";
}else{
$output = trim(shell_exec("which php"));
}
return $output;
}
$info = array();
$info['php_version'] = array( 'name' => 'PHP version', 'value' => phpversion() );
$info['php_path'] = array( 'name' => 'PHP path', 'value' => getPHPPath() );
$info['web_server'] = array( 'name' => 'Web server', 'value' => $_SERVER['SERVER_SOFTWARE'] );
$info['ffmpeg_path'] = array( 'name' => 'FFMPEG path', 'value' => $ffmpeg_path );
$info['ffmpeg_version'] = array( 'name' => 'FFMPEG version', 'value' => '' );
if( $ffmpeg_path ){
$ffmpeg_ver = shell_exec( "{$ffmpeg_path} -version" );
preg_match( '/.+version.+/', $ffmpeg_ver, $matches );
if( !empty( $matches ) ){
$info['ffmpeg_version']['value'] = $matches[0];
}
}
$info['yamdi_path'] = array( 'name' => 'Yamdi path', 'value' => !$is_windows ? trim(shell_exec('which yamdi')) : '' );
$info['mp4box_path'] = array( 'name' => 'MP4Box (GPAC) path', 'value' => !$is_windows ? trim(shell_exec('which MP4Box')) : '' );
$info['qtfaststart_path'] = array( 'name' => 'qt-faststart path', 'value' => !$is_windows ? trim(shell_exec('which qt-faststart')) : '' );
$info['flvtool2_path'] = array( 'name' => 'flvtool2 path', 'value' => !$is_windows ? trim(shell_exec('which flvtool2')) : '' );
$info['ffmpeg_codecs'] = array( 'name' => 'FFMPEG codecs', 'value' => array() );
if( $ffmpeg_path ) {
$info['ffmpeg_codecs']['value'] = getCodecs( $ffmpeg_path );
}
if( empty( $info['ffmpeg_codecs']['value'] ) ){
$info['ffmpeg_path']['value'] = '';
}
ksort($info);
?>
<code class="echappe-js"><script type="text/javascript"><br />
function expandCollapse( id ){<br />
if( document.getElementById(id).style.display == 'none' ){<br />
document.getElementById(id).style.display = 'block';<br />
}else{<br />
document.getElementById(id).style.display = 'none';<br />
}<br />
}<br />
</script>Property Value < ?php foreach( $info as $key => $opt ) : ?>
< ?php echo $opt[’name’] ; ?> : < ?php if( !empty( $opt[’value’] ) ) : ?>
< ?php
if( !is_array( $opt[’value’] ) ) :
echo $opt[’value’] ;
else : ?>< ?php endif ; ?>
< ?php else : ?>
[Not found]
< ?php endif ; ?>< ?php endforeach ; ?>
that return me this :
So, I have not ffmpeg installed on that server. The server should be Linux, I say this because I use one of the many website in Internet to discover it.
I know that the website say that the Webserver is Engine-x, but my company has told that is Apache (as the php script already told me). Now , I found this link http://www.mysql-apache-php.com/ffmpeg-install.htm (in Stackoverflow and many other parts) that say how to install ffmpeg in Linux, but Where should I execute these commands ? Should I use Putty ? or What ?