
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (24)
-
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (2868)
-
what is the good function php to deal with ffmpeg and progress bar [duplicate]
17 mai 2014, par Abed SolimanThis question already has an answer here :
I ask about ffmpeg and progressbar
I used exec function with ffmpeg and output the result to txt file
and using some of code I found here to
<center>
<?php
define('RAPIDLEECH', 'yes');
define('CONFIG_DIR', 'configs/');
require_once('configs/config.php');
define ( 'TEMPLATE_DIR', 'templates/'.$options['template_used'].'/' );
// Include other useful functions
require_once('classes/other.php');
error_reporting(0);
login_check();
include(TEMPLATE_DIR.'header.php');
echo ('<br /><br /><br /><b>AudioXtractor</b>, un complemento <br /> que te permite extraer el audio de tus videos.<br /><br /><br />');
putenv('GDFONTPATH=' . realpath('.')); ?>
<br />
<form method="post"><center>
<table>
<td>Movie:
<select>
<?php
$exts=array(".ac3", ".avi", ".f4v", ".flv", ".mkv", ".mov", ".mp4", ".mpg", ".mpeg", ".rmvb", ".srt", ".swf", ".wav", ".wmv");
$ext="";
function vidlist($dir)
{
$results = array();
$handler = opendir($dir);
while ($file = readdir($handler))
{
if (strrchr($file,'.')!="")
{
$ext=strtolower(strrchr($file,'.'));
}
if ($file != '.' && $file != '..' && in_array($ext,$GLOBALS["exts"]))
{
$results[] = $file;
}
}
closedir($handler);
sort($results);
return $results;
}
function Output($command) {
$output = array($command);
exec($command.' 2>&1', $output);
return ($output);
}
$files = vidlist("./files/");
foreach($files as $file)
{
echo '<option value="'.$file.'">'.$file.'</option>';
}
?>
</select></td></table>
<br /> >
New MP3's name:
<input type="text" value="nuevoaudio" />
<br /> >
<br />
<br />
<center><input type="submit" style="font-size:16px; font-weight:bold; cursor:pointer;" value="Extract" />
</center></center></form>
<?php
if ($_POST['video']!="")
$video = 'files/';
$video=array();
$video[0] = $_POST['video'];
if ($_POST['nvdo']!="")
$nvdo = 'files/';
$nvdo=array();
$nvdo[0] = $_POST['nvdo'];
foreach ($video as $vdo)
foreach ($nvdo as $nvd)
if (isset($_POST["analize"])) {
exec("ffmpeg -i files/$vdo -ab 192k files/$nvd.mp3 -y 2> files/$nvd.txt");
$ext=strtolower(strrchr($vdo,'.'));
/////////////////////////////////////////////////////my code //////////////////////////////////////////
$content = @file_get_contents("files/$nvd.txt");
//get duration of source
preg_match("/Duration: (.*?), start:/", $content, $matches);
$rawDuration = $matches[1];
//rawDuration is in 00:00:00.00 format. This converts it to seconds.
$ar = array_reverse(explode(":", $rawDuration));
$duration = floatval($ar[0]);
if (!empty($ar[1])) $duration += intval($ar[1]) * 60;
if (!empty($ar[2])) $duration += intval($ar[2]) * 60 * 60;
//get the time in the file that is already encoded
preg_match_all("/time=(.*?) bitrate/", $content, $matches);
$rawTime = array_pop($matches);
//this is needed if there is more than one match
if (is_array($rawTime)){$rawTime = array_pop($rawTime);}
//rawTime is in 00:00:00.00 format. This converts it to seconds.
$ar = array_reverse(explode(":", $rawTime));
$time = floatval($ar[0]);
if (!empty($ar[1])) $time += intval($ar[1]) * 60;
if (!empty($ar[2])) $time += intval($ar[2]) * 60 * 60;
//calculate the progress
$progress = round(($time/$duration) * 100);
echo '<br /><br />¡Su video fue convertido correctamente! <br /><br />Link al archivo:';
echo ' <a href="http://stackoverflow.com/feeds/tag/files/'.$nvd.'.mp3">'.$nvd.'.mp3</a><br />' . "<br />";
echo "Duration: " . $duration . "<br />";
echo "Current Time: " . $time . "<br />";
echo "Progress: " . $progress . "%" . "<br />";
//////////////////////////////////////my coed //////////////////////////////////////////////
}
?>
<br /><br /><a href="http://stackoverflow.com/feeds/tag/index.php">Volver al RapidLeech</a>
<br /><br /><br />Formatos Aceptados: <br /><b>.ac3, .avi, .f4v, .flv, .mkv, .mov, .mp3,<br /> .mp4, .mpg, .mpeg, .rmvb, .srt, .swf, .wav, .wmv</b>
<br /><br />
</center>
<?php
?>so i ask some one he told me the exec stop php script and never give me
You can't get the progress directly if you are using exec, because the php script is stopped until ffmpeg closes. (Because exec returns the whole execution output)
You should use popen, for being able to get the output from the process in real time (without reading any file) for parse and show the progressbar
Here is a example for get the output:
When you get the progress info from ffmpeg, you can use your code for parse it and show your progressbarthis is my popen script
<?php
$handle = popen ("ffmpeg.exe -i files/fz.mp4 -ab 192k files/vdf.mp3 2>&1 ", 'r');
$handles = (string)$handle;
$line = "";
while (false !== ($char = fgetc($handle)))
{
if ($char == "\r")
{
// You could now parse the $line for status information.
echo "$line\n";
$line = "";
} else {
$line .= $char;
}
ob_flush();
flush();
}
pclose ($handle);
//get duration of source
preg_match("/Duration: (.*?), start:/", $handles, $matches);
$rawDuration = $matches[1];
//rawDuration is in 00:00:00.00 format. This converts it to seconds.
$ar = array_reverse(explode(":", $rawDuration));
$duration = floatval($ar[0]);
if (!empty($ar[1])) $duration += intval($ar[1]) * 60;
if (!empty($ar[2])) $duration += intval($ar[2]) * 60 * 60;
//get the time in the file that is already encoded
preg_match_all("/time=(.*?) bitrate/", $handles, $matches);
$rawTime = array_pop($matches);
//this is needed if there is more than one match
if (is_array($rawTime)){$rawTime = array_pop($rawTime);}
//rawTime is in 00:00:00.00 format. This converts it to seconds.
$ar = array_reverse(explode(":", $rawTime));
$time = floatval($ar[0]);
if (!empty($ar[1])) $time += intval($ar[1]) * 60;
if (!empty($ar[2])) $time += intval($ar[2]) * 60 * 60;
//calculate the progress
$progress = round(($time/$duration) * 100);
echo '<br /><br />¡Su video fue convertido correctamente! <br /><br />Link al archivo:';
echo "Duration: " . $duration . "<br />";
echo "Current Time: " . $time . "<br />";
echo "Progress: " . $progress . "%" . "<br />";
//////////////////////////////////////my coed //////////////////////////////////////////////
?>so i dont under stand what is good for ffmpeg progressbAR
is exec or popen
so please give me hints for ffmpeg real time progressbar
what is good for progressbar
is html5 progress bar
or javascript progress bar
-
Seam carving
Today I was reading trough the ImageMagick ChangeLog and noticed an interesting entry. “Add support for liquid rescaling”. I rushed to check the MagickWand API docs and there it was : MagickLiquidRescaleImage ! After about ten minutes of hacking the Imagick support was done. Needless to say ; I was excited
For those who don’t know what seam carving is check the demo here. More detailed information about the algorithm can be found here : “Seam Carving for Content-Aware Image Resizing” by Shai Avidan and Ariel Shamir
To use this functionality you need to install at least ImageMagick 6.3.8-2 and liblqr. Remember to pass –with-lqr to ImageMagick configuration line. You can get liblqr here : http://liblqr.wikidot.com/. The Imagick side of the functionality should appear in the CVS today if everything goes as planned.
Here is a really simple example just to illustrate the results of the operation. The parameters might be far from optimal (didn’t do much testing yet). The original dimensions of image are 500×375 and the resulting size is 500×200.
Update : the functionality is pending until license issues are solved.
-
< ?php
-
-
/* Create new object */
-
$im = new Imagick( ’test.jpg’ ) ;
-
-
/* Scale down */
-
$im->liquidRescaleImage( 500, 200, 3, 25 ) ;
-
-
/* Display */
-
header( ’Content-Type : image/jpg’ ) ;
-
echo $im ;
-
-
?>
The original image by flickr/jennconspiracy
And the result :
Update. On kenrick’s request here is an image which is scaled down to 300×300
-
-
No output file when converting audio using FFmpeg in Android
18 mars 2017, par ShaI’m trying to convert
m4a
audio file towav
using FFmpeg. The code executes fine and gives no error, but I don’t see any output file in my directory.This is what I am executing :
String[] cmd = {"-y", "-i", "/storage/emulated/0/jd.m4a", "-f","wav" ,"/storage/emulated/0/DCIM/Camera/output.wav"};
And this is what gets printed :
03-17 15:40:51.539 10111-10111/io.whispero.soundmerger E/onProgress: ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
03-17 15:40:51.542 10111-10111/io.whispero.soundmerger E/onProgress: built with gcc 4.8 (GCC)
03-17 15:40:51.545 10111-10111/io.whispero.soundmerger E/onProgress: configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
03-17 15:40:51.547 10111-10111/io.whispero.soundmerger E/onProgress: libavutil 55. 17.103 / 55. 17.103
03-17 15:40:51.552 10111-10111/io.whispero.soundmerger E/onProgress: libavcodec 57. 24.102 / 57. 24.102
03-17 15:40:51.554 10111-10111/io.whispero.soundmerger E/onProgress: libavformat 57. 25.100 / 57. 25.100
03-17 15:40:51.556 10111-10111/io.whispero.soundmerger E/onProgress: libavdevice 57. 0.101 / 57. 0.101
03-17 15:40:51.559 10111-10111/io.whispero.soundmerger E/onProgress: libavfilter 6. 31.100 / 6. 31.100
03-17 15:40:51.561 10111-10111/io.whispero.soundmerger E/onProgress: libswscale 4. 0.100 / 4. 0.100
03-17 15:40:51.562 10111-10111/io.whispero.soundmerger E/onProgress: libswresample 2. 0.101 / 2. 0.101
03-17 15:40:51.564 10111-10111/io.whispero.soundmerger E/onProgress: libpostproc 54. 0.100 / 54. 0.100
03-17 15:40:51.581 10111-10111/io.whispero.soundmerger E/onProgress: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/jd.m4a':
03-17 15:40:51.585 10111-10111/io.whispero.soundmerger E/onProgress: Metadata:
03-17 15:40:51.587 10111-10111/io.whispero.soundmerger E/onProgress: major_brand : M4A
03-17 15:40:51.589 10111-10111/io.whispero.soundmerger E/onProgress: minor_version : 0
03-17 15:40:51.593 10111-10111/io.whispero.soundmerger E/onProgress: compatible_brands: M4A mp42isom
03-17 15:40:51.595 10111-10111/io.whispero.soundmerger E/onProgress: creation_time : 2017-02-16 10:36:39
03-17 15:40:51.597 10111-10111/io.whispero.soundmerger E/onProgress: Duration: 00:00:03.39, start: 0.000000, bitrate: 82 kb/s
03-17 15:40:51.602 10111-10111/io.whispero.soundmerger E/onProgress: Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 24 kb/s (default)
03-17 15:40:51.608 10111-10111/io.whispero.soundmerger E/onProgress: Metadata:
03-17 15:40:51.612 10111-10111/io.whispero.soundmerger E/onProgress: creation_time : 2017-02-16 10:36:39
03-17 15:40:51.614 10111-10111/io.whispero.soundmerger E/onProgress: Output #0, wav, to '/storage/emulated/0/DCIM/Camera/hyder.wav':
03-17 15:40:51.617 10111-10111/io.whispero.soundmerger E/onProgress: Metadata:
03-17 15:40:51.619 10111-10111/io.whispero.soundmerger E/onProgress: major_brand : M4A
03-17 15:40:51.621 10111-10111/io.whispero.soundmerger E/onProgress: minor_version : 0
03-17 15:40:51.623 10111-10111/io.whispero.soundmerger E/onProgress: compatible_brands: M4A mp42isom
03-17 15:40:51.625 10111-10111/io.whispero.soundmerger E/onProgress: ISFT : Lavf57.25.100
03-17 15:40:51.627 10111-10111/io.whispero.soundmerger E/onProgress: Stream #0:0(eng): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s (default)
03-17 15:40:51.629 10111-10111/io.whispero.soundmerger E/onProgress: Metadata:
03-17 15:40:51.631 10111-10111/io.whispero.soundmerger E/onProgress: creation_time : 2017-02-16 10:36:39
03-17 15:40:51.633 10111-10111/io.whispero.soundmerger E/onProgress: encoder : Lavc57.24.102 pcm_s16le
03-17 15:40:51.636 10111-10111/io.whispero.soundmerger E/onProgress: Stream mapping:
03-17 15:40:51.639 10111-10111/io.whispero.soundmerger E/onProgress: Stream #0:0 -> #0:0 (aac (native) -> pcm_s16le (native))
03-17 15:40:51.642 10111-10111/io.whispero.soundmerger E/onProgress: Press [q] to stop, [?] for help
03-17 15:40:51.645 10111-10111/io.whispero.soundmerger E/onProgress: size= 106kB time=00:00:03.39 bitrate= 256.2kbits/s speed= 181x
03-17 15:40:51.647 10111-10111/io.whispero.soundmerger E/onProgress: video:0kB audio:106kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.071860%
03-17 15:40:51.650 10111-10111/io.whispero.soundmerger E/SUCCESS: ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (GCC)
configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/jd.m4a':
Metadata:
major_brand : M4A
minor_version : 0
compatible_brands: M4A mp42isom
creation_time : 2017-02-16 10:36:39
Duration: 00:00:03.39, start: 0.000000, bitrate: 82 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 24 kb/s (default)
Metadata:
creation_time : 2017-02-16 10:36:39
Output #0, wav, to '/storage/emulated/0/DCIM/Camera/hyder.wav':
Metadata:
major_brand : M4A
minor_version : 0
compatible_brands: M4A mp42isom
ISFT : Lavf57.25.100
Stream #0:0(eng): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s (default)
Metadata:
creation_time : 2017-02-16 10:36:39
encoder : Lavc57.24.102 pcm_s16le
Stream mapping:
Stream #0:0 -> #0:0 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size= 106kB time=00:00:03.39 bitrate= 256.2kbits/s speed= 181x
video:0kB audio:106kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.071860%
03-17 15:40:51.653 10111-10111/io.whispero.soundmerger E/onFinish: onFinishPlease help why I am not seeing any output audio file :(
Thanks.