Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP

Autres articles (73)

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

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

Sur d’autres sites (3405)

  • Run docker container with FFMPEG rstp stream on websockets

    18 février, par bmvr

    I have create a node js application that uses ffmpeg with spawn node library.

    


    Here's the backend sample :

    


    const startStreamWs = (cameraId, rtsp_url) => {
  console.log(`Starting stream for camera: ${cameraId}`);

  const ffmpeg = spawn("ffmpeg", [
    "-rtsp_transport", "tcp", // Use TCP for reliable streaming
    "-i", rtsp_url,
    "-analyzeduration", "5000000",  // Increase analyzeduration
    "-probesize", "5000000",       // Increase probesize
    "-fflags", "nobuffer",         // Reduce buffering
    "-flags", "low_delay",         // Low latency
    "-strict", "experimental",
    "-max_delay", "200000",        // Reduce max delay for faster response
    "-bufsize", "2M",              // Buffer size for smoother streaming
    "-f", "mpegts",                // MPEG-TS container for streaming
    "-codec:v", "mpeg1video",         // MPEG-1 video codec
    "-s", "1280x720",              // Video resolution
    "-r", "25",                    // Frame rate (25 fps)
    "-b:v", "1500k",               // Bitrate for video
    "-maxrate", "2000k",           // Maximum bitrate
    "-bufsize", "2M",              // Buffer size (needed with maxrate)
    "-bf", "0",                    // Disable B-frames for lower latency
    "-an",                         // Disable audio
    "-"
]);


  ffmpeg.stdout.on("data", (data) => {
    if (cameraStreams[cameraId]) {
      console.log(`Data sent for camera ${cameraId}`);
      // Broadcast stream data to all connected clients
      for (const client of cameraStreams[cameraId].clients) {
        if (client.readyState === ws.OPEN) {
          client.send(data);
        }
      }
    }
  });

  ffmpeg.stderr.on("data", (data) => {
    console.error(`FFmpeg stderr (Camera ${cameraId}): ${data.toString()}`);
    logErrorToFile(data);
  });

  ffmpeg.on("close", (code) => {
    console.log(`FFmpeg process exited for Camera ${cameraId} with code ${code}`);
    if (cameraStreams[cameraId]) {
      // Close all remaining clients
      for (const client of cameraStreams[cameraId].clients) {
        client.close();
      }
      delete cameraStreams[cameraId];
    }
  });

  return ffmpeg;
};


    


    Front End Sample my angular component

    


    import { Component, OnDestroy, OnInit } from &#x27;@angular/core&#x27;;&#xA;import { FormsModule } from &#x27;@angular/forms&#x27;;&#xA;import { ActivatedRoute } from &#x27;@angular/router&#x27;;&#xA;&#xA;declare var JSMpeg: any; // Declare JSMpeg from the global script&#xA;&#xA;@Component({&#xA;  selector: &#x27;app-video-player&#x27;,&#xA;  templateUrl: &#x27;./video-player.component.html&#x27;,&#xA;  styleUrls: [&#x27;./video-player.component.css&#x27;],&#xA;  standalone: false&#xA;})&#xA;export class VideoPlayerComponent implements OnInit, OnDestroy {&#xA;  stepSize: number = 0.1;&#xA;  private player: any;&#xA;  cameraId: string | null = null;&#xA;  ws: WebSocket | null = null; &#xA;  wsUrl: string | null = null;&#xA;&#xA;  constructor(private route: ActivatedRoute) {&#xA;    this.cameraId = this.route.snapshot.paramMap.get(&#x27;id&#x27;);&#xA;    this.wsUrl = `ws://localhost:8085?cameraId=${this.cameraId}`;&#xA;    this.ws = new WebSocket(this.wsUrl);&#xA;  }&#xA;&#xA;  async ngOnInit(): Promise<void> {&#xA;    const canvas = document.getElementById(&#x27;videoCanvas&#x27;) as HTMLCanvasElement;&#xA;    this.player = new JSMpeg.Player(this.wsUrl, { canvas: canvas });&#xA;  }&#xA;&#xA;  async ngOnDestroy(): Promise<void> {&#xA;    this.ws?.close(1000, "Exiting");&#xA;  }&#xA;&#xA;  getStepSize(): number {&#xA;    return this.stepSize;&#xA;  }&#xA;}&#xA;&#xA;&#xA;</void></void>

    &#xA;

    On localhost is fine, once i containerize, it's not. I can serve the website but not the stream.&#xA;I have the same version FFMPEG 7.1 and the codec is available.&#xA;Although I run localhost macosx and unbutu on docker.

    &#xA;

  • Video Conferencing in HTML5 : WebRTC via Web Sockets

    14 juin 2012, par silvia

    A bit over a week ago I gave a presentation at Web Directions Code 2012 in Melbourne. Maxine and John asked me to speak about something related to HTML5 video, so I went for the new shiny : WebRTC – real-time communication in the browser.

    Presentation slides

    I only had 20 min, so I had to make it tight. I wanted to show off video conferencing without special plugins in Google Chrome in just a few lines of code, as is the promise of WebRTC. To a large extent, I achieved this. But I made some interesting discoveries along the way. Demos are in the slide deck.

    UPDATE : Opera 12 has been released with WebRTC support.

    Housekeeping : if you want to replicate what I have done, you need to install a Google Chrome Web Browser 19+. Then make sure you go to chrome ://flags and activate the MediaStream and PeerConnection experiment(s). Restart your browser and now you can experiment with this feature. Big warning up-front : it’s not production-ready, since there are still changes happening to the spec and there is no compatible implementation by another browser yet.

    Here is a brief summary of the steps involved to set up video conferencing in your browser :

    1. Set up a video element each for the local and the remote video stream.
    2. Grab the local camera and stream it to the first video element.
    3. (*) Establish a connection to another person running the same Web page.
    4. Send the local camera stream on that peer connection.
    5. Accept the remote camera stream into the second video element.

    Now, the most difficult part of all of this – believe it or not – is the signalling part that is required to build the peer connection (marked with (*)). Initially I wanted to run completely without a server and just enter the remote’s IP address to establish the connection. This is, however, not a functionality that the PeerConnection object provides [might this be something to add to the spec ?].

    So, you need a server known to both parties that can provide for the handshake to set up the connection. All the examples that I have seen, such as https://apprtc.appspot.com/, use a channel management server on Google’s appengine. I wanted it all working with HTML5 technology, so I decided to use a Web Socket server instead.

    I implemented my Web Socket server using node.js (code of websocket server). The video conferencing demo is in the slide deck in an iframe – you can also use the stand-alone html page. Works like a treat.

    While it is still using Google’s STUN server to get through NAT, the messaging for setting up the connection is running completely through the Web Socket server. The messages that get exchanged are plain SDP message packets with a session ID. There are OFFER, ANSWER, and OK packets exchanged for each streaming direction. You can see some of it in the below image :

    WebRTC demo

    I’m not running a public WebSocket server, so you won’t be able to see this part of the presentation working. But the local loopback video should work.

    At the conference, it all went without a hitch (while the wireless played along). I believe you have to host the WebSocket server on the same machine as the Web page, otherwise it won’t work for security reasons.

    A whole new world of opportunities lies out there when we get the ability to set up video conferencing on every Web page – scary and exciting at the same time !

  • Video Conferencing in HTML5 : WebRTC via Web Sockets

    1er janvier 2014, par silvia

    A bit over a week ago I gave a presentation at Web Directions Code 2012 in Melbourne. Maxine and John asked me to speak about something related to HTML5 video, so I went for the new shiny : WebRTC – real-time communication in the browser.

    Presentation slides

    I only had 20 min, so I had to make it tight. I wanted to show off video conferencing without special plugins in Google Chrome in just a few lines of code, as is the promise of WebRTC. To a large extent, I achieved this. But I made some interesting discoveries along the way. Demos are in the slide deck.

    UPDATE : Opera 12 has been released with WebRTC support.

    Housekeeping : if you want to replicate what I have done, you need to install a Google Chrome Web Browser 19+. Then make sure you go to chrome ://flags and activate the MediaStream and PeerConnection experiment(s). Restart your browser and now you can experiment with this feature. Big warning up-front : it’s not production-ready, since there are still changes happening to the spec and there is no compatible implementation by another browser yet.

    Here is a brief summary of the steps involved to set up video conferencing in your browser :

    1. Set up a video element each for the local and the remote video stream.
    2. Grab the local camera and stream it to the first video element.
    3. (*) Establish a connection to another person running the same Web page.
    4. Send the local camera stream on that peer connection.
    5. Accept the remote camera stream into the second video element.

    Now, the most difficult part of all of this – believe it or not – is the signalling part that is required to build the peer connection (marked with (*)). Initially I wanted to run completely without a server and just enter the remote’s IP address to establish the connection. This is, however, not a functionality that the PeerConnection object provides [might this be something to add to the spec ?].

    So, you need a server known to both parties that can provide for the handshake to set up the connection. All the examples that I have seen, such as https://apprtc.appspot.com/, use a channel management server on Google’s appengine. I wanted it all working with HTML5 technology, so I decided to use a Web Socket server instead.

    I implemented my Web Socket server using node.js (code of websocket server). The video conferencing demo is in the slide deck in an iframe – you can also use the stand-alone html page. Works like a treat.

    While it is still using Google’s STUN server to get through NAT, the messaging for setting up the connection is running completely through the Web Socket server. The messages that get exchanged are plain SDP message packets with a session ID. There are OFFER, ANSWER, and OK packets exchanged for each streaming direction. You can see some of it in the below image :

    WebRTC demo

    I’m not running a public WebSocket server, so you won’t be able to see this part of the presentation working. But the local loopback video should work.

    At the conference, it all went without a hitch (while the wireless played along). I believe you have to host the WebSocket server on the same machine as the Web page, otherwise it won’t work for security reasons.

    A whole new world of opportunities lies out there when we get the ability to set up video conferencing on every Web page – scary and exciting at the same time !