Recherche avancée

Médias (0)

Mot : - Tags -/clipboard

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

Autres articles (61)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (7208)

  • Error : bad memory at /opt/render/project/src/node_modules/@ffmpeg.wasm/core-mt/dist/core.js:15:1

    1er octobre 2023, par James

    While deploying nodejs app on render.com i get this error Error : bad memory at /opt/render/project/src/node_modules/@ffmpeg.wasm/core-mt/dist/core.js:15:1.

    


    how to avoid this error i am using ffmpeg for merging audio with video.

    


    full error

    


     /opt/render/project/src/node_modules/@ffmpeg.wasm/core-mt/dist/core.js:15&#xA;Oct 1 04:53:37 PM  Error("bad memory");var Aa=z.buffer;e.HEAP8=A=new Int8Array(Aa);e.HEAP16=C=new Int16Array(Aa);e.HEAP32=E=new Int32Array(Aa);e.HEAPU8=B=new Uint8Array(Aa);e.HEAPU16=wa=new Uint16Array(Aa);e.HEAPU32=F=new Uint32Array(Aa);e.HEAPF32=xa=new Float32Array(Aa);e.HEAPF64=ya=new Float64Array(Aa);za=z.buffer.byteLength;var H,Ba=[],Ca=[],Da=[],Ea=[],Fa=[],Ga=!1,Ha=0;function Ia(){return noExitRuntime||0opt/render/project/src/node_modules/@ffmpeg.wasm/core-mt/dist/core.js:15:1&#xA;Oct 1 04:53:37 PM      at Function.<anonymous> (/opt/render/project/src/node_modules/@ffmpeg.wasm/main/dist/index.js:165:64)&#xA;Oct 1 04:53:37 PM      at Generator.next (<anonymous>)&#xA;Oct 1 04:53:37 PM      at fulfilled (/opt/render/project/src/node_modules/@ffmpeg.wasm/main/dist/index.js:28:22)&#xA;</anonymous></anonymous>

    &#xA;

    my code

    &#xA;

    import express from "express";&#xA;const router = express.Router();&#xA;import { readFile, writeFile } from "fs/promises";&#xA;import { FFmpeg } from "@ffmpeg.wasm/main";&#xA;import path from "path";&#xA;&#xA;const currentDirectory = process.cwd();&#xA;&#xA;const inputFilePath = path.join(currentDirectory, "video3.mp4");&#xA;const inputFilePath1 = path.join(currentDirectory, "wolf-howl-6310.mp3");&#xA;const outputFilePath = path.join(currentDirectory, "video3-2.mp4");&#xA;&#xA;const ffmpeg = await FFmpeg.create({ core: "@ffmpeg.wasm/core-mt", log: true });&#xA;&#xA;try {&#xA;  ffmpeg.fs.writeFile("/video3.mp4", await readFile(inputFilePath));&#xA;  ffmpeg.fs.writeFile("/wolf-howl-6310.mp3", await readFile(inputFilePath1));&#xA;  console.log(ffmpeg.version);&#xA;  await ffmpeg.run(&#xA;    "-i",&#xA;    "/wolf-howl-6310.mp3",&#xA;    "-i",&#xA;    "/video3.mp4",&#xA;    "-c",&#xA;    "copy",&#xA;    "-map",&#xA;    "0:a:0",&#xA;    "-map",&#xA;    "1:v:0",&#xA;    "/video3-2.mp4"&#xA;  );&#xA;  await writeFile(outputFilePath, ffmpeg.fs.readFile("/video3-2.mp4"));&#xA;  console.log("Conversion successful!");&#xA;} catch (error) {&#xA;  console.error("Error:", error);&#xA;}&#xA;&#xA;router.post("/", (req, res) => {});&#xA;export { router as Merge };&#xA;

    &#xA;

  • Streaming without Content-Length in response

    21 décembre 2023, par kain

    I'm using Node.js, Express (and connect), and fluent-ffmpeg.

    &#xA;&#xA;

    We want to stream audio files that are stored on Amazon S3 through http.

    &#xA;&#xA;

    We have all working, except that we would like to add a feature, the on-the-fly conversion of the stream through ffmpeg.

    &#xA;&#xA;

    This is working well, the problem is that some browsers checks in advance before actually getting the file.

    &#xA;&#xA;

    Incoming requests containing the Range header, for which we reply with a 206 with all the info from S3, have a fundamental problem : we need to know in advance the content-length of the file.

    &#xA;&#xA;

    We don't know that since it is going through ffmpeg.

    &#xA;&#xA;

    One solution might be to write out the resulting content-length directly on S3 when storing the file (in a special header), but this means we have to go through the pain of having queues to encode after upload just to know the size for future requests.&#xA;It also means that if we change compressor or preset we have to go through all this over again, so it is not a viable solution.

    &#xA;&#xA;

    We also noticed big differencies in the way Chrome and Safari request the audio tag src, but this may be discussion for another topic.

    &#xA;&#xA;

    Fact is that without a proper content-length header in response everything seems to break or browsers goes in an infinite loop or restart the stream at pleasure.

    &#xA;&#xA;

    Ideas ?

    &#xA;

  • Saving Video From URL as MP3 in Firebase Storage

    4 janvier 2024, par Christopher Frydryck

    I am working on a problem I have been stumped on the past couple days. I am using Node.js with Express (v4.18.2) to eventually create a Firebase deployment that can take in a video URL and output an audio mp3 to the Firebase Firestore. I have made some progress, but am still unsuccessful in some areas.

    &#xA;

    I cannot save the file locally using fs, but for this example I have shown that it works with FS. I am successfully saving a local .mp3 file.

    &#xA;

    First a few functions I have :

    &#xA;

    async function downloadVideo(videoUrl) {&#xA;    try {&#xA;      const response = await axios.get(videoUrl, {&#xA;        responseType: &#x27;stream&#x27;,&#xA;      });&#xA;  &#xA;      if (response.status === 200) {&#xA;        return response.data;&#xA;      } else {&#xA;        throw new Error(&#x27;Failed to fetch the video&#x27;);&#xA;      }&#xA;    } catch (error) {&#xA;      throw new Error(&#x27;Error fetching the video: &#x27; &#x2B; error.message);&#xA;    }&#xA;  }&#xA;

    &#xA;

    async function extractAudioFromVideo(videoUrl) {&#xA;    try {&#xA;      const videoStream = await downloadVideo(videoUrl);&#xA;  &#xA;      // Create a PassThrough stream to pipe the video data&#xA;      const passThrough = new PassThrough();&#xA;      videoStream.pipe(passThrough);&#xA;&#xA;      const outputFile = &#x27;output.mp3&#x27;;&#xA;      const outputStream = fs.createWriteStream(outputFile);&#xA;  &#xA;        return new Promise((resolve, reject) => {&#xA;            const audioBuffers = [];&#xA;&#xA;            passThrough.on(&#x27;data&#x27;, chunk => {&#xA;                audioBuffers.push(chunk)&#xA;                outputStream.write(chunk); // Write chunks to a local file&#xA;              });&#xA;        &#xA;              passThrough.on(&#x27;error&#x27;, err => {&#xA;                reject(err);&#xA;              });&#xA;        &#xA;&#xA;            ffmpeg()&#xA;            .input(passThrough)&#xA;            .output(&#x27;/dev/null&#x27;) // Null output as a placeholder&#xA;            .outputOptions(&#x27;-vn&#x27;) // Extract audio only&#xA;            .noVideo()&#xA;            .audioQuality(0)&#xA;            .audioCodec(&#x27;libmp3lame&#x27;) // Set audio codec&#xA;            .format(&#x27;mp3&#x27;)&#xA;            .on(&#x27;end&#x27;, () => {&#xA;                const audioBuffer = Buffer.concat(audioBuffers)&#xA;                if (audioBuffer.length > 0) {&#xA;                    resolve(audioBuffer);&#xA;                  } else {&#xA;                    reject(new Error(&#x27;Empty audio buffer&#x27;));&#xA;                  }&#xA;              })&#xA;            .on(&#x27;error&#x27;, err => reject(err))&#xA;            .run();&#xA;        })&#xA;    } catch (error) {&#xA;      throw new Error(&#x27;Error extracting audio: &#x27; &#x2B; error.message);&#xA;    }&#xA;  }&#xA;

    &#xA;

     async function saveAudioToFirebase(audioBuffer, fileName) {&#xA;    try {&#xA;        let storage = admin.storage()&#xA;    let storageRef = storage.bucket(serviceAccount.storage_bucket_content)&#xA;      const file = storageRef.file(fileName) // Specify the desired file name here&#xA;&#xA;      const renamedFileName = fileName.replace(/\.[^/.]&#x2B;$/, &#x27;.mp3&#x27;); // Change the file extension to .mp3&#xA;  &#xA;      await file.save(audioBuffer, {&#xA;        metadata: {&#xA;          contentType: &#x27;audio/mpeg&#x27;, // Adjust the content type as needed&#xA;        },&#xA;      });&#xA;&#xA;      await file.setMetadata({&#xA;        contentType: &#x27;audio/mpeg&#x27;&#xA;      })&#xA;&#xA;      await file.move(renamedFileName); // Rename the file with the .mp3 extension&#xA;  &#xA;      console.log(&#x27;Audio saved to Firebase Storage.&#x27;);&#xA;    } catch (error) {&#xA;      console.error(&#x27;Error saving audio to Firebase Storage:&#x27;, error);&#xA;    }&#xA;  }&#xA;&#xA;

    &#xA;

    What works :

    &#xA;

      &#xA;
    • Downloading the video via Axios
    • &#xA;

    • Saving to Firebase storage (no intializing or pointer issues to Firebase)
    • &#xA;

    • Outputting a local .mp3 file called "output.mp3"
    • &#xA;

    • I am able to log the result of extractAudioFromVideo and get a buffer logged in my terminal
    • &#xA;

    &#xA;

    What doesn't work :

    &#xA;

      &#xA;
    • Saving a file to Firebase Storage that is an .mp3. It says ".mp3" in the url and it has a content type of 'audio/mpeg' but it is in fact an .mp4. Still has video and plays video in the browser window.
    • &#xA;

    &#xA;

    I am willing to use other libraries like tmp if suggested and the solution works.

    &#xA;