
Recherche avancée
Autres articles (59)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...)
Sur d’autres sites (8333)
-
how to send the input data to FFMPEG from a C# program
18 octobre 2020, par jstuardoI need to send a binary stream to FFMPEG so that it sends to an RTMP server.


I did it in a nodejs script using socket.io library and in Linux. It works perfectly.


I need to do the same, but in a Windows Forms application using C#.


This is how I run the ffmpeg.exe application :


_currentProcess = new Process();
 _currentProcess.StartInfo.FileName = _ffmpegExe;
 _currentProcess.StartInfo.Arguments = BuildOptions(framesPerSecond, audioBitRate, audioEncoding, rtmpServer);
 _currentProcess.StartInfo.UseShellExecute = false;
 _currentProcess.StartInfo.CreateNoWindow = true;
 _currentProcess.StartInfo.RedirectStandardInput = true;
 _currentProcess.StartInfo.RedirectStandardError = true;
 _currentProcess.ErrorDataReceived += CurrentProcess_ErrorDataReceived;
 _currentProcess.Start();
 _currentProcess.BeginErrorReadLine();



BuildOptions
method is defined this way :

private string BuildOptions(int framesPerSecond, int audioBitRate, string audioEncoding, string rtmpServer)
 {
 string options;
 if (framesPerSecond == 1)
 {
 options = $"-i - -c:v libx264 -preset ultrafast -tune zerolatency -r 1 -g 2 -keyint_min 2 -x264opts keyint=2 -crf 25 -pix_fmt yuv420p -profile:v baseline -level 3 -c:a aac -b:a {audioEncoding} -ar {audioBitRate}-f flv {rtmpServer}";
 }
 else if (framesPerSecond == 15)
 {
 options = $"-i - -c:v libx264 -preset ultrafast -tune zerolatency max_muxing_queue_size 1000 -bufsize 5000 -r 15 -g 30 -keyint_min 30 -x264opts keyint=30 -crf 25 -pix_fmt yuv420p -profile:v baseline -level 3 -c:a aac -b:a {audioEncoding} -ar {audioBitRate} -f flv {rtmpServer}";
 }
 else
 {
 options = $"-i - -c:v libx264 -preset ultrafast -tune zerolatency -c:a aac -ar {audioBitRate} -b:a {audioEncoding} -bufsize 5000 -f flv {rtmpServer}";
 }

 return options;
 }



I am sending the data to the standard input this way :


public void EncodeAndSend(byte[] data)
 {
 if (_currentProcess != null)
 {
 var streamWriter = _currentProcess.StandardInput;
 streamWriter.Write(Encoding.GetEncoding("ISO-8859-1").GetChars(data));
 }
 }



And finally, this method is for receiving the standard error which receives the result from ffmpeg.exe :


private void CurrentProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e)
 {
 Console.WriteLine(e.Data);
 }



When I run the application, this is shown in the console :


ffmpeg version 4.3.1-2020-10-01-essentials_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 10.2.0 (Rev3, Built by MSYS2 project)
 configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
 libpostproc 55. 7.100 / 55. 7.100
pipe:: Invalid data found when processing input



If I change the
EncodeAndSend
method to be :

public void EncodeAndSend(byte[] data)
 {
 if (_currentProcess != null)
 {
 var streamWriter = _currentProcess.StandardInput;
 streamWriter.Write(data);
 }
 }



pipe:: Invalid data found when processing input
error is not produced, but no more outputs are shown so it seems it is not working.

What is wrong with this ? how can I send the data to the FFMPEG process ?


Finally, I tell you that the binary stream comes from the camera by mean of MediaRecorder in a web page (the same used for my program in nodejs server, so that it is not the issue here)


-
How to restream multicast stream with ffmpeg
26 octobre 2020, par verbI am new to ffmpeg and need to restream multicast and scale it. Tried different parameters and i have managed to restream and scale but it always appear some pat,pmt or pcr error and som interuptions in the stream appear.The input stream is cbr 14Mbit and i try to set the bitrate as 6Mbit please check my config and if you notice something wrong let me know :




