
Recherche avancée
Autres articles (82)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
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 ; (...) -
Configuration spécifique pour PHP5
4 février 2011, parPHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
Modules spécifiques
Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...)
Sur d’autres sites (4841)
-
Cannot open ".mp4" video files using OpenCV 2.4.3, Python 2.7 in Windows 7 machine
24 octobre 2017, par TJ MonserratI am currently working on a project that involves reading mp4 video files.
The problem I encountered is that it using Python 2.7 (32 bit), OpenCV 2.4.3 (cv2.pyd) in a Windows 7 machine.The code snippet is as follows :
try:
video = cv2.VideoCapture("video.mp4")
except:
print "Could not open video file"
raise
print video.grab()"
video.grab()
" always returns false : meaning it doesn’t read the file "video.mp4
"
But when we try this :try:
video = cv2.VideoCapture("video.avi")
except:
print "Could not open video file"
raise
print video.grab()"
video.grab()
" returns true : meaning it is able to read ".avi
" files.Another is we have tried this same snippet on Linux and Mac and it seems to work fine, meaning it is able to read both mp4 files and avi files.
This problem is similar to this problem and this problem. Both still don’t have a clear and workable answer.
I would appreciate any help or workaround aside from just using Linux or Mac for programming this as I need this to work on all three systems.
-
Returning shell_exec as string PHP detecting BPM with soundtouch/soundstrech
23 janvier 2016, par JeffI am working on a php function used to upload a .wav to server (along with converting to mp3 and creating waveform image png) , and within the function I would like it to use soundtouch / soundstrech to detect the B.P.M. (Beats Per Minute). I know it will not be the most accurate but for my purposes it will be all I need.
I was able to get the B.P.M. of a .wav file using soundtouch / soundstrech along with ffmpeg within a test.php file using deven’s php-bpm-detect wrapper But When I try to integrate it within my PHP function it returns the B.P.M. as zero.
I am wondering if there is a simpler way to get the bpm as a string from the following shell exec without having to use a separate php library ?
I would like to perform this and have it return as a string :
$song_bpm = shell_exec('soundstretch ' . $file_path . ' -bpm');
test.php (This works and returns the proper bpm :)
<?php
require "class.bpm.php";
$wavfile = "38a2819c20.wav";
$bpm_detect = new bpm_detect($wavfile);
$test = $bpm_detect->detectBPM();
echo ' bpm of ' . $wavfile . ' is: ' . $test . ' ';
?>PHP Function : (returns bpm as zero)
function upload_a_sound($user_id, $file_temp, $file_extn, $name, $uploader, $keywords) {
$timecode = substr(md5(time()), 0, 10);
$mp3name = 'beats/' . $timecode . '.mp3';
$file_path = 'beats/' . $timecode . '.wav';
move_uploaded_file($file_temp, $file_path);
shell_exec('ffmpeg -i ' . $file_path . ' -vn -ar 44100 -ac 2 -ab 192k -f mp3 ' . $mp3name . '');
require ('classAudioFile.php'); // This creates a spectogram .png file of .wav
$AF = new AudioFile;
$AF->loadFile($file_path);
$AF->visual_width=200;
$AF->visual_height=200;
$AF->visual_graph_color="#c491db";
$AF->visual_background_color="#000000";
$AF->visual_grid=false;
$AF->visual_border=false;
$AF->visual_graph_mode=0;
$AF->getVisualization ('images/song/' . $timecode . '.png');
$imageloc = 'images/song/' . $timecode . '.png';
require ('class.bpm.php'); //Deseven's class to get bpm,
$bpm_detect = new bpm_detect($file_path);
$song_bpm = $bpm_detect->detectBPM(); //when used here this returns 0
mysql_query("INSERT INTO `content` VALUES ('', '', '$name', '$uploader', '$keywords', '$file_path', '$imageloc', '$mp3name', '$song_bpm')"); // I will update this to mysqli soon, for now it works
}I also found this which works, but not when I integrate it into my function :
// create new files, because we don't want to override the old files
$wavFile = $filename . ".wav";
$bpmFile = $filename . ".bpm";
//convert to wav file with ffmpeg
$exec = "ffmpeg -loglevel quiet -i \"" . $filename . "\" -ar 32000 -ac 1 \"" . $wavFile . "\"";
$output = shell_exec($exec);
// now execute soundstretch with the newly generated wav file, write the result into a file
$exec = "soundstretch \"" . $wavFile . "\" -bpm 2> " . $bpmFile;
shell_exec($exec);
// read and parse the file
$output = file_get_contents($bpmFile);
preg_match_all("!(?:^|(?<=\s))[0-9]*\.?[0-9](?=\s|$)!is", $output, $match);
// don't forget to delete the new generated files
unlink($wavFile);
unlink($bpmFile);
// here we have the bpm
echo $match[0][2]; -
FFMPEG reporting EOF for network connection every so often, why ?
23 juillet 2015, par AlexI have the code as follows
av_open_input_file("rtsp://.....);
while(av_read_packet() >= 0) {
// do something with the packet
}The problem is I am only able to receive, say, 100-200 packets and then av_read_packet returns EOF error. So I have to reconnect and start getting frames again.
I wonder if I can set some options to
av_open_input_file()
(or maybe use some other API) so that the connection wouldn’t drop that often.Thank you