Recherche avancée

Médias (1)

Mot : - Tags -/bug

Autres articles (54)

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

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

Sur d’autres sites (9062)

  • How to create a video file webm from chunks by media recorder api using ffmpeg

    17 octobre 2020, par Caio Nakai

    I'm trying to create a webm video file from blobs generated by MediaRecorderAPI in a NodeJS server using FFMPEG. I'm able to create the .webm file but it's not playable, I ran this command $ ffmpeg.exe -v error -i lel.webm -f null - >error.log 2>&1 to generate an error log, the error log file contains this :

    


    


    [null @ 000002ce7501de40] Application provided invalid, non monotonically increasing dts to muxer in stream 0 : 1 >= 1

    


    [h264 @ 000002ce74a727c0] Invalid NAL unit size (804 > 74).

    


    [h264 @ 000002ce74a727c0] Error splitting the input into NAL units.

    


    Error while decoding stream #0:0 : Invalid data found when processing input

    


    


    This is my web server code

    


    const app = require("express")();
const http = require("http").createServer(app);
const io = require("socket.io")(http);
const fs = require("fs");
const child_process = require("child_process");

app.get("/", (req, res) => {
  res.sendFile(__dirname + "/index.html");
});

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

  const ffmpeg = child_process.spawn("ffmpeg", [
    "-i",
    "-",
    "-vcodec",
    "copy",
    "-f",
    "flv",
    "rtmpUrl.webm",
  ]);

  ffmpeg.on("close", (code, signal) => {
    console.log(
      "FFmpeg child process closed, code " + code + ", signal " + signal
    );
  });

  ffmpeg.stdin.on("error", (e) => {
    console.log("FFmpeg STDIN Error", e);
  });

  ffmpeg.stderr.on("data", (data) => {
    console.log("FFmpeg STDERR:", data.toString());
  });

  socket.on("message", (msg) => {
    console.log("Writing blob! ");
    ffmpeg.stdin.write(msg);
  });

  socket.on("stop", () => {
    console.log("Stop recording..");
    ffmpeg.kill("SIGINT");
  });
});