ffmpeg -re -i "udp ://@238.252.250.9:5000 ?overrun_nonfatal=1&fifo_size=1000000&bitrate=70000000&pkt_size=188" -map 0:0 -map 0:2 -b:v 3000k -minrate 3000k -maxrate 4000k -bufsize 8000K -pcr_period 20 -flush_packets 0 -tune zerolatency -preset ultrafast -threads 2 -c:a copy -qmax 12 -f mpegts -muxrate 6M "udp ://@239.253.251.13:5505 ?pkt_size=188&overrun_nonfatal=1&localaddr=10.253.251.66&bitrate=6000000"




here is the input stream :


Input #0, mpegts, from 'udp://@238.252.250.9:5000':
 Duration: N/A, start: 46612.831967, bitrate: N/A
 Program 2002 
 Metadata:
 service_name : RT Doc HD
 service_provider: GLOBECAST
 Stream #0:0[0x7e5]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
 Stream #0:1[0x7e6](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s
 Stream #0:2[0x7e7](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s



I don't understand all parameters especially the parameters concerning input/output udp stream so please help me to solve the correct command.


-
FFMPEG when live streaming sends a message and exits after some frames were sent
30 octobre 2020, par jstuardowhen doing an streaming with FFMPEG all works perfectly until I get these messages and then, ffmpeg.exe exits :


av_interleaved_write_frame(): Unknown error

frame= 1224 fps=3.4 q=13.0 size= 2758kB time=00:01:21.94 bitrate= 275.8kbits/s speed=0.226x 

av_interleaved_write_frame(): Unknown error

[flv @ 000001e310e8a1c0] Failed to update header with correct duration.

[flv @ 000001e310e8a1c0] Failed to update header with correct filesize.

Error writing trailer of rtmp://example.com/s/2b32abdc-130c-43e5-997e-079e69d1fd7f: Error number -10053 occurred

frame= 1224 fps=3.4 q=13.0 Lsize= 2758kB time=00:01:21.98 bitrate= 275.6kbits/s speed=0.226x 

video:2481kB audio:221kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.084671%

[libx264 @ 000001e310ad6080] frame I:41 Avg QP:10.29 size: 57664

[libx264 @ 000001e310ad6080] frame P:1183 Avg QP:13.52 size: 148

[libx264 @ 000001e310ad6080] mb I I16..4: 100.0% 0.0% 0.0%

[libx264 @ 000001e310ad6080] mb P I16..4: 0.1% 0.0% 0.0% P16..4: 0.2% 0.0% 0.0% 0.0% 0.0% skip:99.7%

[libx264 @ 000001e310ad6080] coded y,uvDC,uvAC intra: 10.9% 7.1% 5.4% inter: 0.0% 0.1% 0.0%

[libx264 @ 000001e310ad6080] i16 v,h,dc,p: 84% 6% 6% 4%

[libx264 @ 000001e310ad6080] i8c dc,h,v,p: 91% 6% 3% 1%

[libx264 @ 000001e310ad6080] kb/s:248.98

[aac @ 000001e310a46d40] Qavg: 108.454

Conversion failed!



Normally, the messages I received are similar to this :


frame= 1196 fps=3.4 q=13.0 size= 2692kB time=00:01:20.08 bitrate= 275.4kbits/s speed=0.227x 



Which are the expected messages. Sometimes, I received this message, but this does not cause ffmpeg.exe to exit :


Input #0, matroska,webm, from 'pipe:':

 Metadata:

 encoder : Chrome

 Duration: N/A, start: 0.000000, bitrate: N/A

 Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)

 Stream #0:1(eng): Video: h264 (Constrained Baseline), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 30.30 fps, 14.99 tbr, 1k tbn, 60 tbc (default)



What may be happening ? maybe it is a problem of the RTMP server ? or something is wrong with FFMPEG ?


This version of FFMPEG.EXE is for windows. The programming language is C# from where I am launching FFMPEG.EXE process.


As I told, this happens after several frames sent to the server. Only once, this problem occured after a few frames sent. That is why I suspect that the RTMP server is the problem.


EDIT : This is the command :


FFMPEG -i - -c:v libx264 -preset ultrafast -tune zerolatency -max_muxing_queue_size 1000 -bufsize 5000 -r 15 -g 30 -keyint_min 30 -x264opts keyint=30 -crf 25 -pix_fmt yuv420p -profile:v baseline -level 3 -c:a aac -b:a 22k -ar 22050 -f flv rtmp://rtmp.xxxx.yyyy



Regards
Jaime