Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (57)

  • Encodage et transformation en formats lisibles sur Internet

    10 avril 2011

    MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
    Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
    Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • 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 (...)

Sur d’autres sites (5789)

  • HTTP Live video streaming using ffmpeg using NODEJS via Socket.IO

    4 avril 2024, par dintel

    I can't transmit the webcam to the server and to the website. Before, I was able to transmit the webcam (I don't remember how), but I only see frames continuously sent in cmd and don't see anything at localhost:3000 or 127.0.0.1:3000.
I installed socket.io, ffmpeg and nodejs path
And when i try this one, everything fine on udp, but to server and website is impossible.
ffplay udp ://127.0.0.1:23000
ffmpeg -f dshow -framerate 30 -video_size 640x480 -i video="Integrated Camera" -vcodec mpeg4 -f mpegts udp ://127.0.0.1:23000

    


    My server.js code :

    


    
const http = require('http');
const fs = require('fs');
const server = http.createServer((req, res) => {
  res.writeHead(200, {'Content-Type': 'text/html'});
  fs.readFile(__dirname + '/index.html', (err, data) => {
    if (err) {
      res.writeHead(404);
      res.end(JSON.stringify(err));
      return;
    }
    res.writeHead(200);
    res.end(data);
  });
});
const io = require('socket.io')(server);

io.on('connection', (socket) => {
  console.log('A user connected');

  socket.on('disconnect', () => {
    console.log('User disconnected');
  });
});

server.listen(3000, () => {
  console.log('Server is running on http://localhost:3000');
});

const spawn = require('child_process').spawn;

const ffmpeg = spawn('ffmpeg', [
  '-f', 'dshow',
  '-i', 'video="Integrated Camera"', // i'm sure this is my webcam window
  '-vcodec', 'libx264',
  '-preset', 'veryfast',
  '-tune', 'zerolatency',
  '-f', 'hls',
  '-hls_time', '2',
  '-hls_list_size', '6',
  '-hls_flags', 'delete_segments',
  '-hls_segment_filename', 'public/hls/stream%03d.ts',
  'public/hls/index.m3u8'
]);

