Recherche avancée

Médias (3)

Mot : - Tags -/spip

Autres articles (17)

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

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Diogene : création de masques spécifiques de formulaires d’édition de contenus

    26 octobre 2010, par

    Diogene est un des plugins ? SPIP activé par défaut (extension) lors de l’initialisation de MediaSPIP.
    A quoi sert ce plugin
    Création de masques de formulaires
    Le plugin Diogène permet de créer des masques de formulaires spécifiques par secteur sur les trois objets spécifiques SPIP que sont : les articles ; les rubriques ; les sites
    Il permet ainsi de définir en fonction d’un secteur particulier, un masque de formulaire par objet, ajoutant ou enlevant ainsi des champs afin de rendre le formulaire (...)

Sur d’autres sites (4160)

  • How to check if streamed MP4/MOV from HTTP is streamable ?

    21 septembre 2021, par DarkLordCoder

    I'm using ffmpeg (ffmpeg-fluent) and nodejs.

    


    I was wondering if there is a way to check if MP4/MOV uploaded by users is actually streamable / has moov faststart or not ?

    


    The server most likely doesn't have all video file content yet. So I'm using Readable Stream (per Express) for that and not as file path or as completed binary/buffer.

    


    So then very large video file can be uploaded while on server it can already check if the video file is streamable or not.

    


    Reason why I can't store it in server is because we don't have much storage in our server and we want to allow user uploading very large video. So everything is handled with stream (and then the file will be streamed/uploaded directly to other server where it will be stored.)

    


    Any idea ?

    


    Thank You !

    


  • how to add audio using ffmpeg when recording video from browser and streaming to Youtube/Twitch ?

    26 juillet 2021, par Tosh Velaga

    I have a web application I am working on that allows the user to stream video from their browser and simultaneously livestream to both Youtube and Twitch using ffmpeg. The application works fine when I don't need to send any of the audio. Currently I am getting the error below when I try to record video and audio. I am new to using ffmpeg and so any help would be greatly appreciated. Here is also my repo if needed : https://github.com/toshvelaga/livestream Node Server

    


    Here is my node.js server with ffmpeg

    


    const child_process = require('child_process') // To be used later for running FFmpeg
const express = require('express')
const http = require('http')
const WebSocketServer = require('ws').Server
const NodeMediaServer = require('node-media-server')
const app = express()
const cors = require('cors')
const path = require('path')
const logger = require('morgan')
require('dotenv').config()

app.use(logger('dev'))
app.use(cors())

app.use(express.json({ limit: '200mb', extended: true }))
app.use(
  express.urlencoded({ limit: '200mb', extended: true, parameterLimit: 50000 })
)

var authRouter = require('./routes/auth')
var compareCodeRouter = require('./routes/compareCode')

app.use('/', authRouter)
app.use('/', compareCodeRouter)

if (process.env.NODE_ENV === 'production') {
  // serve static content
  // npm run build
  app.use(express.static(path.join(__dirname, 'client/build')))

  app.get('*', (req, res) => {
    res.sendFile(path.join(__dirname, 'client/build', 'index.html'))
  })
}

const PORT = process.env.PORT || 8080

app.listen(PORT, () => {
  console.log(`Server is starting on port ${PORT}`)
})

const server = http.createServer(app).listen(3000, () => {
  console.log('Listening on PORT 3000...')
})


const wss = new WebSocketServer({
  server: server,
})

wss.on('connection', (ws, req) => {
  const ffmpeg = child_process.spawn('ffmpeg', [
    // works fine when I use this but when I need audio problems arise
    // '-f',
    // 'lavfi',
    // '-i',
    // 'anullsrc',

    '-i',
    '-',

    '-f',
    'flv',
    '-c',
    'copy',
    `${process.env.TWITCH_STREAM_ADDRESS}`,
    '-f',
    'flv',
    '-c',
    'copy',
    `${process.env.YOUTUBE_STREAM_ADDRESS}`,
    // '-f',
    // 'flv',
    // '-c',
    // 'copy',
    // `${process.env.FACEBOOK_STREAM_ADDRESS}`,
  ])

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

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

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

  ws.on('message', (msg) => {
    console.log('DATA', msg)
    ffmpeg.stdin.write(msg)
  })

  ws.on('close', (e) => {
    console.log('kill: SIGINT')
    ffmpeg.kill('SIGINT')
  })
})

const config = {
  rtmp: {
    port: 1935,
    chunk_size: 60000,
    gop_cache: true,
    ping: 30,
    ping_timeout: 60,
  },
  http: {
    port: 8000,
    allow_origin: '*',
  },
}

