
Recherche avancée
Autres articles (90)
-
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
(Dés)Activation de fonctionnalités (plugins)
18 février 2011, parPour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...) -
Activation de l’inscription des visiteurs
12 avril 2011, parIl est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)
Sur d’autres sites (10879)
-
"Invalid or unexpected token" error when trying to execute ffmpeg build on lambda
4 janvier 2019, par almarcI have a node.js script that uses ffmpeg to convert mp4 downloaded from YT to mp3 and save to Amazon S3. Uploading using the serverless framework. The "ffmpeg" file is included in the main directory (with .yml), downloaded from here :
https://johnvansickle.com/ffmpeg/
The code :
'use strict'
process.env.PATH = process.env.PATH + ':/tmp/'
process.env['FFMPEG_PATH'] = '/tmp/ffmpeg';
const BIN_PATH = process.env['LAMBDA_TASK_ROOT']
process.env['PATH'] = process.env['PATH'] + ':' + BIN_PATH;
module.exports.download_mp3 = function (event, context, callback)
{
require('child_process').exec('cp /var/task/ffmpeg /tmp/.; chmod 755
/tmp/ffmpeg;', function (error, stdout, stderr) {
if (error)
{
console.log('An error occured', error);
callback(null, null)
}
else
{
var ffmpeg = require('ffmpeg');
const aws = require('aws-sdk')
const s3 = new aws.S3()
const ytdl = require('ytdl-core');
function uploadFromStream(s3) {
const stream = require('stream')
var pass = new stream.PassThrough();
var params = {Bucket: "some-bucket", Key: "some-key", Body: pass};
s3.upload(params, function(err, data) {
console.log(err, data);
});
console.log("Should be finished")
callback(null)
}
let stream = ytdl("some-video-id", {
quality: 'highestaudio',
filter: 'audioonly'
});
ffmpeg(stream)
.audioBitrate(128)
.format('mp3')
.on('error', (err) => console.error(err))
.pipe(uploadFromStream(s3), {
end: true
});
}})
}When triggered, the function writes an error in logs :
2019-01-04T14:50:54.525Z 21da4d49-1030-11e9-b901-0dc32b691a16
/var/task/ffmpeg:1
(function (exports, require, module, __filename, __dirname) { ELF
^
SyntaxError: Invalid or unexpected token
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at /var/task/download.js:17:18It’s, most definetely, an error in the "ffmpeg" file I’ve mentioned above (link provided). But I don’t know what’s the exact issue, I followed the first answer here :
https://stackoverflow.com/questions/47882810/lambda-not-connecting-to-ffmpeg
to include the ffmpeg build. -
How to overlay two audio files Node JS FFmpeg
27 avril 2023, par Markusha BoecMy code works only once correctly and starts to work correctly only after I restart my program. The first time the code outputs the correct audio, which is superimposed one on top of the other, and the second time only one audio with a duration of 15 seconds. I'm trying to get two audio files to help Node.js with FFMPEG. Do you have any ideas how to fix it ? My code is shown below.




async songMerge(bg_id, text) {
 const bgMusic = await this.airtable
 .table("BackgroundMusic")
 .select({ view: "View", filterByFormula: `ID = '${bg_id}'` })
 .firstPage();
 if (!bgMusic.length) throw new Error("is not found");

 const result = await fetch(
 `https://api.elevenlabs.io/v1/text-to-speech/VR6AewLTigWG4xSOukaG`,
 {
 method: "POST",
 headers: {
 accept: "audio/mpeg",
 "xi-api-key": "token",
 "Content-Type": "application/json",
 },
 body: JSON.stringify({
 text,
 voice_settings: {
 stability: 0,
 similarity_boost: 0,
 },
 }),
 }
 );

 const audioBuffer = await result.arrayBuffer();
 const filePath = path.join(__dirname, "../../../", "audio.mp3");

 await fs.writeFileSync(filePath, Buffer.from(audioBuffer));

 const test = await fetch(`${bgMusic[0].fields.AudioLink}`);
 const audioBufferr = await test.arrayBuffer();

 const filePathh = path.join(__dirname, "../../../", "test.mp3");
 await fs.writeFileSync(filePathh, Buffer.from(audioBufferr));

 await mergeAudio(filePathh, filePath);
 }







And the merge Audio function :


async function mergeAudio(bgMusic, path) {
 return await command
 .addInput(path)
 .addInput(bgMusic)
 .complexFilter([
 {
 filter: "amix",
 inputs: ["0:0", "1:0"],
 },
 ])
 .outputOptions("-y") // add this line to overwrite the output file
 .output(`./overlayed.mp3`)
 .setStartTime("00:00:00")
 .setDuration("15")
 .on("error", function (err) {
 console.log(err);
 })
 .on("end", function () {
 return "ok";
 })
 .run();
}



-
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