
Recherche avancée
Autres articles (56)
-
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (4922)
-
Ffmpeg configuration to stream the frames of my webcam
6 juillet 2023, par RidwengI'm trying to build a server in NodeJs to stream in RTSP my webcam using Angular to retrieve the frames and connecting using websockets. The server side is using "express-ws" module to create the Websocket.


I was successfull in sending the frames from the webcam to the server in base64, the server is receiving these messages from a function on interval of (1000 / 30)ms.


The issue relies on the implementation of my Ffmpeg child process. I retrieve the message and convert it into a buffer to then write this in the function of Ffmpeg.


My current implementation is this one :


const { spawn } = require('child_process');
exports.stream = (ws ,req) => {
 try{
 const mess = `connection from: ${req._remoteAddress} at ${req._startTime}.`
 const initialMess =`Started ${mess}`
 ws.uuid = uuidv4()
 console.log(initialMess)

 ws.on('message', function incoming(message) {
 message = JSON.parse(message)
 console.log(`Res: ${message.width} x ${message.height}`);
 const ffmpeg = spawn('ffmpeg', [
 '-f', 'rawvideo',
 '-pixel_format', 'rgb24',
 '-video_size', `${message.width}x${message.height}`,
 '-framerate', `${message.framerate}`,
 '-i', '-',
 '-codec:v', 'libx264',
 '-preset', 'ultrafast',
 '-tune', 'zerolatency',
 '-f', 'rtsp',
 'rtsp://127.0.0.1:554/rtsp/stream',
 ]);
 const base64Data = message.video;
 const videoData = Buffer.from(base64Data, 'base64');

 ffmpeg.stdin.write(videoData);
 ffmpeg.stdin.end();
 
 ffmpeg.stderr.on('data', (data) => {
 console.error(`FFmpeg : ${data}`);
 });

 ffmpeg.on('exit', (code, signal) => {
 if (dev) console.log(`FFmpeg process exited with code ${code} and signal ${signal}`);
 
 // Close the WebSocket connection
 ws.close();
 });
 });
 ws.on('close', () => {
 const finalMess = `Stopped ${mess}`
 rem(ws.uuid)
 console.log(finalMess)
 })
 }catch(err){
 console.log(err)
 }
}



In terms of the message received, this is the Angular side sending the message :


const imageData = this.canvas.toDataURL('image/jpeg');
socket.send(JSON.stringify({video: imageData, width: this.canvas.width, height: this.canvas.height, framerate: interval }));



The interval variable is the divisor of the interval that is triggering the function (in this case 30).


I'm currently receiving the error message from Ffmpeg :


ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
 built with Apple clang version 14.0.3 (clang-1403.0.22.14.1)

FFmpeg : configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --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-audiotoolbox --enable-neon
 libavutil 58. 2.100 / 58. 2.100
 libavcodec 60. 3.100 / 60. 3.100
 libavformat 60. 3.100 / 60. 3.100
 libavdevice 60. 1.100 / 60. 1.100
 libavfilter 9. 3.100 / 9. 3.100
 libswscale 7. 1.100 / 7. 1.100
 libswresample 4. 10.100 / 4. 10.100
 libpostproc 57. 1.100 / 57. 1.100

FFmpeg : [rawvideo @ 0x150005ff0] Packet corrupt (stream = 0, dts = 0).

FFmpeg : Input #0, rawvideo, from 'fd:':
 Duration: N/A, start: 0.000000, bitrate: 221184 kb/s
 Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 640x480, 221184 kb/s, 30 tbr, 30 tbn

FFmpeg : Stream mapping:
 Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))

FFmpeg : fd:: corrupt input packet in stream 0
[rawvideo @ 0x14ef24290] Invalid buffer size, packet size 76343 < expected frame_size 921600

FFmpeg : Error while decoding stream #0:0: Invalid argument

FFmpeg : [libx264 @ 0x14ef25a20] using cpu capabilities: ARMv8 NEON

FFmpeg : [libx264 @ 0x14ef25a20] profile High 4:4:4 Predictive, level 3.0, 4:4:4, 8-bit

FFmpeg : [libx264 @ 0x14ef25a20] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=6 threads=7 lookahead_threads=7 sliced_threads=1 slices=7 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0

