Recherche avancée

Médias (0)

Mot : - Tags -/masques

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (44)

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le 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, par

    MediaSPIP 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 2013

    Jolie 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 Elias
        const {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 nickcoding2

    The 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(&#x27;multer&#x27;)&#xA;const upload = multer({ limits: { fieldSize: 100_000_000 } })&#xA;app.post(&#x27;/create&#x27;, upload.single(&#x27;video&#x27;), async function (request, response, next) {&#xA;  let data = request.body&#xA;  console.log(data) // prints [Object: null prototype] { param1: &#x27;&#x27; }&#xA;  let bufferStream = new stream.PassThrough();&#xA;  console.log(request.file.buffer) // prints &#x27;<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">&#x27;&#xA;&#xA;  new ffmpeg({&#xA;    source: stream.Readable.from(request.file.buffer, { objectMode: false })&#xA;  })&#xA;  // .format(&#x27;mp4&#x27;)&#xA;  .on(&#x27;error&#x27;, function (err) {&#xA;    console.log(Error: ${err})&#xA;  })&#xA;  .on(&#x27;progress&#x27;, function (progress) {&#xA;    console.log("progress")&#xA;  })&#xA;  .on(&#x27;end&#x27;, function () {&#xA;    console.log(&#x27;Formatting finished!&#x27;);&#xA;    console.log("after");&#xA;  })&#xA;  .writeToStream(bufferStream);&#xA;&#xA;  // Read the passthrough stream&#xA;  const buffers = [];&#xA;  bufferStream.on(&#x27;data&#x27;, function (buf) {&#xA;    buffers.push(buf);&#xA;  });&#xA;  bufferStream.on(&#x27;end&#x27;, function () {&#xA;    const outputBuffer = Buffer.concat(buffers);&#xA;  // use outputBuffer&#xA;  });&#xA;  console.log("Added.")&#xA;  response.send("Success")&#xA;});&#xA;</buffer>

    &#xA;

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

    &#xA;

    2022-09-03T13:12:24.194384&#x2B;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&#xA;2022-09-03T13:12:24.186257&#x2B;00:00 app[web.1]: [Object: null prototype] { title: &#x27;&#x27; }&#xA;2022-09-03T13:12:24.187296&#x2B;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">&#xA;2022-09-03T13:12:24.189891&#x2B;00:00 app[web.1]: Added.&#xA;2022-09-03T13:12:24.891564&#x2B;00:00 app[web.1]: Error: Error: ffmpeg exited with code 1: pipe:1: Invalid argument&#xA;2022-09-03T13:12:24.891570&#x2B;00:00 app[web.1]: &#xA;</buffer>

    &#xA;

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

    &#xA;

    2022-09-03T13:17:07.380415&#x2B;00:00 app[web.1]: [Object: null prototype] { title: &#x27;&#x27; }&#xA;2022-09-03T13:17:07.381335&#x2B;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">&#xA;2022-09-03T13:17:07.384047&#x2B;00:00 app[web.1]: Added.&#xA;2022-09-03T13:17:07.388457&#x2B;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&#xA;2022-09-03T13:17:08.339746&#x2B;00:00 app[web.1]: Error: Error: ffmpeg exited with code 1: Conversion failed!&#xA;2022-09-03T13:17:08.339783&#x2B;00:00 app[web.1]: &#xA;</buffer>

    &#xA;

    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

    &#xA;

    EDIT :

    &#xA;

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

    &#xA;

    multer({ limits: { fieldSize: 100_000_000 }, dest: "uploads/" })&#xA;

    &#xA;

    and the source I was passing in to ffmpeg to

    &#xA;

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

    &#xA;

    but it still errored out to

    &#xA;

    Error: ffmpeg exited with code 1: Conversion failed!&#xA;

    &#xA;

    when the request.file was :

    &#xA;

    {&#xA;  fieldname: &#x27;video&#x27;,&#xA;  originalname: &#x27;video&#x27;,&#xA;  encoding: &#x27;7bit&#x27;,&#xA;  mimetype: &#x27;clientMime&#x27;,&#xA;  destination: &#x27;uploads/&#x27;,&#xA;  filename: &#x27;08d5d3bbdcf1ac29fb97800136a306e9&#x27;,&#xA;  path: &#x27;uploads/08d5d3bbdcf1ac29fb97800136a306e9&#x27;,&#xA;  size: 1567480&#xA;}&#xA;

    &#xA;

  • lavc/vorbisdec : use ptrdiff_t to iterate over intptr_t

    19 septembre 2022, par Rémi Denis-Courmont
    lavc/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).

    • [DH] libavcodec/ppc/vorbisdsp_altivec.c
    • [DH] libavcodec/vorbisdec.c