
Recherche avancée
Autres articles (44)
-
Pas question de marché, de cloud etc...
10 avril 2011Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
sur le web 2.0 et dans les entreprises qui en vivent.
Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...) -
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
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 (...)
Sur d’autres sites (7700)
-
Sinon stub within ffmpeg error event listener
22 juin 2022, par Pedro Eliasconst {writeStream, upload} = S3Service.uploadStream({ Bucket: process.env.BUCKET, Key: s3Path});

 ffmpeg(stream)
 .outputOptions('-copyts')
 .audioCodec("libopus")
 .toFormat("matroska")
 .on('error', (err, stdout, stderr) => {
 if (err) {
 console.log(err.message);
 upload.abort();
 return reject("Error FFMPEG");
 }
 })
 .on('start', (p) => console.log(p))
 .on(`end`, () => console.log("end ffmpeg"))
 .pipe(writeStream);

 upload.promise()
 .then(() => resolve("Successful audio converted transfer"))
 .catch((err) => console.error(err));



I have the code above and I'm writing a unit test for it as follow :


let uploadStreamStub = {
 writeStream: sandbox.stub().returnsThis(),
 upload: {
 promise: sandbox.stub(),
 abort: sandbox.stub()
 }
}

sandbox.stub(s3Service, "uploadStream").returns(uploadStreamStub);



I'd like to stub upload.abort() :


let onStub = sandbox.stub(ffmpeg.prototype, "on").returnsThis();
onStub.withArgs("error").yieldsAsync(new Error("test"));
sandbox.assert.calledOnce(uploadStreamStub.upload.abort);



However, the stub is not working :
AssertError : expected stub to be called once but was called 0 times


When I remove the "yieldsAsync" line and try to stub the promise it works :


// onStub.withArgs("error").yieldsAsync(new Error("test"));
sandbox.assert.calledOnce(uploadStreamStub.upload.promise);



So the stub only doesn't work on('error'...


What I'm doing wrong ?


How can I stub and check if abort has been called ?


-
Buffer as input and output for fluent-ffmpeg
9 septembre 2022, par nickcoding2The below looks like a lot but a it's primarily just output.


I'm trying to take in a buffer using multer (being send the request containing the video (.mov format) through Alamofire from an iPhone) as the input before a fluent-ffmpeg conversion, then I want it to output as a buffer, and then send the result to S3. I think I'm close, but I don't think fluent-ffmpeg can have a buffer passed in. This is deployed on heroku using this buildpack : https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.... How do I pass it in correctly ?


const multer = require('multer')
const upload = multer({ limits: { fieldSize: 100_000_000 } })
app.post('/create', upload.single('video'), async function (request, response, next) {
 let data = request.body
 console.log(data) // prints [Object: null prototype] { param1: '' }
 let bufferStream = new stream.PassThrough();
 console.log(request.file.buffer) // prints '<buffer 00="00" 14="14" 66="66" 74="74" 79="79" 70="70" 71="71" 20="20" 08="08" 77="77" 69="69" 64="64" 65="65" 01="01" 0e="0e" 28="28" 55="55" 6d="6d" 61="61" 21="21" 03="03" 40="40" 68="68" 1c="1c" 4e="4e" ff="ff" 3c="3c" 59="59" 96="96" 7c="7c" 82="82" 17718642="17718642" more="more" bytes="bytes">'

 new ffmpeg({
 source: stream.Readable.from(request.file.buffer, { objectMode: false })
 })
 // .format('mp4')
 .on('error', function (err) {
 console.log(Error: ${err})
 })
 .on('progress', function (progress) {
 console.log("progress")
 })
 .on('end', function () {
 console.log('Formatting finished!');
 console.log("after");
 })
 .writeToStream(bufferStream);

 // Read the passthrough stream
 const buffers = [];
 bufferStream.on('data', function (buf) {
 buffers.push(buf);
 });
 bufferStream.on('end', function () {
 const outputBuffer = Buffer.concat(buffers);
 // use outputBuffer
 });
 console.log("Added.")
 response.send("Success")
});
</buffer>


