Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (40)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (4871)

  • Can open RTSP camera stream in FFMPEG but not in Gstreamer rtspsrc : Bad Request (400)

    6 août 2022, par Joran Apixa

    I have a Panasonic WV-SW559 camera set up as an RTSP stream.

    


    VLC can perfectly open the RTSP stream and display it, as well as FFMPEG.
However, when I try to set up a simple gstreamer pipeline, it does not want to open.
I execute the following command :

    


    gst-launch-1.0 rtspsrc --gst-debug=rtspsrc:5 location="rtspt://admin:12345@192.168.2.148:554/MediaInput/h264/stream_1" ! fakesink


    


    after which I get the following output :

    


    0:00:00.063009504 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:8617:gst_rtspsrc_uri_set_uri:<rtspsrc0> parsing URI&#xA;0:00:00.063074922 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:8624:gst_rtspsrc_uri_set_uri:<rtspsrc0> configuring URI&#xA;0:00:00.063111485 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:8640:gst_rtspsrc_uri_set_uri:<rtspsrc0> set uri: rtspt://admin:12345@192.168.2.148:554/MediaInput/h264/stream_1&#xA;0:00:00.063136642 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:8642:gst_rtspsrc_uri_set_uri:<rtspsrc0> request uri is: rtsp://192.168.2.148:554/MediaInput/h264/stream_1&#xA;Setting pipeline to PAUSED ...&#xA;0:00:00.064752828 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:8391:gst_rtspsrc_start:<rtspsrc0> starting&#xA;0:00:00.064910956 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:5567:gst_rtspsrc_loop_send_cmd:<rtspsrc0> sending cmd OPEN&#xA;0:00:00.064938405 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:5598:gst_rtspsrc_loop_send_cmd:<rtspsrc0> not interrupting busy cmd unknown&#xA;Pipeline is live and does not need PREROLL ...&#xA;0:00:00.065145962 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:8346:gst_rtspsrc_thread:<rtspsrc0> got command OPEN&#xA;0:00:00.065182682 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:4748:gst_rtspsrc_connection_flush:<rtspsrc0> set flushing 0&#xA;0:00:00.065214662 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:4614:gst_rtsp_conninfo_connect:<rtspsrc0> creating connection (rtspt://admin:12345@192.168.2.148:554/MediaInput/h264/stream_1)...&#xA;Progress: (open) Opening Stream&#xA;0:00:00.065652329 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:4625:gst_rtsp_conninfo_connect:<rtspsrc0> sanitized uri rtsp://192.168.2.148:554/MediaInput/h264/stream_1&#xA;0:00:00.065710611 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:4659:gst_rtsp_conninfo_connect:<rtspsrc0> connecting (rtspt://admin:12345@192.168.2.148:554/MediaInput/h264/stream_1)...&#xA;Progress: (connect) Connecting to rtspt://admin:12345@192.168.2.148:554/MediaInput/h264/stream_1&#xA;0:00:00.081446411 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:7342:gst_rtspsrc_retrieve_sdp:<rtspsrc0> create options... (async)&#xA;0:00:00.081494537 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:7351:gst_rtspsrc_retrieve_sdp:<rtspsrc0> send options...&#xA;0:00:00.081575581 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:476:default_before_send:<rtspsrc0> default handler&#xA;Progress: (open) Retrieving server options&#xA;0:00:00.081618707 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:476:default_before_send:<rtspsrc0> default handler&#xA;0:00:00.081671521 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:5964:gst_rtspsrc_try_send:<rtspsrc0> sending message&#xA;0:00:00.088226524 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:5866:gst_rtsp_src_receive_response:<rtspsrc0> received response message&#xA;0:00:00.088280901 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:5885:gst_rtsp_src_receive_response:<rtspsrc0> got response message 400&#xA;0:00:00.088321370 23339   0x55cd528a30 WARN                 rtspsrc gstrtspsrc.c:6161:gst_rtspsrc_send:<rtspsrc0> error: Unhandled error&#xA;0:00:00.088335798 23339   0x55cd528a30 WARN                 rtspsrc gstrtspsrc.c:6161:gst_rtspsrc_send:<rtspsrc0> error: Bad Request (400)&#xA;0:00:00.088454915 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:7514:gst_rtspsrc_retrieve_sdp:<rtspsrc0> free connection&#xA;0:00:00.088526323 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:4715:gst_rtsp_conninfo_close:<rtspsrc0> closing connection...&#xA;ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Unhandled error&#xA;Additional debug info:&#xA;gstrtspsrc.c(6161): gst_rtspsrc_send (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:&#xA;Bad Request (400)&#xA;ERROR: pipeline doesn&#x27;t want to preroll.&#xA;Setting pipeline to PAUSED ...&#xA;0:00:00.088648097 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:4721:gst_rtsp_conninfo_close:<rtspsrc0> freeing connection...&#xA;Setting pipeline to READY ...&#xA;0:00:00.088699505 23339   0x55cd528a30 WARN                 rtspsrc gstrtspsrc.c:7548:gst_rtspsrc_open:<rtspsrc0> can&#x27;t get sdp&#xA;0:00:00.088747891 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:8346:gst_rtspsrc_thread:<rtspsrc0> got command LOOP&#xA;0:00:00.088786121 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:4748:gst_rtspsrc_connection_flush:<rtspsrc0> set flushing 0&#xA;0:00:00.088812372 23339   0x55cd528a30 WARN                 rtspsrc gstrtspsrc.c:5628:gst_rtspsrc_loop:<rtspsrc0> we are not connected&#xA;0:00:00.088832841 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:5636:gst_rtspsrc_loop:<rtspsrc0> pausing task, reason flushing&#xA;0:00:00.088855394 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:5567:gst_rtspsrc_loop_send_cmd:<rtspsrc0> sending cmd WAIT&#xA;0:00:00.088885863 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:5585:gst_rtspsrc_loop_send_cmd:<rtspsrc0> cancel previous request LOOP&#xA;0:00:00.088905135 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:5593:gst_rtspsrc_loop_send_cmd:<rtspsrc0> connection flush busy LOOP&#xA;0:00:00.088923000 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:4748:gst_rtspsrc_connection_flush:<rtspsrc0> set flushing 1&#xA;0:00:00.088996595 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:5567:gst_rtspsrc_loop_send_cmd:<rtspsrc0> sending cmd CLOSE&#xA;0:00:00.089030346 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:5593:gst_rtspsrc_loop_send_cmd:<rtspsrc0> connection flush busy WAIT&#xA;0:00:00.089045971 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:4748:gst_rtspsrc_connection_flush:<rtspsrc0> set flushing 1&#xA;0:00:00.089085660 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:8346:gst_rtspsrc_thread:<rtspsrc0> got command CLOSE&#xA;0:00:00.089109462 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:4748:gst_rtspsrc_connection_flush:<rtspsrc0> set flushing 0&#xA;0:00:00.089129619 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:7569:gst_rtspsrc_close:<rtspsrc0> TEARDOWN...&#xA;Setting pipeline to NULL ...&#xA;0:00:00.089211288 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:7574:gst_rtspsrc_close:<rtspsrc0> not ready, doing cleanup&#xA;0:00:00.089263997 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:7637:gst_rtspsrc_close:<rtspsrc0> closing connection...&#xA;0:00:00.089300769 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:8422:gst_rtspsrc_stop:<rtspsrc0> stopping&#xA;0:00:00.089330926 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:5567:gst_rtspsrc_loop_send_cmd:<rtspsrc0> sending cmd WAIT&#xA;0:00:00.089333374 23339   0x55cd528a30 DEBUG                rtspsrc gstrtspsrc.c:2058:gst_rtspsrc_cleanup:<rtspsrc0> cleanup&#xA;0:00:00.089354260 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:5593:gst_rtspsrc_loop_send_cmd:<rtspsrc0> connection flush busy CLOSE&#xA;0:00:00.089419939 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:4748:gst_rtspsrc_connection_flush:<rtspsrc0> set flushing 1&#xA;0:00:00.089493430 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:7569:gst_rtspsrc_close:<rtspsrc0> TEARDOWN...&#xA;0:00:00.089520931 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:7574:gst_rtspsrc_close:<rtspsrc0> not ready, doing cleanup&#xA;0:00:00.089539212 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:7637:gst_rtspsrc_close:<rtspsrc0> closing connection...&#xA;0:00:00.089556192 23339   0x55cd6d9180 DEBUG                rtspsrc gstrtspsrc.c:2058:gst_rtspsrc_cleanup:<rtspsrc0> cleanup&#xA;Freeing pipeline ...&#xA;</rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0></rtspsrc0>

    &#xA;

    Does anyone have an idea on why this could occur ?

    &#xA;

  • How to fix laggy ffmpeg screen and audio capture ?

    26 juillet 2022, par Wh0r00t

    I am using ffmpeg to capture the screen along with audio.

    &#xA;

    The ffmpeg command that i tried is

    &#xA;

    ffmpeg -y \&#xA;    -f x11grab \&#xA;    -framerate 60 \&#xA;    -s 1366x768 \&#xA;    -i :0.0 \&#xA;    -f alsa -i default -ac 2 \&#xA;    -r 30 \&#xA;    -c:v h264 -crf 0 -preset ultrafast -c:a vorbis -strict experimental  \&#xA;    "$HOME/Videos/$fname-$(date &#x27;&#x2B;%y%m%d-%H%M-%S&#x27;).mkv"&#xA;

    &#xA;

    The stdout of the ffmpeg https://pastebin.com/Qmi5TMKv

    &#xA;

    ffmpeg version n5.0.1 Copyright (c) 2000-2022 the FFmpeg developers&#xA;  built with gcc 12.1.0 (GCC)&#xA;  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3&#xA;  libavutil      57. 17.100 / 57. 17.100&#xA;  libavcodec     59. 18.100 / 59. 18.100&#xA;  libavformat    59. 16.100 / 59. 16.100&#xA;  libavdevice    59.  4.100 / 59.  4.100&#xA;  libavfilter     8. 24.100 /  8. 24.100&#xA;  libswscale      6.  4.100 /  6.  4.100&#xA;  libswresample   4.  3.100 /  4.  3.100&#xA;  libpostproc    56.  3.100 / 56.  3.100&#xA;[x11grab @ 0x561faf77eb00] Stream #0: not enough frames to estimate rate; consider increasing probesize&#xA;Input #0, x11grab, from &#x27;:0.0&#x27;:&#xA;  Duration: N/A, start: 1658814267.169414, bitrate: 2014248 kb/s&#xA;  Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1366x768, 2014248 kb/s, 60 fps, 1000k tbr, 1000k tbn&#xA;Guessed Channel Layout for Input Stream #1.0 : stereo&#xA;Input #1, alsa, from &#x27;default&#x27;:&#xA;  Duration: N/A, start: 1658814267.230653, bitrate: 1536 kb/s&#xA;  Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))&#xA;  Stream #1:0 -> #0:1 (pcm_s16le (native) -> vorbis (native))&#xA;Press [q] to stop, [?] for help&#xA;[libx264 @ 0x561faf7d4300] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA3 BMI1&#xA;[libx264 @ 0x561faf7d4300] profile High 4:4:4 Predictive, level 3.2, 4:4:4, 8-bit&#xA;[libx264 @ 0x561faf7d4300] 264 - core 164 r3081 19856cc - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 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=cqp mbtree=0 qp=0&#xA;[alsa @ 0x561faf78a940] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)&#xA;Output #0, matroska, to &#x27;/home/earth/Videos/-220726-1114-27.mkv&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf59.16.100&#xA;  Stream #0:0: Video: h264 (H264 / 0x34363248), yuv444p(tv, progressive), 1366x768, q=2-31, 30 fps, 1k tbn&#xA;    Metadata:&#xA;      encoder         : Lavc59.18.100 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A&#xA;  Stream #0:1: Audio: vorbis (oV[0][0] / 0x566F), 48000 Hz, stereo, fltp&#xA;    Metadata:&#xA;      encoder         : Lavc59.18.100 vorbis&#xA;[vorbis @ 0x561faf7d5500] Queue input is backward in time0 bitrate=N/A speed=   0x&#xA;frame=  153 fps= 31 q=-1.0 Lsize=    2295kB time=00:00:05.06 bitrate=3709.5kbits/s dup=0 drop=150 speed=1.01x&#xA;video:2282kB audio:7kB subtitle:0kB other streams:0kB global headers:3kB muxing overhead: 0.281689%&#xA;[libx264 @ 0x561faf7d4300] frame I:1     Avg QP: 0.00  size:381729&#xA;[libx264 @ 0x561faf7d4300] frame P:152   Avg QP: 0.00  size: 12857&#xA;[libx264 @ 0x561faf7d4300] mb I  I16..4: 100.0%  0.0%  0.0%&#xA;[libx264 @ 0x561faf7d4300] mb P  I16..4: 56.3%  0.0%  0.0%  P16..4:  0.1%  0.0%  0.0%  0.0%  0.0%    skip:43.6%&#xA;[libx264 @ 0x561faf7d4300] coded y,u,v intra: 1.6% 1.6% 1.6% inter: 0.2% 0.2% 0.2%&#xA;[libx264 @ 0x561faf7d4300] i16 v,h,dc,p: 99%  1%  0%  0%&#xA;[libx264 @ 0x561faf7d4300] kb/s:3664.27&#xA;Exiting normally, received signal 15.&#xA;

    &#xA;

    I am using the preset ultrafast because I read that it helps not to compress the video too much.&#xA;The output of the recorded test file using ffmpeg is as below.

    &#xA;

     (&#x2B;) Video --vid=1 (h264 1366x768 30.000fps)&#xA; (&#x2B;) Audio --aid=1 (vorbis 2ch 48000Hz)&#xA;AO: [pulse] 48000Hz stereo 2ch float&#xA;VO: [gpu] 1366x768 yuv444p&#xA;AV: 00:00:03 / 00:00:19 (17%) A-V:  0.000&#xA;[mkv] Discarding potentially broken or useless index.&#xA;AV: 00:00:14 / 00:00:19 (73%) A-V:  0.000&#xA;&#xA;Exiting... (Quit)&#xA;

    &#xA;

    The recording works but there is a audio lag. If I record the same using simplescreenrecorder with the same settings like,

    &#xA;

    audio backend - alsa

    &#xA;

    source - default

    &#xA;

    audio codec - vorbis

    &#xA;

    video codec - h.264

    &#xA;

    container - matroska

    &#xA;

    preset - superfast

    &#xA;

    The simplescreenrecorder log https://pastebin.com/83hMMRQF

    &#xA;

    [PageRecord::StartPage] Starting page ...&#xA;[PageRecord::StartPage] Started page.&#xA;[PageRecord::StartOutput] Starting output ...&#xA;[PageRecord::StartOutput] Output file: /home/earth/Videos/simplescreenrecorder-2022-07-26_11.18.13.mkv&#xA;[Muxer::Init] Using format matroska (Matroska).&#xA;[Muxer::AddStream] Using codec libx264 (libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10).&#xA;[VideoEncoder::PrepareStream] Using pixel format nv12.&#xA;[libx264 @ 0x563436cbfd40] using SAR=1/1&#xA;[libx264 @ 0x563436cbfd40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX XOP FMA3 BMI1&#xA;[libx264 @ 0x563436cbfd40] profile High, level 3.2, 4:2:0, 8-bit&#xA;[libx264 @ 0x563436cbfd40] 264 - core 164 r3081 19856cc - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x3 me=dia subme=1 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=4 lookahead_threads=1 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=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 pb_ratio=1.30 aq=1:1.00&#xA;[Muxer::AddStream] Using codec libvorbis (libvorbis).&#xA;[BaseEncoder::EncoderThread] Encoder thread started.&#xA;[AudioEncoder::PrepareStream] Using sample format f32p.&#xA;[BaseEncoder::EncoderThread] Encoder thread started.&#xA;[Muxer::MuxerThread] Muxer thread started.&#xA;[PageRecord::StartOutput] Started output.&#xA;[Synchronizer::SynchronizerThread] Synchronizer thread started.&#xA;[PageRecord::StartInput] Starting input ...&#xA;[X11Input::Init] Using X11 shared memory.&#xA;[X11Input::Init] Detecting screen configuration ...&#xA;[X11Input::Init] Screen 0: x1 = 0, y1 = 0, x2 = 1366, y2 = 768&#xA;[X11Input::InputThread] Input thread started.&#xA;[ALSAInput::InputThread] Using sample format s16.&#xA;[PageRecord::StartInput] Started input.&#xA;[ALSAInput::InputThread] Input thread started.&#xA;[FastResampler::Resample] Resample ratio is 1.0000 (was 0.0000).&#xA;[PageRecord::StopOutput] Stopping output ...&#xA;[PageRecord::StopOutput] Stopped output.&#xA;[PageRecord::StopInput] Stopping input ...&#xA;[X11Input::~X11Input] Stopping input thread ...&#xA;[X11Input::InputThread] Input thread stopped.&#xA;[ALSAInput::~ALSAInput] Stopping input thread ...&#xA;[ALSAInput::InputThread] Input thread stopped.&#xA;[PageRecord::StopInput] Stopped input.&#xA;

    &#xA;

    It works perfectly without any lag whatsoever. The output of the recorded test file using simplescreenrecorder is as below.

    &#xA;

     (&#x2B;) Video --vid=1 (h264 1366x768)&#xA; (&#x2B;) Audio --aid=1 (vorbis 2ch 48000Hz)&#xA;AO: [pulse] 48000Hz stereo 2ch float&#xA;VO: [gpu] 1366x768 yuv420p&#xA;AV: 00:00:01 / 00:00:17 (7%) A-V:  0.000&#xA;[mkv] Discarding potentially broken or useless index.&#xA;AV: 00:00:08 / 00:00:17 (47%) A-V:  0.000&#xA;&#xA;Exiting... (Quit)&#xA;

    &#xA;

    The only difference that I saw between these two recordings is VO: [gpu] 1366x768 yuv444p&#xA;VO: [gpu] 1366x768 yuv420p for ffmpeg and simplescreenrecorder receptively.&#xA;I do not know if this matters but is there something that I could tweak to make ffmpeg to capture the screen and audio without any lag.&#xA;Like answered here https://unix.stackexchange.com/questions/675436/ffmpeg-recording-slows-down-when-audio-inputs-are-added&#xA;I do open pavucontrol but its not much of a help.

    &#xA;

    The reason that I going with ffmpeg is because I can kill the process using pid at a particular time using cronjobs.&#xA;These are my system information, in case if it helps

    &#xA;

    System:&#xA;  Host: taco Kernel: 5.18.12-arch1-1 arch: x86_64 bits: 64 Desktop: dwm&#xA;    v: 6.2 Distro: Arch Linux&#xA;Machine:&#xA;  Type: Desktop Mobo: Acer model: A75F2-M v: P21-A1 serial: N/A BIOS: Acer&#xA;    v: P21-A1 date: 02/07/2014&#xA;CPU:&#xA;  Info: quad core model: AMD A8-5500B APU with Radeon HD Graphics bits: 64&#xA;    type: MT MCP cache: L2: 4 MiB&#xA;  Speed (MHz): avg: 1400 min/max: 1400/3200 cores: 1: 1400 2: 1400 3: 1400&#xA;    4: 1400&#xA;Graphics:&#xA;  Device-1: AMD Trinity [Radeon HD 7560D] driver: radeon v: kernel&#xA;  Display: server: X.Org v: 21.1.4 driver: X: loaded: modesetting&#xA;    gpu: radeon resolution: 1366x768~60Hz&#xA;  OpenGL: renderer: AMD ARUBA (DRM 2.50.0 / 5.18.12-arch1-1 LLVM 14.0.6)&#xA;    v: 4.3 Mesa 22.1.3&#xA;Audio:&#xA;  Device-1: AMD FCH Azalia driver: snd_hda_intel&#xA;  Sound Server-1: ALSA v: k5.18.12-arch1-1 running: yes&#xA;  Sound Server-2: PulseAudio v: 16.1 running: yes&#xA;  Sound Server-3: PipeWire v: 0.3.56 running: yes&#xA;

    &#xA;

    Any help is much appreciated.

    &#xA;

  • DNN OpenCV Python using RSTP always crash after few minutes

    1er juillet 2022, par renaldyks

    Description :

    &#xA;

    I want to create a people counter using DNN. The model I'm using is MobileNetSSD. The camera I use is IPCam from Hikvision. Python communicates with IPCam using the RSTP protocol.

    &#xA;

    The program that I made is good and there are no bugs, when running the sample video the program does its job well. But when I replaced it with IPcam there was an unknown error.

    &#xA;

    Error :

    &#xA;

    Sometimes the error is :

    &#xA;

    [h264 @ 000001949f7adfc0] error while decoding MB 13 4, bytestream -6&#xA;[h264 @ 000001949f825ac0] left block unavailable for requested intra4x4 mode -1&#xA;[h264 @ 000001949f825ac0] error while decoding MB 0 17, bytestream 762&#xA;

    &#xA;

    Sometimes the error does not appear and the program is killed.

    &#xA;


    &#xA;

    Update Error

    &#xA;

    After revising the code, I caught the error. The error found is

    &#xA;

    [h264 @ 0000019289b3fa80] error while decoding MB 4 5, bytestream -25&#xA;

    &#xA;

    Now I don't know what to do, because the error is not in Google.

    &#xA;

    Source Code :

    &#xA;

    Old Code

    &#xA;

    This is my very earliest code before getting suggestions from the comments field.

    &#xA;

    import time&#xA;import cv2&#xA;import numpy as np&#xA;import math&#xA;import threading&#xA;&#xA;print("Load MobileNeteSSD model")&#xA;&#xA;prototxt = "MobileNetSSD_deploy.prototxt"&#xA;model = "MobileNetSSD_deploy.caffemodel"&#xA;&#xA;CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",&#xA;           "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",&#xA;           "dog", "horse", "motorbike", "person", "pottedplant", "sheep",&#xA;           "sofa", "train", "tvmonitor"]&#xA;&#xA;net = cv2.dnn.readNetFromCaffe(prototxt, model)&#xA;&#xA;pos_line = 0&#xA;offset = 50&#xA;car = 0&#xA;detected = False&#xA;check = 0&#xA;prev_frame_time = 0&#xA;&#xA;&#xA;def detect():&#xA;    global check, car, detected&#xA;    check = 0&#xA;    if(detected == False):&#xA;        car &#x2B;= 1&#xA;        detected = True&#xA;&#xA;&#xA;def center_object(x, y, w, h):&#xA;    cx = x &#x2B; int(w / 2)&#xA;    cy = y &#x2B; int(h / 2)&#xA;    return cx, cy&#xA;&#xA;&#xA;def process_frame_MobileNetSSD(next_frame):&#xA;    global car, check, detected&#xA;&#xA;    rgb = cv2.cvtColor(next_frame, cv2.COLOR_BGR2RGB)&#xA;    (H, W) = next_frame.shape[:2]&#xA;&#xA;    blob = cv2.dnn.blobFromImage(next_frame, size=(300, 300), ddepth=cv2.CV_8U)&#xA;    net.setInput(blob, scalefactor=1.0/127.5, mean=[127.5, 127.5, 127.5])&#xA;    detections = net.forward()&#xA;&#xA;    for i in np.arange(0, detections.shape[2]):&#xA;        confidence = detections[0, 0, i, 2]&#xA;&#xA;        if confidence > 0.5:&#xA;&#xA;            idx = int(detections[0, 0, i, 1])&#xA;            if CLASSES[idx] != "person":&#xA;                continue&#xA;&#xA;            label = CLASSES[idx]&#xA;&#xA;            box = detections[0, 0, i, 3:7] * np.array([W, H, W, H])&#xA;            (startX, startY, endX, endY) = box.astype("int")&#xA;&#xA;            center_ob = center_object(startX, startY, endX-startX, endY-startY)&#xA;            cv2.circle(next_frame, center_ob, 4, (0, 0, 255), -1)&#xA;&#xA;            if center_ob[0] &lt; (pos_line&#x2B;offset) and center_ob[0] > (pos_line-offset):&#xA;                # car&#x2B;=1&#xA;                detect()&#xA;&#xA;            else:&#xA;                check &#x2B;= 1&#xA;                if(check >= 5):&#xA;                    detected = False&#xA;&#xA;            cv2.putText(next_frame, label&#x2B;&#x27; &#x27;&#x2B;str(round(confidence, 2)),&#xA;                        (startX, startY-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)&#xA;            cv2.rectangle(next_frame, (startX, startY),&#xA;                          (endX, endY), (0, 255, 0), 3)&#xA;&#xA;    return next_frame&#xA;&#xA;&#xA;def PersonDetection_UsingMobileNetSSD():&#xA;    cap = cv2.VideoCapture()&#xA;    cap.open("rtsp://admin:Admin12345@192.168.100.20:554/Streaming/channels/2/")&#xA;&#xA;    global car,pos_line,prev_frame_time&#xA;&#xA;    frame_count = 0&#xA;&#xA;    while True:&#xA;        try:&#xA;            time.sleep(0.1)&#xA;            new_frame_time = time.time()&#xA;            fps = int(1/(new_frame_time-prev_frame_time))&#xA;            prev_frame_time = new_frame_time&#xA;&#xA;            ret, next_frame = cap.read()&#xA;            w_video = cap.get(cv2.CAP_PROP_FRAME_WIDTH)&#xA;            h_video = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)&#xA;            pos_line = int(h_video/2)-50&#xA;&#xA;            if ret == False: break&#xA;&#xA;            frame_count &#x2B;= 1&#xA;            cv2.line(next_frame, (int(h_video/2), 0),&#xA;                     (int(h_video/2), int(h_video)), (255, 127, 0), 3)&#xA;            next_frame = process_frame_MobileNetSSD(next_frame)&#xA;&#xA;            cv2.rectangle(next_frame, (248,22), (342,8), (0,0,0), -1)&#xA;            cv2.putText(next_frame, "Counter : "&#x2B;str(car), (250, 20),&#xA;                        cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)&#xA;            cv2.putText(next_frame, "FPS : "&#x2B;str(fps), (0, int(h_video)-10),&#xA;                        cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)&#xA;            cv2.imshow("Video Original", next_frame)&#xA;            # print(car)&#xA;&#xA;        except Exception as e:&#xA;            print(str(e))&#xA;&#xA;        if cv2.waitKey(1) &amp; 0xFF == ord(&#x27;q&#x27;): &#xA;            break&#xA;&#xA;&#xA;    print("/MobileNetSSD Person Detector")&#xA;&#xA;&#xA;    cap.release()&#xA;    cv2.destroyAllWindows()&#xA;&#xA;if __name__ == "__main__":&#xA;    t1 = threading.Thread(PersonDetection_UsingMobileNetSSD())&#xA;    t1.start()&#xA;

    &#xA;

    New Code

    &#xA;

    I have revised my code and the program still stops taking frames. I just revised the PersonDetection_UsingMobileNetSSD() function. I've also removed the multithreading I was using. The code has been running for about 30 minutes but after a broken frame, the code will never re-execute the program block if ret == True.

    &#xA;

    def PersonDetection_UsingMobileNetSSD():&#xA;    cap = cv2.VideoCapture()&#xA;    cap.open("rtsp://admin:Admin12345@192.168.100.20:554/Streaming/channels/2/")&#xA;&#xA;    global car,pos_line,prev_frame_time&#xA;&#xA;    frame_count = 0&#xA;&#xA;    while True:&#xA;        try:&#xA;            if cap.isOpened():&#xA;                ret, next_frame = cap.read()&#xA;                if ret:&#xA;                    new_frame_time = time.time()&#xA;                    fps = int(1/(new_frame_time-prev_frame_time))&#xA;                    prev_frame_time = new_frame_time&#xA;                    w_video = cap.get(cv2.CAP_PROP_FRAME_WIDTH)&#xA;                    h_video = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)&#xA;                    pos_line = int(h_video/2)-50&#xA;&#xA;                    # next_frame = cv2.resize(next_frame,(720,480),fx=0,fy=0, interpolation = cv2.INTER_CUBIC)&#xA;&#xA;                    if ret == False: break&#xA;&#xA;                    frame_count &#x2B;= 1&#xA;                    cv2.line(next_frame, (int(h_video/2), 0),&#xA;                            (int(h_video/2), int(h_video)), (255, 127, 0), 3)&#xA;                    next_frame = process_frame_MobileNetSSD(next_frame)&#xA;&#xA;                    cv2.rectangle(next_frame, (248,22), (342,8), (0,0,0), -1)&#xA;                    cv2.putText(next_frame, "Counter : "&#x2B;str(car), (250, 20),&#xA;                                cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)&#xA;                    cv2.putText(next_frame, "FPS : "&#x2B;str(fps), (0, int(h_video)-10),&#xA;                                cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)&#xA;                    cv2.imshow("Video Original", next_frame)&#xA;                    # print(car)&#xA;                else:&#xA;                    print("Crashed Frame")&#xA;            else:&#xA;                print("Cap is not open")&#xA;&#xA;        except Exception as e:&#xA;            print(str(e))&#xA;&#xA;        if cv2.waitKey(1) &amp; 0xFF == ord(&#x27;q&#x27;): &#xA;            break&#xA;&#xA;&#xA;    print("/MobileNetSSD Person Detector")&#xA;&#xA;&#xA;    cap.release()&#xA;    cv2.destroyAllWindows()&#xA;

    &#xA;

    Requirement :

    &#xA;

    Hardware : Intel i5-1035G1, RAM 8 GB, NVIDIA GeForce MX330

    &#xA;

    Software : Python 3.6.2 , OpenCV 4.5.1, Numpy 1.16.0

    &#xA;

    Question :

    &#xA;

      &#xA;
    1. What should i do for fixing this error ?
    2. &#xA;

    3. What causes this to happen ?
    4. &#xA;

    &#xA;

    Best Regards,

    &#xA;


    &#xA;

    Thanks

    &#xA;