var nms = new NodeMediaServer(config)
nms.run()


    


    Here is my frontend code that records the video/audio and sends to server :

    


    import React, { useState, useEffect, useRef } from &#x27;react&#x27;&#xA;import Navbar from &#x27;../../components/Navbar/Navbar&#x27;&#xA;import &#x27;./Dashboard.css&#x27;&#xA;&#xA;const CAPTURE_OPTIONS = {&#xA;  audio: true,&#xA;  video: true,&#xA;}&#xA;&#xA;function Dashboard() {&#xA;  const [mute, setMute] = useState(false)&#xA;  const videoRef = useRef()&#xA;  const ws = useRef()&#xA;  const mediaStream = useUserMedia(CAPTURE_OPTIONS)&#xA;&#xA;  let liveStream&#xA;  let liveStreamRecorder&#xA;&#xA;  if (mediaStream &amp;&amp; videoRef.current &amp;&amp; !videoRef.current.srcObject) {&#xA;    videoRef.current.srcObject = mediaStream&#xA;  }&#xA;&#xA;  const handleCanPlay = () => {&#xA;    videoRef.current.play()&#xA;  }&#xA;&#xA;  useEffect(() => {&#xA;    ws.current = new WebSocket(&#xA;      window.location.protocol.replace(&#x27;http&#x27;, &#x27;ws&#x27;) &#x2B;&#xA;        &#x27;//&#x27; &#x2B; // http: -> ws:, https: -> wss:&#xA;        &#x27;localhost:3000&#x27;&#xA;    )&#xA;&#xA;    ws.current.onopen = () => {&#xA;      console.log(&#x27;WebSocket Open&#x27;)&#xA;    }&#xA;&#xA;    return () => {&#xA;      ws.current.close()&#xA;    }&#xA;  }, [])&#xA;&#xA;  const startStream = () => {&#xA;    liveStream = videoRef.current.captureStream(30) // 30 FPS&#xA;    liveStreamRecorder = new MediaRecorder(liveStream, {&#xA;      mimeType: &#x27;video/webm;codecs=h264&#x27;,&#xA;      videoBitsPerSecond: 3 * 1024 * 1024,&#xA;    })&#xA;    liveStreamRecorder.ondataavailable = (e) => {&#xA;      ws.current.send(e.data)&#xA;      console.log(&#x27;send data&#x27;, e.data)&#xA;    }&#xA;    // Start recording, and dump data every second&#xA;    liveStreamRecorder.start(1000)&#xA;  }&#xA;&#xA;  const stopStream = () => {&#xA;    liveStreamRecorder.stop()&#xA;    ws.current.close()&#xA;  }&#xA;&#xA;  const toggleMute = () => {&#xA;    setMute(!mute)&#xA;  }&#xA;&#xA;  return (&#xA;    &lt;>&#xA;      <navbar></navbar>&#xA;      <div style="{{" classname="&#x27;main&#x27;">&#xA;        <div>&#xA;          &#xA;        </div>&#xA;        <div classname="&#x27;button-container&#x27;">&#xA;          <button>Go Live</button>&#xA;          <button>Stop Recording</button>&#xA;          <button>Share Screen</button>&#xA;          <button>Mute</button>&#xA;        </div>&#xA;      </div>&#xA;    >&#xA;  )&#xA;}&#xA;&#xA;const useUserMedia = (requestedMedia) => {&#xA;  const [mediaStream, setMediaStream] = useState(null)&#xA;&#xA;  useEffect(() => {&#xA;    async function enableStream() {&#xA;      try {&#xA;        const stream = await navigator.mediaDevices.getUserMedia(requestedMedia)&#xA;        setMediaStream(stream)&#xA;      } catch (err) {&#xA;        console.log(err)&#xA;      }&#xA;    }&#xA;&#xA;    if (!mediaStream) {&#xA;      enableStream()&#xA;    } else {&#xA;      return function cleanup() {&#xA;        mediaStream.getVideoTracks().forEach((track) => {&#xA;          track.stop()&#xA;        })&#xA;      }&#xA;    }&#xA;  }, [mediaStream, requestedMedia])&#xA;&#xA;  return mediaStream&#xA;}&#xA;&#xA;export default Dashboard&#xA;

    &#xA;

  • Unhandled stream error in pipe : write EPIPE in Node.js

    13 juillet 2020, par Michael Romanenko

    The idea is to serve screenshots of RTSP video stream with Express.js server. There is a continuously running spawned openRTSP process in flowing mode (it's stdout is consumed by another ffmpeg process) :

    &#xA;&#xA;

    function spawnProcesses (camera) {&#xA;  var openRTSP = spawn(&#x27;openRTSP&#x27;, [&#x27;-c&#x27;, &#x27;-v&#x27;, &#x27;-t&#x27;, camera.rtsp_url]),&#xA;      encoder = spawn(&#x27;ffmpeg&#x27;, [&#x27;-i&#x27;, &#x27;pipe:&#x27;, &#x27;-an&#x27;, &#x27;-vcodec&#x27;, &#x27;libvpx&#x27;, &#x27;-r&#x27;, 10, &#x27;-f&#x27;, &#x27;webm&#x27;, &#x27;pipe:1&#x27;]);&#xA;&#xA;  openRTSP.stdout.pipe(encoder.stdin);&#xA;&#xA;  openRTSP.on(&#x27;close&#x27;, function (code) {&#xA;    if (code !== 0) {&#xA;      console.log(&#x27;Encoder process exited with code &#x27; &#x2B; code);&#xA;    }&#xA;  });&#xA;&#xA;  encoder.on(&#x27;close&#x27;, function (code) {&#xA;    if (code !== 0) {&#xA;      console.log(&#x27;Encoder process exited with code &#x27; &#x2B; code);&#xA;    }&#xA;  });&#xA;&#xA;  return { rtsp: openRTSP, encoder: encoder };&#xA;}&#xA;&#xA;...&#xA;&#xA;camera.proc = spawnProcesses(camera);&#xA;

    &#xA;&#xA;

    There is an Express server with single route :

    &#xA;&#xA;

    app.get(&#x27;/cameras/:id.jpg&#x27;, function(req, res){&#xA;  var camera = _.find(cameras, {id: parseInt(req.params.id, 10)});&#xA;  if (camera) {&#xA;    res.set({&#x27;Content-Type&#x27;: &#x27;image/jpeg&#x27;});&#xA;    var ffmpeg = spawn(&#x27;ffmpeg&#x27;, [&#x27;-i&#x27;, &#x27;pipe:&#x27;, &#x27;-an&#x27;, &#x27;-vframes&#x27;, &#x27;1&#x27;, &#x27;-s&#x27;, &#x27;800x600&#x27;, &#x27;-f&#x27;, &#x27;image2&#x27;, &#x27;pipe:1&#x27;]);&#xA;    camera.proc.rtsp.stdout.pipe(ffmpeg.stdin);&#xA;    ffmpeg.stdout.pipe(res);&#xA;  } else {&#xA;    res.status(404).send(&#x27;Not found&#x27;);&#xA;  }&#xA;});&#xA;&#xA;app.listen(3333);&#xA;

    &#xA;&#xA;

    When i request http://localhost:3333/cameras/1.jpg i get desired image, but from time to time app breaks with error :

    &#xA;&#xA;

    stream.js:94&#xA;  throw er; // Unhandled stream error in pipe.&#xA;        ^&#xA;Error: write EPIPE&#xA;    at errnoException (net.js:901:11)&#xA;    at Object.afterWrite (net.js:718:19)&#xA;

    &#xA;&#xA;

    Strange thing is that sometimes it successfully streams image to res stream and closes child process without any error, but, sometimes, streams image and falls down.

    &#xA;&#xA;

    I tried to create on(&#x27;error&#x27;, ...) event handlers on every possible stream, tried to change pipe(...) calls to on(&#x27;data&#x27;,...) constructions, but could not succeed.

    &#xA;&#xA;

    My environment : node v0.10.22, OSX Mavericks 10.9.

    &#xA;&#xA;

    UPDATE :

    &#xA;&#xA;

    I wrapped spawn(&#x27;ffmpeg&#x27;,... block with try-catch :

    &#xA;&#xA;

    app.get(&#x27;/cameras/:id.jpg&#x27;, function(req, res){&#xA;....&#xA;    try {&#xA;      var ffmpeg = spawn(&#x27;ffmpeg&#x27;, [&#x27;-i&#x27;, &#x27;pipe:&#x27;, &#x27;-an&#x27;, &#x27;-vframes&#x27;, &#x27;1&#x27;, &#x27;-s&#x27;, &#x27;800x600&#x27;, &#x27;-f&#x27;, &#x27;image2&#x27;, &#x27;pipe:1&#x27;]);&#xA;      camera.proc.rtsp.stdout.pipe(ffmpeg.stdin);&#xA;      ffmpeg.stdout.pipe(res);&#xA;    } catch (e) {&#xA;      console.log("Gotcha!", e);&#xA;    }&#xA;....&#xA;});&#xA;

    &#xA;&#xA;

    ... and this error disappeared, but log is silent, it doesn't catch any errors. What's wrong ?

    &#xA;