The output is what you can see below (without .format('mp4')) :


2022-09-03T13:12:24.194384+00:00 heroku[router]: at=info method=POST path="/createBusiness" host=sparrow-testing.herokuapp.com request_id=2774a4ec-e21e-4c2f-8086-460a4cba7d1d fwd="74.71.236.5" dyno=web.1 connect=0ms service=13157ms status=200 bytes=762 protocol=https
2022-09-03T13:12:24.186257+00:00 app[web.1]: [Object: null prototype] { title: '' }
2022-09-03T13:12:24.187296+00:00 app[web.1]: <buffer 00="00" 14="14" 66="66" 74="74" 79="79" 70="70" 71="71" 20="20" 08="08" 77="77" 69="69" 64="64" 65="65" 01="01" 0e="0e" 28="28" 55="55" 6d="6d" 61="61" 21="21" 03="03" 40="40" 68="68" 1c="1c" 4e="4e" ff="ff" 3c="3c" 59="59" 96="96" 7c="7c" 82="82" 17718642="17718642" more="more" bytes="bytes">
2022-09-03T13:12:24.189891+00:00 app[web.1]: Added.
2022-09-03T13:12:24.891564+00:00 app[web.1]: Error: Error: ffmpeg exited with code 1: pipe:1: Invalid argument
2022-09-03T13:12:24.891570+00:00 app[web.1]: 
</buffer>


This output is what you see with .format('mp4') :


2022-09-03T13:17:07.380415+00:00 app[web.1]: [Object: null prototype] { title: '' }
2022-09-03T13:17:07.381335+00:00 app[web.1]: <buffer 00="00" 14="14" 66="66" 74="74" 79="79" 70="70" 71="71" 20="20" 08="08" 77="77" 69="69" 64="64" 65="65" 01="01" 0e="0e" 28="28" 55="55" 6d="6d" 61="61" 21="21" 03="03" 40="40" 68="68" 1c="1c" 4e="4e" ff="ff" 3c="3c" 59="59" 96="96" 7c="7c" 82="82" 17718642="17718642" more="more" bytes="bytes">
2022-09-03T13:17:07.384047+00:00 app[web.1]: Added.
2022-09-03T13:17:07.388457+00:00 heroku[router]: at=info method=POST path="/createBusiness" host=sparrow-testing.herokuapp.com request_id=84e69ead-09b1-4668-8fc8-b9fc9d5f229d fwd="74.71.236.5" dyno=web.1 connect=0ms service=13079ms status=200 bytes=762 protocol=https
2022-09-03T13:17:08.339746+00:00 app[web.1]: Error: Error: ffmpeg exited with code 1: Conversion failed!
2022-09-03T13:17:08.339783+00:00 app[web.1]: 
</buffer>


My uploadFile function works correctly because I use it elsewhere—normally, I just pass in the request.file.buffer, but here it needs to be a buffer after the ffmpeg conversion


EDIT :


At Heiko's suggestion, I tried changing the multer initialization to


multer({ limits: { fieldSize: 100_000_000 }, dest: "uploads/" })



and the source I was passing in to ffmpeg to


new ffmpeg({
 source: request.file.path // request.file.path seems to be a path of a Multer-generated file, I'd assume the one I'm sending to the server
})
.format('mp4')



but it still errored out to


Error: ffmpeg exited with code 1: Conversion failed!



when the request.file was :


{
 fieldname: 'video',
 originalname: 'video',
 encoding: '7bit',
 mimetype: 'clientMime',
 destination: 'uploads/',
 filename: '08d5d3bbdcf1ac29fb97800136a306e9',
 path: 'uploads/08d5d3bbdcf1ac29fb97800136a306e9',
 size: 1567480
}



-
lavc/vorbisdec : use ptrdiff_t to iterate over intptr_t
19 septembre 2022, par Rémi Denis-Courmontlavc/vorbisdec : use ptrdiff_t to iterate over intptr_t
While this probably never overflows, we are better safe than sorry.
The callback prototype should probably also use ptrdiff_t or size_t,
but I diggress (this would affect the DSP callback prototype).