Recherche avancée

Médias (1)

Mot : - Tags -/ticket

Autres articles (32)

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

Sur d’autres sites (5020)

  • FFMPEG : Cannot read properties of undefined (reading 'format')

    1er avril 2023, par Donnyb

    I am currently to convert a video file to produce a thumbnail through ffmpeg, react-dropzone, and express. However I keep getting a error of "Cannot read properties of undefined (reading 'format')" in my console. For some reason it can not read the "metadata.format.duration" in my program, I have checked if ffmpeg is properly installed by running the ffmpeg —version in my console, and I get all the details, along with ffprobe —version as well.

    


    Here is my code :
upload.js

    


    router.post("/thumbnail", (req, res) => {
    let thumbsFilePath ="";
    let fileDuration ="";

    // req.body.filepath
    ffmpeg.ffprobe(req.body.filepath, function(err, metadata){
        console.dir(metadata);
        console.log(metadata.format.duration);

        fileDuration = metadata.format.duration;
    })

    ffmpeg(req.body.filepath) //req.body.filepath
    .on('filenames', function (filenames) {
        console.log('Will generate ' + filenames.join(', '))
        console.log(filenames);
        thumbsFilePath = "./uploads/thumbnails/" + filenames[0];
        
    })
    .on('end', function () {
        console.log('Screenshots taken');
        return res.json({ success: true, thumbsFilePath: thumbsFilePath, fileDuration: fileDuration})
    })
    .screenshots({
        // Will take screens at 20%, 40%, 60% and 80% of the video
        count: 3,
        folder: './uploads/thumbnails',
        size:'320x240',
        // %b input basename ( filename w/o extension )
        filename:'thumbnail-%b.png'
    });
})


    


    FrontEnd drop code :
AddVideo.js

    


    const onDrop = (files) => {&#xA;&#xA;        let formData = new FormData();&#xA;        const config = {&#xA;            header: { &#x27;content-type&#x27;: &#x27;multipart/form-data&#x27; }&#xA;        }&#xA;        console.log(files)&#xA;        formData.append("file", files[0])&#xA;&#xA;        axios.post(&#x27;http://localhost:5000/api/upload/uploadfiles&#x27;, formData, config)&#xA;            .then(response => {&#xA;                if (response.data.success) {&#xA;&#xA;                    let variable = {&#xA;                        filePath: response.data.filePath,&#xA;                        fileName: response.data.fileName&#xA;                    }&#xA;                    setFilePath(response.data.filePath)&#xA;&#xA;                    //gerenate thumbnail with this filepath ! &#xA;&#xA;                    axios.post(&#x27;http://localhost:5000/api/upload/thumbnail&#x27;, variable)&#xA;                        .then(response => {&#xA;                            if (response.data.success) {&#xA;                                setDuration(response.data.fileDuration)&#xA;                                setThumbnail(response.data.thumbsFilePath)&#xA;                            } else {&#xA;                                alert(&#x27;Failed to make the thumbnails&#x27;);&#xA;                            }&#xA;                        })&#xA;&#xA;&#xA;                } else {&#xA;                    alert(&#x27;failed to save the video in server&#x27;)&#xA;                }&#xA;            })&#xA;&#xA;    }&#xA;&#xA;    return (&#xA;        <div style="{{">&#xA;            <div style="{{">&#xA;                {/*  */}&#xA;            </div>&#xA;&#xA;            <formcontrol>&#xA;            <div style="{{">&#xA;            &#xA;                        {({ getRootProps, getInputProps }) => (&#xA;                            <div style="{{" solid="solid">&#xA;                                <input />&#xA;                                <icon type="plus" style="{{"></icon>&#xA;&#xA;                            </div>&#xA;                        )}&#xA;                    &#xA;            </div>&#xA;            </formcontrol>&#xA;        </div>&#xA;    )&#xA;}&#xA;

    &#xA;

    The video I am trying to upload is a mp4 file. I am using fluent-ffmpeg as a dependency.

    &#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;

  • Revision 37406 : Le cron toute les minutes Amélioration de pleins de petites choses ...

    18 avril 2010, par kent1@… — Log

    Le cron toute les minutes
    Amélioration de pleins de petites choses
    Incrément mineur de la version