FFmpeg : [tcp @ 0x1500078a0] Connection to tcp://127.0.0.1:554?timeout=0 failed: Connection refused
[out#0/rtsp @ 0x14ef24b00] Could not write header (incorrect codec parameters ?): Connection refused

FFmpeg : [vost#0:0/libx264 @ 0x14ef256d0] Error initializing output stream: 

FFmpeg : Conversion failed!

FFmpeg process exited with code 1 and signal null



This is the reason I believe the issue relies on the configuration of Ffmpeg and how to set it for this case. It would be great to being able to play this RTSP link in my VLC to conclude it as successfull.


I would apreciate any suggestions or guidence.
Thanks in advance.


-
Invalid data found when processing input for mp3 file in ffmpeg
15 juillet 2023, par Sai ChaithanyaMy custom compiled FFmpeg build is unable to read mp3 files, suddenly. Interestingly, the custom compiled FFmpeg build generated the mp3 file. For the past 1 year, it was successfully reading the file. I checked with the official FFmpeg build, and it works, so at least the file is not corrupted.


Official FFmpeg Build output :


ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04.1)
configuration: --arch=x86_64 --target-os=linux --disable-network --enable-small --disable-doc 
 --disable-manpages --enable-static --disable-shared --disable-ffprobe 
 --disable-ffplay --enable-lto --prefix=/home/greninja/Downloads/custom_build 
 --extra-cflags='-I/home/greninja/Downloads/custom_build/include -O3 -flto' 
 --extra-ldflags=-L/home/greninja/Downloads/custom_build/lib
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 4. 10.100 / 4. 10.100
Input #0, mp3, from './test.mp3':
 Metadata:
 major_brand : dash
 minor_version : 0
 compatible_brands: iso6mp41
 encoder : Lavf59.33.100
Duration: 00:03:07.09, start: 0.025057, bitrate: 192 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 192 kb/s
 Metadata:
 encoder : Lavc59.46
At least one output file must be specified



My Custom FFmpeg build output :


ffmpeg version N-108341-gb1a68127bb Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --arch=x86_64 --target-os=linux --disable-everything --disable-network 
 --disable-autodetect --enable-small --disable-debug --disable-doc 
 --disable-manpages --enable-static --disable-shared 
 --enable-decoder='aac*,ac3*,opus,vorbis,mjpeg' 
 --enable-demuxer='mov,m4v,matroska,image2' --enable-protocol=file 
 --enable-muxer='mp3,mp4,webm,null' --enable-libmp3lame 
 --enable-encoder=libmp3lame --enable-filter=aresample --enable-logging 
 --enable-pthreads --enable-parser='vorbis,opus,vp9,vp8,mpegaudio,mpegvideo,mpeg4video,ac3*,aac*,mjpeg,h264' 
 --disable-ffprobe --disable-ffplay --enable-lto 
 --prefix=/home/wade/Downloads/custom_build 
 --extra-cflags='-I/home/wade/Downloads/custom_build/include -O3 -flto' 
 --extra-ldflags=-L/home/wade/Downloads/custom_build/lib
libavutil 57. 36.102 / 57. 36.102
libavcodec 59. 46.100 / 59. 46.100
libavformat 59. 33.100 / 59. 33.100
libavdevice 59. 8.101 / 59. 8.101
libavfilter 8. 49.100 / 8. 49.100
libswscale 6. 8.112 / 6. 8.112
libswresample 4. 9.100 / 4. 9.100
./test.mp3: Invalid data found when processing input



What configuration am I missing ?


-
FFmpeg help, how should I use FFmpeg ? [closed]
11 septembre 2023, par Señor TontoI'm trying to use FFmpeg in my code, which is a C++ win32 application that I'm coding from Visual Studio Code 2022. I've downloaded FFmpeg from the BtnB Github that they link in their offical site as a pre-built binary. Now, I got the shared version, as I believed this would both have the command-line .exe app & the normal code headers & libraries. I tried using some code inside of my main.cpp to decode frames from .mp4 files as a test. For some reason though, on launch I got these errors : avcodec-60.dll cannot be found, avformat-60.dll cannot be found, avutil-58.dll cannot be found, swscale-7.dll cannot be found. So now I'm wondering why aren't these provided in the shared code ? there are only dll.a files but no actual .dll files, I also found .def files with the names of the .dll files I am apparently missing, now I want to know why these .dll files aren't provided. Do I need to build from source for that ? Or should I just forget using the .h & .lib files of FFmpeg & use the command-line app ? Any help appreciated.


I want to use FFmpeg, but I can't find any guidance as to whether to use the command-line tool or the code function that aren't working due to the absent .dll filess