Recherche avancée

Médias (1)

Mot : - Tags -/pirate bay

Autres articles (43)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang 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.

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP 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 (...)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

Sur d’autres sites (3608)

  • FFMPEG error submitting a packet to the muxer

    27 juillet 2024, par Badgio10177

    I am attempting to stream video frames to a RTSP server using FFMPEG. I instantiate an ffmpeg pipeline in c++. There are times when the process works perfectly and other times I get the error Error submitting a packet to the muxer : Broken pipe. Error muxing a packet. What uis strange is that there are times when the stream works and times when it does not which leads me to believe that the FFMPEG parameters that I set are not necessarily incorrect.

    


    I am using a mex function within MATLAB to take in a frame and stream it.

    


    // Global variables&#xA;FILE* openPipeLine = NULL;&#xA;&#xA;void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[], int frameWidth, int frameHeight)&#xA;{&#xA;&#xA;    Ptr<mat> inputFrame = ocvMxArrayToImage_uint8(prhs[0], true);&#xA;    Mat processedFrame = *inputFrame;&#xA;&#xA;    // Check if FFMPEG process has been started&#xA;    if (!openPipeLine)&#xA;    {&#xA;        openPipeLine = _popen("ffmpeg -report -f rawvideo -r 10 -video_size 1280x720 -pixel_format bgr24 -i pipe: -vcodec libx264 -pix_fmt yuv420p -f rtsp rtsp://localhost:8554/mystream 2> log.txt", "wb");&#xA;&#xA;    }&#xA;&#xA;    // Write the frame data to the pipeline&#xA;    fwrite(processedFrame.data, 1, frameWidth * frameHeight * 3, openPipeLine);&#xA;    mexAtExit(exitFcn);&#xA;}&#xA;</mat>

    &#xA;

    Below is the full report from the ffmpeg process. Do my operating system variables change from time to time which cause the stream to work at times and break at others ? I am using Windows 10.

    &#xA;

    Log level: 48&#xA;Command line:&#xA;ffmpeg -report -f rawvideo -r 10 -video_size 1280x720 -pixel_format bgr24 -i pipe: -vcodec libx264 -pix_fmt yuv420p -f rtsp rtsp://localhost:8554/mystream&#xA;&#xA;  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)&#xA;  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-lib  libavutil      58. 16.101 / 58. 16.101&#xA;  libavcodec     60. 23.100 / 60. 23.100&#xA;  libavformat    60. 10.100 / 60. 10.100&#xA;  libavdevice    60.  2.101 / 60.  2.101&#xA;  libavfilter     9. 11.100 /  9. 11.100&#xA;  libswscale      7.  3.100 /  7.  3.100&#xA;  libswresample   4. 11.100 /  4. 11.100&#xA;  libpostproc    57.  2.100 / 57.  2.100&#xA;Splitting the commandline.&#xA;&#xA;Successfully parsed a group of options.&#xA;Opening an input file: pipe:.&#xA;[rawvideo @ 00000182dba5efc0] Opening &#x27;pipe:&#x27; for reading&#xA;[pipe @ 00000182dba611c0] Setting default whitelist &#x27;crypto,data&#x27;&#xA;[rawvideo @ 00000182dba5efc0] Before avformat_find_stream_info() pos: 0 bytes read:65536 seeks:0 nb_streams:1&#xA;[rawvideo @ 00000182dba5efc0] All info found&#xA;[rawvideo @ 00000182dba5efc0] After avformat_find_stream_info() pos: 2764800 bytes read:2764800 seeks:0 frames:1&#xA;Input #0, rawvideo, from &#x27;pipe:&#x27;:&#xA;  Duration: N/A, start: 0.000000, bitrate: 221184 kb/s&#xA;  Stream #0:0, 1, 1/10: Video: rawvideo (BGR[24] / 0x18524742), bgr24, 1280x720, 221184 kb/s, 10 tbr, 10 tbn&#xA;Successfully opened the file.&#xA;Parsing a group of options: output url rtsp://192.168.0.2:8554/mystream.&#xA;Applying option vcodec (force video codec (&#x27;copy&#x27; to copy stream)) with argument libx264.&#xA;Applying option pix_fmt (set pixel format) with argument yuv420p.&#xA;Applying option f (force format) with argument rtsp.&#xA;Successfully parsed a group of options.&#xA;Opening an output file: rtsp://192.168.0.2:8554/mystream.&#xA;[out#0/rtsp @ 00000182dba72c00] No explicit maps, mapping streams automatically...&#xA;[vost#0:0/libx264 @ 00000182dba75cc0] Created video stream from input stream 0:0&#xA;Successfully opened the file.&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))&#xA;[rawvideo @ 00000182dba72700] PACKET SIZE: 2764800, STRIDE: 3840&#xA;detected 16 logical cores&#xA;[graph 0 input from stream 0:0 @ 00000182dba86180] Setting &#x27;video_size&#x27; to value &#x27;1280x720&#x27;&#xA;[graph 0 input from stream 0:0 @ 00000182dba86180] Setting &#x27;pix_fmt&#x27; to value &#x27;3&#x27;&#xA;[graph 0 input from stream 0:0 @ 00000182dba86180] Setting &#x27;time_base&#x27; to value &#x27;1/10&#x27;&#xA;[graph 0 input from stream 0:0 @ 00000182dba86180] Setting &#x27;pixel_aspect&#x27; to value &#x27;0/1&#x27;&#xA;[graph 0 input from stream 0:0 @ 00000182dba86180] Setting &#x27;frame_rate&#x27; to value &#x27;10/1&#x27;&#xA;[graph 0 input from stream 0:0 @ 00000182dba86180] w:1280 h:720 pixfmt:bgr24 tb:1/10 fr:10/1 sar:0/1&#xA;[format @ 00000182dba86540] Setting &#x27;pix_fmts&#x27; to value &#x27;yuv420p&#x27;&#xA;[auto_scale_0 @ 00000182dba869c0] w:iw h:ih flags:&#x27;&#x27; interl:0&#xA;[format @ 00000182dba86540] auto-inserting filter &#x27;auto_scale_0&#x27; between the filter &#x27;Parsed_null_0&#x27; and the filter &#x27;format&#x27;&#xA;[AVFilterGraph @ 00000182dba49040] query_formats: 4 queried, 2 merged, 1 already done, 0 delayed&#xA;[auto_scale_0 @ 00000182dba869c0] w:1280 h:720 fmt:bgr24 sar:0/1 -> w:1280 h:720 fmt:yuv420p sar:0/1 flags:0x00000004&#xA;[libx264 @ 00000182dba76080] using mv_range_thread = 24&#xA;[libx264 @ 00000182dba76080] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512&#xA;[libx264 @ 00000182dba76080] profile High, level 3.1, 4:2:0, 8-bit&#xA;[libx264 @ 00000182dba76080] 264 - core 164 r3107 a8b68eb - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=22 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=10 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00&#xA;[tcp @ 00000182dc5ce480] No default whitelist set&#xA;[tcp @ 00000182dc5ce480] Original list of addresses:&#xA;[tcp @ 00000182dc5ce480] Address 192.168.0.2 port 8554&#xA;[tcp @ 00000182dc5ce480] Interleaved list of addresses:&#xA;[tcp @ 00000182dc5ce480] Address 192.168.0.2 port 8554&#xA;[tcp @ 00000182dc5ce480] Starting connection attempt to 192.168.0.2 port 8554&#xA;[tcp @ 00000182dc5ce480] Successfully connected to 192.168.0.2 port 8554&#xA;[rtsp @ 00000182dba72d00] SDP:&#xA;v=0&#xA;&#xA;o=- 0 0 IN IP4 127.0.0.1&#xA;&#xA;s=No Name&#xA;&#xA;c=IN IP4 192.168.0.2&#xA;&#xA;t=0 0&#xA;&#xA;a=tool:libavformat 60.10.100&#xA;&#xA;m=video 0 RTP/AVP 96&#xA;&#xA;a=rtpmap:96 H264/90000&#xA;&#xA;a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z2QAH6zZQFAFuhAAAAMAEAAAAwFA8YMZYA==,aOvjyyLA; profile-level-id=64001F&#xA;&#xA;a=control:streamid=0&#xA;&#xA;&#xA;[rtp @ 00000182dc5cd040] No default whitelist set&#xA;[udp @ 00000182dba4b140] No default whitelist set&#xA;[udp @ 00000182dba4b140] end receive buffer size reported is 393216&#xA;[udp @ 00000182dc9bf040] No default whitelist set&#xA;[udp @ 00000182dc9bf040] end receive buffer size reported is 393216&#xA;Output #0, rtsp, to &#x27;rtsp://192.168.0.2:8554/mystream&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf60.10.100&#xA;  Stream #0:0, 0, 1/90000: Video: h264, yuv420p(tv, progressive), 1280x720, q=2-31, 10 fps, 90k tbn&#xA;    Metadata:&#xA;      encoder         : Lavc60.23.100 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A&#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;[rawvideo @ 00000182dba72700] PACKET SIZE: 2764800, STRIDE: 3840&#xA;[rawvideo @ 00000182dba72700] PACKET SIZE: 2764800, STRIDE: 3840&#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;[rawvideo @ 00000182dba72700] PACKET SIZE: 2764800, STRIDE: 3840&#xA;[rawvideo @ 00000182dba72700] PACKET SIZE: 2764800, STRIDE: 3840&#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;[rawvideo @ 00000182dba72700] PACKET SIZE: 2764800, STRIDE: 3840   &#xA;[rawvideo @ 00000182dba72700] PACKET SIZE: 2764800, STRIDE: 3840&#xA;[libx264 @ 00000182dba76080] frame=   0 QP=21.34 NAL=3 Slice:I Poc:0   I:3600 P:0    SKIP:0    size=135901 bytes&#xA;frame=    0 fps=0.0 q=25.0 size=       0kB time=-00:00:00.20 bitrate=  -0.0kbits/s speed=N/A    &#xA;[vost#0:0/libx264 @ 00000182dba75cc0] Error submitting a packet to the muxer: Broken pipe&#xA;[out#0/rtsp @ 00000182dba72c00] Error muxing a packet&#xA;[out#0/rtsp @ 00000182dba72c00] Terminating muxer thread&#xA;[rawvideo @ 00000182dba72700] PACKET SIZE: 2764800, STRIDE: 3840&#xA;[libx264 @ 00000182dba76080] frame=   1 QP=18.29 NAL=2 Slice:P Poc:2   I:2662 P:866  SKIP:72   size=54835 bytes&#xA;frame=    1 fps=0.0 q=25.0 size=N/A time=-00:00:00.10 bitrate=N/A speed=N/A    &#xA;No more output streams to write to, finishing.&#xA;&#xA;Conversion failed!&#xA;&#xA;

    &#xA;

  • How can I increase the performance of this video watermarking call which seems to be only using 6% of my system's CPU ? Currently using ffmpeg

    24 août 2023, par Codemonkey

    I have a php script to add a watermark to an uploaded video, using ffmpeg

    &#xA;

    shell_exec("ffmpeg -y -i input.mp4 -i watermark.png -filter_complex $filter output.mp4")&#xA;

    &#xA;

    The video is 36 seconds long, 33MB and 1080x1920, 24fps. The output video comes in at 8MB, scaled down to 540x960 with a PNG overlaid as a watermark.

    &#xA;

    The script takes about 3 seconds, averaging 320fps or so. For a one-off this would be ok, but I'm going to be processing hundreds/thousands of these at a time.

    &#xA;

    I have 128GB of ram and an EPYC 7502p (32cores/64threads), and both input and output files are on NVMe drives.

    &#xA;

    If I monitor top showing all my cores/threads in another window, with refresh delay set to a variety of things from 0.1 to 2 seconds, I'd guesstimate that this hits about 1/4 of my available threads, at about 25% utilisation each.

    &#xA;

    So it kind of feels like I COULD see a 16x speed increase if it hit all of them at 100%. That actually wouldn't be ideal, locking up the server of course, but when my CPU is sat at 99% idle 99% of the time, I feel it could do better - it'd be nice to see it hitting at least half the cores or utilising at least 50% of them when it does...

    &#xA;

    So, is there anything I can change with ffmpeg's config/build or the way I call it ? If this is as good as ffmpeg can do, are there better tools for the job ?

    &#xA;

    Thank you

    &#xA;


    &#xA;

    EDIT :

    &#xA;

    A few things I've learnt since posting :

    &#xA;

      &#xA;
    • -c:v libx264 -preset ultrafast - marginal help
    • &#xA;

    • nice -n -10 - marginal help (changing to -20 is makes negligible difference)
    • &#xA;

    • -c:a copy - significant help, which I found surprising
    • &#xA;

    &#xA;

    FPS up from 320 to 540 using those 3 combined. I still feel there should be significantly more gains somewhere though...

    &#xA;


    &#xA;

    Here's the output from the original script, if it helps :

    &#xA;

    ffmpeg version 4.2.9 Copyright (c) 2000-2023 the FFmpeg developers&#xA;  built with gcc 8 (GCC)&#xA;  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags=&#x27;-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection&#x27; --extra-ldflags=&#x27;-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld &#x27; --extra-cflags=&#x27; &#x27; --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librsvg --enable-libsrt --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-version3 --enable-vapoursynth --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-libzvbi --enable-avfilter --enable-avresample --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;input.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : M4V&#xA;    minor_version   : 1&#xA;    compatible_brands: isomavc1mp42&#xA;    creation_time   : 2023-07-03T14:55:37.000000Z&#xA;  Duration: 00:00:36.50, start: 0.000000, bitrate: 7315 kb/s&#xA;    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/unknown), 1080x1920 [SAR 1:1 DAR 9:16], 7213 kb/s, 24 fps, 24 tbr, 24k tbn, 48 tbc (default)&#xA;    Metadata:&#xA;      creation_time   : 2023-07-03T14:55:37.000000Z&#xA;      handler_name    : ETI ISO Video Media Handler&#xA;      encoder         : Elemental H.264&#xA;    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 96 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2023-07-03T14:55:37.000000Z&#xA;      handler_name    : ETI ISO Audio Media Handler&#xA;Input #1, png_pipe, from &#x27;watermark.png&#x27;:&#xA;  Duration: N/A, bitrate: N/A&#xA;    Stream #1:0: Video: png, rgba(pc), 1232x804 [SAR 11811:11811 DAR 308:201], 25 tbr, 25 tbn, 25 tbc&#xA;Stream mapping:&#xA;  Stream #0:0 (h264) -> scale (graph 0)&#xA;  Stream #1:0 (png) -> scale (graph 0)&#xA;  overlay (graph 0) -> Stream #0:0 (libx264)&#xA;  Stream #0:1 -> #0:1 (aac (native) -> aac (native))&#xA;Press [q] to stop, [?] for help&#xA;[libx264 @ 0x56510d488e00] using SAR=1/1&#xA;[libx264 @ 0x56510d488e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2&#xA;[libx264 @ 0x56510d488e00] profile High, level 3.1, 4:2:0, 8-bit&#xA;[libx264 @ 0x56510d488e00] 264 - core 157 r2980 34c06d1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=30 lookahead_threads=5 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00&#xA;Output #0, mp4, to &#x27;output.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : M4V&#xA;    minor_version   : 1&#xA;    compatible_brands: isomavc1mp42&#xA;    encoder         : Lavf58.29.100&#xA;    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 540x960 [SAR 1:1 DAR 9:16], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)&#xA;    Metadata:&#xA;      encoder         : Lavc58.54.100 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1&#xA;    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2023-07-03T14:55:37.000000Z&#xA;      handler_name    : ETI ISO Audio Media Handler&#xA;      encoder         : Lavc58.54.100 aac&#xA;frame=  876 fps=324 q=-1.0 Lsize=    7768kB time=00:00:36.45 bitrate=1745.5kbits/s speed=13.5x&#xA;video:7177kB audio:566kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.336181%&#xA;[libx264 @ 0x56510d488e00] frame I:9     Avg QP:21.46  size: 37765&#xA;[libx264 @ 0x56510d488e00] frame P:237   Avg QP:23.78  size: 17862&#xA;[libx264 @ 0x56510d488e00] frame B:630   Avg QP:28.03  size:  4405&#xA;[libx264 @ 0x56510d488e00] consecutive B-frames:  2.9%  2.5%  3.8% 90.9%&#xA;[libx264 @ 0x56510d488e00] mb I  I16..4: 13.6% 65.9% 20.5%&#xA;[libx264 @ 0x56510d488e00] mb P  I16..4:  5.2% 16.6%  4.1%  P16..4: 32.8% 18.0% 12.5%  0.0%  0.0%    skip:10.8%&#xA;[libx264 @ 0x56510d488e00] mb B  I16..4:  1.1%  2.7%  0.2%  B16..8: 35.3%  7.2%  2.5%  direct: 3.3%  skip:47.7%  L0:37.0% L1:52.2% BI:10.8%&#xA;[libx264 @ 0x56510d488e00] 8x8 transform intra:65.0% inter:71.5%&#xA;[libx264 @ 0x56510d488e00] coded y,uvDC,uvAC intra: 54.7% 62.1% 11.5% inter: 17.9% 12.9% 0.5%&#xA;[libx264 @ 0x56510d488e00] i16 v,h,dc,p: 16% 28%  8% 47%&#xA;[libx264 @ 0x56510d488e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 23% 18%  6%  6%  7%  7%  7%  7%&#xA;[libx264 @ 0x56510d488e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 16% 11%  7%  9% 10%  8%  8%  8%&#xA;[libx264 @ 0x56510d488e00] i8c dc,h,v,p: 55% 20% 20%  5%&#xA;[libx264 @ 0x56510d488e00] Weighted P-Frames: Y:5.5% UV:3.4%&#xA;[libx264 @ 0x56510d488e00] ref P L0: 65.0% 18.8% 13.0%  3.0%  0.2%&#xA;[libx264 @ 0x56510d488e00] ref B L0: 95.0%  4.0%  1.1%&#xA;[libx264 @ 0x56510d488e00] ref B L1: 98.2%  1.8%&#xA;[libx264 @ 0x56510d488e00] kb/s:1610.57&#xA;[aac @ 0x56510d4865c0] Qavg: 22331.562&#xA;

    &#xA;

  • FFMPEG Pipeline Crash [closed]

    17 août 2023, par Badgio10177

    I instantiate an ffmpeg pipeline within C++. No frames get streamed to the RTSP server and the pipeline crashes unexpectedly.

    &#xA;

    I have the following code :

    &#xA;

    #include <iostream>&#xA;#include <typeinfo>&#xA;#include "opencvmex.hpp"&#xA;#include &#xA;#include &#xA;#include "mex.h"&#xA;#include &#xA;#include &#xA;#include  // Windows API for process enumeration&#xA;#include <opencv2></opencv2>core.hpp>&#xA;&#xA;// Global variables&#xA;FILE* openPipeLine = NULL;&#xA;&#xA;//////////////////////////////////////////////////////////////////////////////&#xA;// Exit function to execute when the mex function is cleared.&#xA;//////////////////////////////////////////////////////////////////////////////&#xA;void exitFcn()&#xA;{&#xA;    fflush(openPipeLine); // Clear out the pipeline.&#xA;    _pclose(openPipeLine);   //Close the pipeline.&#xA;}&#xA;&#xA;///////////////////////////////////////////////////////////////////////////&#xA;// Main entry point to a MEX function&#xA;///////////////////////////////////////////////////////////////////////////&#xA;void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[], int frameWidth, int frameHeight)&#xA;{&#xA;    // Use the appropriate namespace for OpenCV functions&#xA;    using namespace cv;&#xA;&#xA;    Ptr<mat> inputFrame = ocvMxArrayToImage_uint8(prhs[0], true);&#xA;    Mat processedFrame = *inputFrame;&#xA;&#xA;    // Check if FFMPEG process has been started&#xA;    if (!openPipeLine)&#xA;    {&#xA;        openPipeLine = _popen("ffmpeg -f rawvideo -r 10 -video_size 1280x720 -pixel_format bgr24 -i pipe: -vcodec libx264 -crf 25 -pix_fmt yuv420p -f rtsp rtsp://192.168.0.2:8554/mystream 2> log.txt", "wb");&#xA;    }&#xA;&#xA;    // Write the frame data to the pipeline&#xA;    fwrite(processedFrame.data, 1, frameWidth * frameHeight * 3, openPipeLine);&#xA;    mexAtExit(exitFcn);&#xA;}&#xA;&#xA;&#xA;&#xA;</mat></typeinfo></iostream>

    &#xA;

    The function is a Matlab Mex function. What is interesting is that there are certain times when the stream works and some times it just crashes. The log file for the ffmpeg process is the following :

    &#xA;

    ffmpeg version 2023-08-14-git-c704901324-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers&#xA;  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)&#xA;  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint&#xA;  libavutil      58. 16.101 / 58. 16.101&#xA;  libavcodec     60. 23.100 / 60. 23.100&#xA;  libavformat    60. 10.100 / 60. 10.100&#xA;  libavdevice    60.  2.101 / 60.  2.101&#xA;  libavfilter     9. 11.100 /  9. 11.100&#xA;  libswscale      7.  3.100 /  7.  3.100&#xA;  libswresample   4. 11.100 /  4. 11.100&#xA;  libpostproc    57.  2.100 / 57.  2.100&#xA;Input #0, rawvideo, from &#x27;pipe:&#x27;:&#xA;  Duration: N/A, start: 0.000000, bitrate: 221184 kb/s&#xA;  Stream #0:0: Video: rawvideo (BGR[24] / 0x18524742), bgr24, 1280x720, 221184 kb/s, 10 tbr, 10 tbn&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))&#xA;[libx264 @ 0000027964ad6300] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512&#xA;[libx264 @ 0000027964ad6300] profile High, level 3.1, 4:2:0, 8-bit&#xA;[libx264 @ 0000027964ad6300] 264 - core 164 r3107 a8b68eb - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=22 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=10 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=25.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00&#xA;Output #0, rtsp, to &#x27;rtsp://192.168.0.2:8554/mystream&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf60.10.100&#xA;  Stream #0:0: Video: h264, yuv420p(tv, progressive), 1280x720, q=2-31, 10 fps, 90k tbn&#xA;    Metadata:&#xA;      encoder         : Lavc60.23.100 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A&#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;frame=    0 fps=0.0 q=0.0 size=       0kB time=N/A bitrate=N/A speed=N/A    &#xA;[vost#0:0/libx264 @ 0000027964ad5f00] Error submitting a packet to the muxer: Broken pipe&#xA;[out#0/rtsp @ 0000027964abdf00] Error muxing a packet&#xA;frame=    1 fps=0.1 q=27.0 size=N/A time=-00:00:00.10 bitrate=N/A speed=N/A    &#xA;[out#0/rtsp @ 0000027964abdf00] video:146kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;frame=    1 fps=0.0 q=-1.0 Lsize=N/A time=00:00:06.50 bitrate=N/A speed=0.32x    &#xA;[libx264 @ 0000027964ad6300] frame I:1     Avg QP:26.79  size:148574&#xA;[libx264 @ 0000027964ad6300] frame P:17    Avg QP:21.66  size: 23672&#xA;[libx264 @ 0000027964ad6300] frame B:50    Avg QP:28.20  size:  3276&#xA;[libx264 @ 0000027964ad6300] consecutive B-frames:  1.5%  0.0%  4.4% 94.1%&#xA;[libx264 @ 0000027964ad6300] mb I  I16..4:  1.1% 53.0% 45.9%&#xA;[libx264 @ 0000027964ad6300] mb P  I16..4:  1.8%  9.3%  1.2%  P16..4: 29.5% 10.2% 14.0%  0.0%  0.0%    skip:34.0%&#xA;[libx264 @ 0000027964ad6300] mb B  I16..4:  0.1%  0.5%  0.0%  B16..8: 21.1%  3.3%  1.3%  direct: 2.0%  skip:71.7%  L0:50.9% L1:46.2% BI: 2.9%&#xA;[libx264 @ 0000027964ad6300] 8x8 transform intra:68.9% inter:94.3%&#xA;[libx264 @ 0000027964ad6300] coded y,uvDC,uvAC intra: 78.9% 70.2% 26.1% inter: 10.9% 8.9% 1.7%&#xA;[libx264 @ 0000027964ad6300] i16 v,h,dc,p: 31% 36% 32%  1%&#xA;[libx264 @ 0000027964ad6300] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 22% 40%  4%  2%  2%  3%  2% 10%&#xA;[libx264 @ 0000027964ad6300] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 32%  8%  4%  4%  4%  6%  4%  9%&#xA;[libx264 @ 0000027964ad6300] i8c dc,h,v,p: 35% 36% 24%  5%&#xA;[libx264 @ 0000027964ad6300] Weighted P-Frames: Y:0.0% UV:0.0%&#xA;[libx264 @ 0000027964ad6300] ref P L0: 60.0% 17.6%  9.3% 13.1%&#xA;[libx264 @ 0000027964ad6300] ref B L0: 73.1% 20.1%  6.8%&#xA;[libx264 @ 0000027964ad6300] ref B L1: 88.0% 12.0%&#xA;[libx264 @ 0000027964ad6300] kb/s:840.93&#xA;Conversion failed!&#xA;&#xA;

    &#xA;

    Are there any parameters in my pipeline that are causing the process to crash ?

    &#xA;