
Recherche avancée
Autres articles (88)
-
Configuration spécifique pour PHP5
4 février 2011, parPHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
Modules spécifiques
Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...) -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
-
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang 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.
Sur d’autres sites (3509)
-
NodeJS : Fail to write byte array input from webcam to ffmpeg spawn process
23 mai 2024, par Thanesh PrabaghanI'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.


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

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.

MY HTML PAGE




 
 
 

 

 <code class="echappe-js"><script src="https://cdn.socket.io/4.7.5/socket.io.min.js" &#xA; integrity="integrity_code" &#xA; crossorigin="anonymous"></script>

 
 

 

<script>&#xA; const socket = io(&#x27;http://localhost:8080/&#x27;);&#xA; var video = document.getElementById("video");&#xA;&#xA; if (navigator.mediaDevices.getUserMedia) {&#xA; navigator.mediaDevices.getUserMedia({ video: true, audio:true })&#xA; .then(function (stream) {&#xA; const recorder = new MediaRecorder(stream);&#xA;&#xA; recorder.ondataavailable = event => {&#xA; socket.emit(&#x27;VideoStream&#x27;, event.data);&#xA; };&#xA; recorder.start(1000); &#xA; video.srcObject = stream;&#xA; }).catch(function (error) {&#xA; console.log("Something went wrong!");&#xA; });&#xA; } &#xA; </script>

 




FFMPEG IMPLEMENTATION


const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
const { Server } = require("socket.io");
const io = new Server(server);
const path = require('node:path'); 
const { spawn } = require('node:child_process');

let cmd = spawn('ffmpeg.exe', [
 '-c:v', 'copy', '-preset', 'ultrafast', '-tune', 'zerolatency',
 '-c:a', 'aac', '-strict', '-2', '-ar', '44100', '-b:a', '64k',
 '-y',
 '-use_wallclock_as_timestamps', '1',
 '-async', '1',
 '-flush_packets', '1',
 '-rtbufsize', '1000',
 '-bufsize', '1000',
 '-f', 'flv',
 '-i','-',
 'rtmp://localhost:1935',
 ]);

app.use(express.static(path.join(__dirname, 'public')));

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

io.on('connection', (socket) => {
 socket.on("VideoStream", (data) => {
 cmd.stdin.write(data);
 });
});

server.listen(8080, () => {
 console.log('listening on *:8080');
});

```
**NODE MEDIA SERVER IMPLEMENTATION**

```
const NodeMediaServer = require('node-media-server');

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();
```





-
Cannot merge audio and video streams from ytdl-core
20 août 2022, par Abhigyan KumarI am trying to merge ytdl-core video only and audio only streams and sending the merged stream are response to user (for download in browser). With JavaScript only, its working perfectly fine. But typeScript is saying child process stdio is undefined


import express, { Request } from "express";
import ytdl from "ytdl-core";
import cp from "child_process";
import ffmpeg from "ffmpeg-static"; 
app.get("/downloadmerged", (req, res) => {
res.setHeader("Content-Type", "video/mp4");
res.setHeader(
 `Content-Disposition`,
 `attachment; filename="Merged.mp4"`
);
 const ref = "https://www.youtube.com/watch?v=aR-KAldshAE";
 const audio = ytdl(ref, { filter: "audioonly", quality: "highestaudio" });
 const video = ytdl(ref, { filter: "videoonly", quality: "highestvideo" });
 const ffmpegProcess = cp.spawn(
 ffmpeg,
 [
 // Remove ffmpeg's console spamming
 "-loglevel",
 "0",
 "-hide_banner",
 // 3 second audio offset
 "-itsoffset",
 "3.0",
 "-i",
 "pipe:3",
 "-i",
 "pipe:4",
 // Rescale the video
 "-vf",
 "scale=320:240",
 // Choose some fancy codes
 "-c:v",
 "libx265",
 "-x265-params",
 "log-level=0",
 "-c:a",
 "flac",
 // Define output container
 "-f",
 "matroska",
 "pipe:5",
 ],
 {
 windowsHide: true,
 stdio: [
 /* Standard: stdin, stdout, stderr */
 "inherit",
 "inherit",
 "inherit",
 /* Custom: pipe:3, pipe:4, pipe:5 */
 "pipe",
 "pipe",
 "pipe",
 ],
 }
 );
 ffmpegProcess.on("close", () => {
 process.stdout.write("\n\n\n");
 console.log("done");
 });
 
 audio.pipe(ffmpegProcess.stdio[3]);
 video.pipe(ffmpegProcess.stdio[4]);
 ffmpegProcess.stdio[5].pipe(res);
});



line
ffmpegProcess.stdio[3]
andffmpegProcess.stdio[4]
are giving type error

Argument of type 'Readable | Writable | null | undefined' is not assignable to parameter of type 'WritableStream'.Type 'undefined' is not assignable to type 'WritableStream'

 



-
How exactly do I extract and merge a audio file using @ffmpeg/ffmpeg
5 octobre 2022, par jeff.gogoomaI have a lot of issues about audio transfer to server and frontend.


I am building a solution that is extracting and merging a file received from frontend.


I am using local ffmpeg file with node.js child_process package.


My Env :


framework : nest.js


runtime : node.js


lang : typescript


here is console.log(file : Express.Multer.File).
I am storing to S3 bucket these files. So I am not using multer's memory, disk storage.


// console.log(file);
 {
 fieldname: 'file',
 originalname: 'input1.mp3',
 encoding: '7bit',
 mimetype: 'audio/mpeg'
}



import cp from "child_process";

type Section = { from: number, to: number };

const files: Array = [];

export const setupAudioFileSection = async (file: Express.Multer.File, section: Section) => {
 try {
 const file1 = await cp.exec(`ffmpeg -i ${file} -y -ss 0 -t ${section.from}`);
 const file2 = await cp.exec(`ffmpeg -i ${file} -y -ss ${section.from} -t ${section.to}`);
 const file3 = await cp.exec(`ffmpeg -i ${file} -y -ss ${section.to}`);
 files.push(file1);
 files.push(file3);

 return file2;
 } catch (error) {
 console.log(error);
 throw new Error('setupAudioFileSection error');
 }



But, My Local ffmpeg is printing the error. because of [object Object]. I think local ffmpeg is not recognized the audio file received from client. So, I am resolving this issue by writing a file to disk or memory directly. but I am confusing this solution whether is right or not.


error Error: Command failed: ffmpeg -i [object Object] -y -ss 10 -t 20 -f mp3 ./TestOutput
ffmpeg version 5.1.1 Copyright (c) 2000-2022 the FFmpeg developers
 built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
 configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
 libavutil 57. 28.100 / 57. 28.100
 libavcodec 59. 37.100 / 59. 37.100
 libavformat 59. 27.100 / 59. 27.100
 libavdevice 59. 7.100 / 59. 7.100
 libavfilter 8. 44.100 / 8. 44.100
 libswscale 6. 7.100 / 6. 7.100
 libswresample 4. 7.100 / 4. 7.100
 libpostproc 56. 6.100 / 56. 6.100

[object: No such file or directory




How can I write file on my server and read ? if that can be, I can resolve [object Object] of ffmpeg issue maybe. Please some answer or advise my issue. Thank you !