http.listen(3000, () => {
  console.log("listening on *:3000");
});



    


    And this is my client code, using HTML, JS :

    


    &#xA;&#xA;  &#xA;    &#xA;    &#xA;    &#xA;  &#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;    let mediaRecorder = null;&amp;#xA;    const startRecording = (someStream) =&gt; {&amp;#xA;      const mediaStream = new MediaStream();&amp;#xA;      const videoTrack = someStream.getVideoTracks()[0];&amp;#xA;      const audioTrack = someStream.getAudioTracks()[0];&amp;#xA;      console.log(&quot;Video trac &quot;, videoTrack);&amp;#xA;      console.log(&quot;audio trac &quot;, audioTrack);&amp;#xA;      mediaStream.addTrack(videoTrack);&amp;#xA;      mediaStream.addTrack(audioTrack);&amp;#xA;&amp;#xA;      const recorderOptions = {&amp;#xA;        mimeType: &quot;video/webm;codecs=h264&quot;,&amp;#xA;        videoBitsPerSecond: 3 * 1024 * 1024,&amp;#xA;      };&amp;#xA;&amp;#xA;      mediaRecorder = new MediaRecorder(mediaStream, recorderOptions);&amp;#xA;      mediaRecorder.start(1000); // 1000 - the number of milliseconds to record into each Blob&amp;#xA;      mediaRecorder.ondataavailable = (event) =&gt; {&amp;#xA;        console.debug(&quot;Got blob data:&quot;, event.data);&amp;#xA;        if (event.data &amp;amp;&amp;amp; event.data.size &gt; 0) {&amp;#xA;          socket.emit(&quot;message&quot;, event.data);&amp;#xA;        }&amp;#xA;      };&amp;#xA;    };&amp;#xA;&amp;#xA;    const getVideoStream = async () =&gt; {&amp;#xA;      try {&amp;#xA;        const stream = await navigator.mediaDevices.getUserMedia({&amp;#xA;          video: true,&amp;#xA;          audio: true,&amp;#xA;        });&amp;#xA;        startRecording(stream);&amp;#xA;        myVideo.srcObject = stream;&amp;#xA;      } catch (e) {&amp;#xA;        console.error(&quot;navigator.getUserMedia error:&quot;, e);&amp;#xA;      }&amp;#xA;    };&amp;#xA;&amp;#xA;    const stopRecording = () =&gt; {&amp;#xA;      mediaRecorder.stop();&amp;#xA;      socket.emit(&quot;stop&quot;);&amp;#xA;    };&amp;#xA;  &lt;/script&gt;&#xA;  &#xA;    
    

    hello world

    &#xA;

    &#xA;

    &#xA;&#xA; &#xA; &lt;script&gt;&amp;#xA;      const myVideo = document.getElementById(&quot;myvideo&quot;);&amp;#xA;      myVideo.muted = true;&amp;#xA;    &lt;/script&gt;&#xA; &#xA;&#xA;&#xA;

    &#xA;

    Any help is appreciated !

    &#xA;

  • NodeJS : Fail to write byte array input from webcam to ffmpeg spawn process

    23 mai 2024, par Thanesh Prabaghan

    I'm using NodeJS server to display an HTML page which has webcam option. Once user visited to my NodeJS server, it will serve html page. User can allow webcam option and see webcam view on the page.

    &#xA;

    In the backend, I send webcam stream (byte array) using socket.io. I receive byte array successfully in backend with the help of socket.io. BUT MY PROBLEM IS, I can't pipe this byte array to the ffmpeg spawn process. I don't know how to properly pipe this data to the ffmpeg. Once it done, all my problem will be solved.

    &#xA;

    On the other side, I have node-media-server as RTMP server to publish this stream to VLC player and other devices. Kindly help me to complete this task. I will attach all my code to this question. Kindly run this in your environment and answer the question.

    &#xA;

    MY HTML PAGE

    &#xA;

    &#xA;&#xA;  &#xA;    &#xA;      &#xA;&#xA;      &#xA;&#xA;      <code class="echappe-js">&lt;script src=&quot;https://cdn.socket.io/4.7.5/socket.io.min.js&quot; &amp;#xA;        integrity=&quot;integrity_code&quot; &amp;#xA;        crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;&#xA;    &#xA;    &#xA;      
    &#xA; &#xA;&#xA; &lt;script&gt;&amp;#xA;          const socket = io(&amp;#x27;http://localhost:8080/&amp;#x27;);&amp;#xA;          var video = document.getElementById(&quot;video&quot;);&amp;#xA;&amp;#xA;          if (navigator.mediaDevices.getUserMedia) {&amp;#xA;            navigator.mediaDevices.getUserMedia({ video: true, audio:true })&amp;#xA;            .then(function (stream) {&amp;#xA;              const recorder = new MediaRecorder(stream);&amp;#xA;&amp;#xA;              recorder.ondataavailable = event =&gt; {&amp;#xA;                socket.emit(&amp;#x27;VideoStream&amp;#x27;, event.data);&amp;#xA;              };&amp;#xA;              recorder.start(1000);      &amp;#xA;              video.srcObject = stream;&amp;#xA;            }).catch(function (error) {&amp;#xA;              console.log(&quot;Something went wrong!&quot;);&amp;#xA;            });&amp;#xA;         }  &amp;#xA;       &lt;/script&gt;&#xA; &#xA;&#xA;&#xA;

    &#xA;

    FFMPEG IMPLEMENTATION

    &#xA;

    const express = require(&#x27;express&#x27;);&#xA;const app = express();&#xA;const http = require(&#x27;http&#x27;);&#xA;const server = http.createServer(app);&#xA;const { Server } = require("socket.io");&#xA;const io = new Server(server);&#xA;const path = require(&#x27;node:path&#x27;); &#xA;const { spawn } = require(&#x27;node:child_process&#x27;);&#xA;&#xA;let cmd = spawn(&#x27;ffmpeg.exe&#x27;, [&#xA;    &#x27;-c:v&#x27;, &#x27;copy&#x27;, &#x27;-preset&#x27;, &#x27;ultrafast&#x27;, &#x27;-tune&#x27;, &#x27;zerolatency&#x27;,&#xA;    &#x27;-c:a&#x27;, &#x27;aac&#x27;, &#x27;-strict&#x27;, &#x27;-2&#x27;, &#x27;-ar&#x27;, &#x27;44100&#x27;, &#x27;-b:a&#x27;, &#x27;64k&#x27;,&#xA;    &#x27;-y&#x27;,&#xA;    &#x27;-use_wallclock_as_timestamps&#x27;, &#x27;1&#x27;,&#xA;    &#x27;-async&#x27;, &#x27;1&#x27;,&#xA;    &#x27;-flush_packets&#x27;, &#x27;1&#x27;,&#xA;    &#x27;-rtbufsize&#x27;, &#x27;1000&#x27;,&#xA;    &#x27;-bufsize&#x27;, &#x27;1000&#x27;,&#xA;    &#x27;-f&#x27;, &#x27;flv&#x27;,&#xA;     &#x27;-i&#x27;,&#x27;-&#x27;,&#xA;    &#x27;rtmp://localhost:1935&#x27;,&#xA;  ]);&#xA;&#xA;app.use(express.static(path.join(__dirname, &#x27;public&#x27;)));&#xA;&#xA;app.get(&#x27;/&#x27;, (req, res) => {&#xA;  res.sendFile(path.join(__dirname &#x2B; &#x27;index.html&#x27;));&#xA;});&#xA;&#xA;io.on(&#x27;connection&#x27;, (socket) => {&#xA;  socket.on("VideoStream", (data) => {&#xA;    cmd.stdin.write(data);&#xA;  });&#xA;});&#xA;&#xA;server.listen(8080, () => {&#xA;  console.log(&#x27;listening on *:8080&#x27;);&#xA;});&#xA;&#xA;```&#xA;**NODE MEDIA SERVER IMPLEMENTATION**&#xA;&#xA;```&#xA;const NodeMediaServer = require(&#x27;node-media-server&#x27;);&#xA;&#xA;const config = {&#xA;  rtmp: {&#xA;    port: 1935,&#xA;    chunk_size: 60000,&#xA;    gop_cache: true,&#xA;    ping: 30,&#xA;    ping_timeout: 60&#xA;  },&#xA;  http: {&#xA;    port: 8000,&#xA;    allow_origin: &#x27;*&#x27;&#xA;  }&#xA;};&#xA;&#xA;var nms = new NodeMediaServer(config)&#xA;nms.run();&#xA;```&#xA;&#xA;&#xA;

    &#xA;

  • Libavcodec "the procedure entry point for av_frame_alloc could not be located" error in Visual Studio 2017 C++ project

    25 novembre 2019, par Aves

    I am trying to use libavcodec from ffmpeg library in C++ with Visual Studio 2017 Community. I downloaded the latest x64 dev and shared builds from zeranoe (version 20171217), set up include directories and additional libraries in Visual Studio for x64 build, added DLL files from shared package to my PATH.

    This is my sample test code :

    extern "C" {
    #include
    }
    int main() {
       avcodec_register_all();
       AVFrame *pAvFrame = av_frame_alloc();
       av_frame_free(&amp;pAvFrame);
       return 0;
    }

    The code compiles without problems but when I run the application I see a dialogue window with error message "the procedure entry point for av_frame_alloc could not be located in DLL" (actual message is not in English, this is the translated version).

    I tried to set Linker->Optimization->References to /OPT:NOREF as it was advised in the similar questions but it did not help.

    Dependency walker shows that av_frame_alloc is exported, "Entry Point" is not bound. A little bit strange is that av_frame_alloc is displayed in both avcodec-58.dll (as red) and avutil-56.dll (as green). Maybe the reason is that the application is trying to get this function from avcodec instead of avutil, but I’m not sure, since I did not check the source code of these libraries.

    So the question is how to set up such a simple FFMPEG-based C++ project in VS2017, where I’m wrong ?

    UPD. 1.

    Linker flags : /OUT :"C :\work\code\TestFfmpeg\x64\Release\TestFfmpeg.exe" /MANIFEST /NXCOMPAT /PDB :"C :\work\code\TestFfmpeg\x64\Release\TestFfmpeg.pdb" /DYNAMICBASE "c :\work\dev\ffmpeg-20171217-387ee1d-win64-dev\lib*.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG:FULL /MACHINE:X64 /OPT:NOREF /PGD :"C :\work\code\TestFfmpeg\x64\Release\TestFfmpeg.pgd" /MANIFESTUAC :"level=’asInvoker’ uiAccess=’false’" /ManifestFile :"x64\Release\TestFfmpeg.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1