
Recherche avancée
Autres articles (38)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
MediaSPIP Player : les contrôles
26 mai 2010, parLes contrôles à la souris du lecteur
En plus des actions au click sur les boutons visibles de l’interface du lecteur, il est également possible d’effectuer d’autres actions grâce à la souris : Click : en cliquant sur la vidéo ou sur le logo du son, celui ci se mettra en lecture ou en pause en fonction de son état actuel ; Molette (roulement) : en plaçant la souris sur l’espace utilisé par le média (hover), la molette de la souris n’exerce plus l’effet habituel de scroll de la page, mais diminue ou (...) -
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP 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 (4649)
-
Save video to disk from WebRTC MediaStream in Node
27 novembre 2020, par SAGBO AiméI'm building an app where the user can connect to the server through a WebRTC (I'm using simple-peer library both server-side and client-side to set the peer-to-peer connection).
Once the client and the server are connected, the client app stream the user camera and micro to the server.


Now, I want to save the streamed data to the filesystem server-side as an MP4 video file.


I hear about ffmpeg and fluent-ffmpeg to achieve this but i don't know how to use them.


- 

- Server side code to set up the peer connection




const Peer = require("simple-peer");
const wrtc = require("wrtc");

const peer = new Peer({ initiator: false, wrtc: wrtc, trickle: false });

peer.on("error", (err: any) => console.log("error", err));

 peer.on("signal", (data: any) => {
 if (data.type === "offer" || data.type === "answer")
 dispatchMessage(JSON.stringify(data));
 // if (data.renegotiate || data.transceiverRequest) return;
 });

 peer.on("connect", () => {
 console.log("CONNECTED");
 peer.send(JSON.stringify("HELLO DEER PEER FROM SERVER"));
 });

 peer.on("data", (data: any) => {
 console.log("data: ", data);
 });

 peer.on("stream", (stream: MediaStream) => {
 console.log("-------Stream received", stream);
 });

 peer.on("track", (track: MediaStreamTrack) => {
 console.log("-------trackEvent:", track);
 });



- 

- Client-side code




const stream = await window.navigator.mediaDevices.getUserMedia({
 video: { width: { ideal: 4096 }, height: { ideal: 2160 }},
 audio: true,
});

const p = new SimplePeer({
 initiator: isInitiator, 
 trickle: false 
});

stream.getTracks().forEach(track => p.addTrack(
 track, 
 stream 
));

// Here I set up the listeners for the peer connection



-
ffmpeg legitimate decoding errors
20 juillet 2017, par Gideon OduroMy issue is as follows, i’m sending a H.264 encoded video captured with the help of WebRTC over WebSocket. The idea is to perform server side analysis and object tracking.
navigator.mediaDevices.getUserMedia(constraint).then((stream) => {
isVideoElement(target, stream)
mediaRecorder = recorder(stream, {mimeType: 'video/webm; codecs=H264'})
mediaRecorder.ondataavailable = (blob) => socket.send(blob.data)
mediaRecorder.start('2000');
})On the server side, data is being received as ByteBuffer :
override fun handleBinaryMessage(session: WebSocketSession, msg: BinaryMessage) {
analysis(msg.payload)
}Im using the following resources (resource_1, resource_2) to try to convert my ByteBuffer to a OpenCv frame :
fun startPreview(data: ByteBuffer) {
avcodec_register_all()
val pack = avcodec.AVPacket()
pack.data(BytePointer(data))
avcodec.av_init_packet(pack)
val videoData = BytePointer(data)
val codec = avcodec.avcodec_find_decoder(avcodec.AV_CODEC_ID_H264)
val videoCodecContext = avcodec.avcodec_alloc_context3(codec)
videoCodecContext.width(1280)
videoCodecContext.height(720)
videoCodecContext.pix_fmt(avutil.AV_PIX_FMT_YUV420P)
videoCodecContext.codec_type(avutil.AVMEDIA_TYPE_VIDEO)
videoCodecContext.extradata(videoData)
videoCodecContext.extradata_size(data.capacity())
videoCodecContext.flags2(videoCodecContext.flags2() or avcodec.CODEC_FLAG2_CHUNKS)
avcodec.avcodec_open2(videoCodecContext, codec, null as PointerPointer<*>?)
val decodedFrameLength = avcodec.avcodec_receive_frame(videoCodecContext, avutil.AVFrame())
println(decodedFrameLength)
}Im then receiving decodedFrameLength of -35 indicating a decoding error, cant figure out how to proceed from here ?
-
No audio output using FFmpeg
26 mars 2022, par John Mergene ArellanoI am having problem on Live stream output. I am streaming from mobile app to Node JS server to RTMP. Video output of the live stream is working but not the audio. There is no audio output from live stream.


From my client side, I am sending a stream using the Socket.IO library. I captured the video and audio using getUserMedia API.


navigator.mediaDevices.getUserMedia(constraints).then((stream) => {
 window.videoStream = video.srcObject = stream;
 let mediaRecorder = new MediaRecorder(stream, {
 videoBitsPerSecond : 3 * 1024 * 1024
 });
 mediaRecorder.addEventListener('dataavailable', (e) => {
 let data = e.data;
 socket.emit('live', data);
 });
 mediaRecorder.start(1000);
});



Then my server will receive the stream and write it to FFmpeg.


client.on('live', (stream)=>{
 if(ffmpeg)
 ffmpeg.stdin.write(stream);
});



I tried watching the live video in VLC media player. There is a 5 seconds delay and no audio output.


Please see below for FFmpeg options I used :


ffmpeg = this.CHILD_PROCESS.spawn("ffmpeg", [
 '-f',
 'lavfi',
 '-i', 'anullsrc',
 '-i','-',
 '-c:v', 'libx264', '-preset', 'veryfast', '-tune', 'zerolatency',
 '-c:a', 'aac', '-ar', '44100', '-b:a', '64k',
 '-y', //force to overwrite
 '-use_wallclock_as_timestamps', '1', // used for audio sync
 '-async', '1', // used for audio sync
 '-bufsize', '1000',
 '-f',
 'flv',
 `rtmp://127.0.0.1:1935/live/stream` ]);



What is wrong with my setup ? I need to fix the command so that the live stream will output both video and audio.


I tried streaming to youtube RTMP but still no audio. I am expecting to have an output of video and audio from the getUserMedia API.


What is wrong with my setup ? I need to fix the command so that the live stream will output both video and audio.


I tried streaming to youtube RTMP but still no audio. I am expecting to have an output of video and audio from the getUserMedia API.