ffmpeg.stderr.on('data', (data) => {
  console.error(`ffmpeg error: ${data}`);
});
`


    


    My index.html :

    


    &#xA;&#xA;&#xA;  &#xA;  &#xA;  &#xA;&#xA;&#xA;  <video width="640" height="480" controls="controls"></video>&#xA;  <code class="echappe-js">&lt;script src='http://stackoverflow.com/socket.io/socket.io.js'&gt;&lt;/script&gt;&#xA;  &lt;script&gt;&amp;#xA;    const socket = io();&amp;#xA;&amp;#xA;    const video = document.getElementById(&amp;#x27;videoPlayer&amp;#x27;);&amp;#xA;    const stream = new MediaStream();&amp;#xA;&amp;#xA;    video.srcObject = stream;&amp;#xA;    video.play();&amp;#xA;&amp;#xA;    socket.on(&amp;#x27;stream&amp;#x27;, (data) =&gt; {&amp;#xA;      const byteArray = new Uint8Array(data);&amp;#xA;      const blob = new Blob([byteArray], { type: &amp;#x27;video/mp4&amp;#x27; });&amp;#xA;      const url = window.URL.createObjectURL(blob);&amp;#xA;&amp;#xA;      const reader = new FileReader();&amp;#xA;      reader.readAsDataURL(blob);&amp;#xA;      reader.onloadend = () =&gt; {&amp;#xA;        video.src = reader.result;&amp;#xA;      };&amp;#xA;    });&amp;#xA;  &lt;/script&gt;&#xA;&#xA;&#xA;`&#xA; `&#xA;

    &#xA;

  • lavfi/tonemap_vaapi : Add support for HDR to HDR tone mapping

    18 mars 2024, par Xinpeng Sun
    lavfi/tonemap_vaapi : Add support for HDR to HDR tone mapping
    

    Usage example :
    ffmpeg -y -hwaccel vaapi -hwaccel_output_format vaapi -i hdr.mp4 \
    - vf "tonemap_vaapi=display=7500 3000|34000 16000|13250 34500|15635 16450|500 10000000:extra_hw_frames=64" \
    - c:v hevc_vaapi output.mp4

    Signed-off-by : Xinpeng Sun <xinpeng.sun@intel.com>
    Signed-off-by : Haihao Xiang <haihao.xiang@intel.com>

    • [DH] doc/filters.texi
    • [DH] libavfilter/vf_tonemap_vaapi.c
  • Merging multiple audios to a video with ffmpeg causes the volume being reduced. How to avoid that ?

    25 janvier 2024, par Terry Windwalker
            const command = ffmpeg();&#xA;&#xA;        const mp4Path = path.join(__dirname, &#x27;..&#x27;, &#x27;..&#x27;, &#x27;temp&#x27;, `q-video-${new Date().getTime()}.mp4`);&#xA;&#xA;        fs.writeFileSync(mp4Path, videoBuff);&#xA;        console.log(&#x27;mp4 file created at: &#x27;, mp4Path);&#xA;&#xA;        // Set the video stream as the input for ffmpeg&#xA;        command.input(mp4Path);&#xA;&#xA;        const mp3Paths = [];&#xA;&#xA;        for (let i = 0; i &lt; audios.length; i&#x2B;&#x2B;) {&#xA;            const audio = audios[i];&#xA;            const mp3Path = path.join(__dirname, &#x27;..&#x27;, &#x27;..&#x27;, &#x27;temp&#x27;, `q-audio-${new Date().getTime()}-${i}.mp3`);&#xA;            mp3Paths.push(mp3Path);&#xA;&#xA;            fs.writeFileSync(mp3Path, audio.questionBuf);&#xA;            console.log(&#x27;mp3 file created at: &#x27;, mp3Path);&#xA;            // Set the audio stream as the input for ffmpeg&#xA;            command.input(mp3Path);&#xA;        }&#xA;&#xA;        // -------&#xA;        // ChatGPT take 1&#xA;        const audioTags = [];&#xA;        const audioFilters = audios.map((audio, index) => {&#xA;            const startTime = audio.start_at; // Replace with your logic to calculate start time&#xA;            const endTime = audio.end_at;     // Replace with your logic to calculate end time&#xA;            audioTags.push(`[delayed${index}]`);&#xA;            // Working&#xA;            // return `[${index &#x2B; 1}:a]atrim=start=0:end=${(endTime - startTime) / 1000},adelay=${startTime}[delayed${index}]`;&#xA;            return `[${index &#x2B; 1}:a]dynaudnorm=p=0.9:m=100:s=5,atrim=start=0:end=${(endTime - startTime) / 1000},adelay=${startTime}[delayed${index}]`;&#xA;        });&#xA;        &#xA;        // Concatenate the delayed audio streams&#xA;        const concatFilter = audioFilters.join(&#x27;;&#x27;);&#xA;        &#xA;        // Mix the concatenated audio streams&#xA;        const mixFilter = `${concatFilter};[0:a]${audioTags.join(&#x27;&#x27;)}amix=inputs=${audios.length &#x2B; 1}:duration=first:dropout_transition=2[out]`;&#xA;&#xA;        // Set the complex filter for ffmpeg&#xA;        command.complexFilter([mixFilter]);&#xA;&#xA;        // Set the output size&#xA;        if (!isScreen) {&#xA;            command.videoFilter(&#x27;scale=720:-1&#x27;);&#xA;        }&#xA;        else {&#xA;            command.videoFilter(&#x27;scale=1920:-1&#x27;);&#xA;        }&#xA;&#xA;        // Set input options&#xA;        command.inputOptions([&#xA;            &#x27;-analyzeduration 20M&#x27;,&#xA;            &#x27;-probesize 100M&#x27;&#xA;        ]);&#xA;&#xA;        // Set output options&#xA;        command.outputOptions([&#xA;            &#x27;-c:v libx264&#x27;, // Specify a video codec&#xA;            &#x27;-c:a aac&#x27;,&#xA;            &#x27;-map 0:v&#x27;,      // Map the video stream from the first input&#xA;            &#x27;-map [out]&#x27;     // Map the audio stream from the complex filter&#xA;        ]);&#xA;&#xA;        // Set the output format&#xA;        command.toFormat(&#x27;mp4&#x27;);&#xA;&#xA;        // Set the output file path&#xA;        command.output(outputFilePath);&#xA;&#xA;        // Event handling&#xA;        command&#xA;            .on(&#x27;start&#x27;, commandLine => {&#xA;                console.log(&#x27;Spawned Ffmpeg with command: &#x27; &#x2B; commandLine);&#xA;            })&#xA;            .on(&#x27;codecData&#x27;, data => {&#xA;                console.log(&#x27;Input is &#x27; &#x2B; data.audio &#x2B; &#x27; audio &#x27; &#x2B;&#xA;                &#x27;with &#x27; &#x2B; data.video &#x2B; &#x27; video&#x27;);&#xA;            })&#xA;            .on(&#x27;progress&#x27;, progress => {&#xA;                // console.log(&#x27;progress: &#x27;, progress);&#xA;                console.log(`Processing: ${&#xA;                    progress.percent ?&#xA;                    progress.percent.toFixed(2)&#xA;                    :&#xA;                    &#x27;0.00&#x27;&#xA;                }% done`);&#xA;            })&#xA;            .on(&#x27;stderr&#x27;, stderrLine => {&#xA;                console.log(&#x27;Stderr output: &#x27; &#x2B; stderrLine);&#xA;            })&#xA;            .on(&#x27;error&#x27;, (err, stdout, stderr) => {&#xA;                console.error(&#x27;Error merging streams:&#x27;, err);&#xA;                console.error(&#x27;ffmpeg stdout:&#x27;, stdout);&#xA;                console.error(&#x27;ffmpeg stderr:&#x27;, stderr);&#xA;                reject(err);&#xA;            })&#xA;            .on(&#x27;end&#x27;, () => {&#xA;                console.log(&#x27;Merging finished successfully.&#x27;);&#xA;                const file = fs.readFileSync(outputFilePath);&#xA;                console.log(&#x27;File read successfully.&#x27;);&#xA;                setTimeout(() => {&#xA;                    fs.unlinkSync(outputFilePath);&#xA;                    console.log(&#x27;Output file deleted successfully.&#x27;);&#xA;                    fs.unlinkSync(mp4Path);&#xA;                    console.log(&#x27;MP4 file deleted successfully.&#x27;);&#xA;                    console.log(&#x27;mp3Paths: &#x27;, mp3Paths);&#xA;                    for (let mp3Path of mp3Paths) {&#xA;                        fs.unlinkSync(mp3Path);&#xA;                    }&#xA;                    console.log(&#x27;MP3 file deleted successfully.&#x27;);&#xA;                    if (isScreen) {&#xA;                        for (let path of pathsScreen) {&#xA;                            fs.unlinkSync(path);&#xA;                        }&#xA;                    }&#xA;                    else {&#xA;                        for (let path of pathsCamera) {&#xA;                            fs.unlinkSync(path);&#xA;                        }&#xA;                    }&#xA;                    console.log(&#x27;All temp files deleted successfully.&#x27;);&#xA;                }, 3000);&#xA;                resolve(file);&#xA;            });&#xA;        &#xA;        // Run the command&#xA;        command.run();&#xA;

    &#xA;

    This is how I am merging my video files (which is an array of webm files) right now. It seems this command is causing the volume of the video gradually increase from the beginning to the end (the earlier part of the video has much lower volume than later part of the video). How should I fix this ?

    &#xA;

    Things tried and investigated so far :

    &#xA;

      &#xA;
    • I have checked the original video, it does not have the volume issue. So the volume issue was caused by this piece of code without an doubt.
    • &#xA;

    • I have tried dynaudnorm, not fully understanding how it works, though. Adding it to each of the audio file does not fix this issue, and adding it as a separated filter at the end of the combined filter string would break the session.
    • &#xA;

    &#xA;