Recherche avancée

Médias (0)

Mot : - Tags -/presse-papier

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (6)

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

Sur d’autres sites (2038)

  • I have an application in flask where it streams a camera using ffmpeg, the problem is that I can not display the video from the camera using the GPU [closed]

    17 janvier, par Ruben

    I'll put you in context, I am using flask (python) to display a camera in the browser to stream it, for this I use the following Python code :

    


    command = [
     'ffmpeg',
     '-loglevel', 'warning',
     '-rtsp_transport', 'tcp',
     '-i', self.config['url'],
     '-map', '0:v:0', # fuerzo que solo procese el video
     '-vf', f'fps={self.config["fps"]},scale=640:360:force_original_aspect_ratio=decrease',
     '-c:v', 'h264_nvenc', # especificamos que queremos tirar de la gpu de nvidia
     '-preset', 'p7', # ajusta para la maxima calidad/velocidad (p1 mas rapida pero peor calidad - p7 más lento pero mejor calidad)
     '-qp', self.config['quality'], # control de calidad del codificador (0 [mejor calidad] - 51 [peor calidad])
     '-pix_fmt', 'yuv444p', # se mete explicitamente el formato de pixeles
     '-color_range', 'pc',
     '-an', # desactiva el audio
     '-f', 'image2pipe',
     'pipe:1'
] 

self.process = subprocess.Popen(
   command,
   stdout=subprocess.PIPE,
   stderr=subprocess.PIPE,
   bufsize=10**8
)


    


    The problem is that it does not display the video streaming, but it connects correctly to the camera.

    


    On the other hand, It show me the following warnings, which may have something to do with the display, it's probably the second warning that has to do with the pixel format :

    


    DEBUG :main:FFmpeg [camera1] : Guessed Channel Layout for Input Stream #0.1 : mono
DEBUG :main:FFmpeg [camera1] : [swscaler @ 0x560f70b78680] deprecated pixel format used, make sure you did set range correctly

    


    The server has different encodes installed :

    


    DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders : h264 h264_v4l2m2m h264_qsv h264_cuvid ) (encoders : libx264 libx264rgb h264_nvenc h264_omx h264_qsv h264_v4l2m2m h264_vaapi nvenc nvenc_h264 )

    


    Y uso el h264_nvenc, tambien el servidor tiene soporte de aceleración de hardware con :

    


    libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Hardware acceleration methods :
vdpau
cuda
vaapi
qsv
drm
opencl

    


    Between them h264_nvenc uses cuda

    


    I expand a little on the information it provides me when using h264_nvenc :

    


    Encoder h264_nvenc [NVIDIA NVENC H.264 encoder]:&#xA;    General capabilities: dr1 delay hardware&#xA;    Threading capabilities: none&#xA;    Supported hardware devices: cuda cuda&#xA;    Supported pixel formats: yuv420p nv12 p010le yuv444p p016le yuv444p16le bgr0 rgb0 cuda&#xA;h264_nvenc AVOptions:&#xA;  -preset            <int>        E..V....... Set the encoding preset (from 0 to 18) (default p4)&#xA;     default         0            E..V.......&#xA;     slow            1            E..V....... hq 2 passes&#xA;     medium          2            E..V....... hq 1 pass&#xA;     fast            3            E..V....... hp 1 pass&#xA;     hp              4            E..V.......&#xA;     hq              5            E..V.......&#xA;     bd              6            E..V.......&#xA;     ll              7            E..V....... low latency&#xA;     llhq            8            E..V....... low latency hq&#xA;     llhp            9            E..V....... low latency hp&#xA;     lossless        10           E..V.......&#xA;     losslesshp      11           E..V.......&#xA;     p1              12           E..V....... fastest (lowest quality)&#xA;     p2              13           E..V....... faster (lower quality)&#xA;     p3              14           E..V....... fast (low quality)&#xA;     p4              15           E..V....... medium (default)&#xA;     p5              16           E..V....... slow (good quality)&#xA;     p6              17           E..V....... slower (better quality)&#xA;     p7              18           E..V....... slowest (best quality)&#xA;  -tune              <int>        E..V....... Set the encoding tuning info (from 1 to 4) (default hq)&#xA;     hq              1            E..V....... High quality&#xA;     ll              2            E..V....... Low latency&#xA;     ull             3            E..V....... Ultra low latency&#xA;     lossless        4            E..V....... Lossless&#xA;  -profile           <int>        E..V....... Set the encoding profile (from 0 to 3) (default main)&#xA;     baseline        0            E..V.......&#xA;     main            1            E..V.......&#xA;     high            2            E..V.......&#xA;     high444p        3            E..V.......&#xA;  -level             <int>        E..V....... Set the encoding level restriction (from 0 to 62) (default auto)&#xA;     auto            0            E..V.......&#xA;     1               10           E..V.......&#xA;     1.0             10           E..V.......&#xA;     1b              9            E..V.......&#xA;     1.0b            9            E..V.......&#xA;     1.1             11           E..V.......&#xA;     1.2             12           E..V.......&#xA;     1.3             13           E..V.......&#xA;     2               20           E..V.......&#xA;     2.0             20           E..V.......&#xA;     2.1             21           E..V.......&#xA;     2.2             22           E..V.......&#xA;     3               30           E..V.......&#xA;     3.0             30           E..V.......&#xA;     3.1             31           E..V.......&#xA;     3.2             32           E..V.......&#xA;     4               40           E..V.......&#xA;     4.0             40           E..V.......&#xA;     4.1             41           E..V.......&#xA;     4.2             42           E..V.......&#xA;     5               50           E..V.......&#xA;     5.0             50           E..V.......&#xA;     5.1             51           E..V.......&#xA;     5.2             52           E..V.......&#xA;     6.0             60           E..V.......&#xA;     6.1             61           E..V.......&#xA;     6.2             62           E..V.......&#xA;  -rc                <int>        E..V....... Override the preset rate-control (from -1 to INT_MAX) (default -1)&#xA;     constqp         0            E..V....... Constant QP mode&#xA;     vbr             1            E..V....... Variable bitrate mode&#xA;     cbr             2            E..V....... Constant bitrate mode&#xA;     vbr_minqp       8388612      E..V....... Variable bitrate mode with MinQP (deprecated)&#xA;     ll_2pass_quality 8388616      E..V....... Multi-pass optimized for image quality (deprecated)&#xA;     ll_2pass_size   8388624      E..V....... Multi-pass optimized for constant frame size (deprecated)&#xA;     vbr_2pass       8388640      E..V....... Multi-pass variable bitrate mode (deprecated)&#xA;     cbr_ld_hq       8388616      E..V....... Constant bitrate low delay high quality mode&#xA;     cbr_hq          8388624      E..V....... Constant bitrate high quality mode&#xA;     vbr_hq          8388640      E..V....... Variable bitrate high quality mode&#xA;  -rc-lookahead      <int>        E..V....... Number of frames to look ahead for rate-control (from 0 to INT_MAX) (default 0)&#xA;  -surfaces          <int>        E..V....... Number of concurrent surfaces (from 0 to 64) (default 0)&#xA;  -cbr               <boolean>    E..V....... Use cbr encoding mode (default false)&#xA;  -2pass             <boolean>    E..V....... Use 2pass encoding mode (default auto)&#xA;  -gpu               <int>        E..V....... Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on. (from -2 to INT_MAX) (default any)&#xA;     any             -1           E..V....... Pick the first device available&#xA;     list            -2           E..V....... List the available devices&#xA;  -delay             <int>        E..V....... Delay frame output by the given amount of frames (from 0 to INT_MAX) (default INT_MAX)&#xA;  -no-scenecut       <boolean>    E..V....... When lookahead is enabled, set this to 1 to disable adaptive I-frame insertion at scene cuts (default false)&#xA;  -forced-idr        <boolean>    E..V....... If forcing keyframes, force them as IDR frames. (default false)&#xA;  -b_adapt           <boolean>    E..V....... When lookahead is enabled, set this to 0 to disable adaptive B-frame decision (default true)&#xA;  -spatial-aq        <boolean>    E..V....... set to 1 to enable Spatial AQ (default false)&#xA;  -spatial_aq        <boolean>    E..V....... set to 1 to enable Spatial AQ (default false)&#xA;  -temporal-aq       <boolean>    E..V....... set to 1 to enable Temporal AQ (default false)&#xA;  -temporal_aq       <boolean>    E..V....... set to 1 to enable Temporal AQ (default false)&#xA;  -zerolatency       <boolean>    E..V....... Set 1 to indicate zero latency operation (no reordering delay) (default false)&#xA;  -nonref_p          <boolean>    E..V....... Set this to 1 to enable automatic insertion of non-reference P-frames (default false)&#xA;  -strict_gop        <boolean>    E..V....... Set 1 to minimize GOP-to-GOP rate fluctuations (default false)&#xA;  -aq-strength       <int>        E..V....... When Spatial AQ is enabled, this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive) (from 1 to 15) (default 8)&#xA;  -cq                <float>      E..V....... Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control (from 0 to 51) (default 0)&#xA;  -aud               <boolean>    E..V....... Use access unit delimiters (default false)&#xA;  -bluray-compat     <boolean>    E..V....... Bluray compatibility workarounds (default false)&#xA;  -init_qpP          <int>        E..V....... Initial QP value for P frame (from -1 to 51) (default -1)&#xA;  -init_qpB          <int>        E..V....... Initial QP value for B frame (from -1 to 51) (default -1)&#xA;  -init_qpI          <int>        E..V....... Initial QP value for I frame (from -1 to 51) (default -1)&#xA;  -qp                <int>        E..V....... Constant quantization parameter rate control method (from -1 to 51) (default -1)&#xA;  -weighted_pred     <int>        E..V....... Set 1 to enable weighted prediction (from 0 to 1) (default 0)&#xA;  -coder             <int>        E..V....... Coder type (from -1 to 2) (default default)&#xA;     default         -1           E..V.......&#xA;     auto            0            E..V.......&#xA;     cabac           1            E..V.......&#xA;     cavlc           2            E..V.......&#xA;     ac              1            E..V.......&#xA;     vlc             2            E..V.......&#xA;  -b_ref_mode        <int>        E..V....... Use B frames as references (from 0 to 2) (default disabled)&#xA;     disabled        0            E..V....... B frames will not be used for reference&#xA;     each            1            E..V....... Each B frame will be used for reference&#xA;     middle          2            E..V....... Only (number of B frames)/2 will be used for reference&#xA;  -a53cc             <boolean>    E..V....... Use A53 Closed Captions (if available) (default true)&#xA;  -dpb_size          <int>        E..V....... Specifies the DPB size used for encoding (0 means automatic) (from 0 to INT_MAX) (default 0)&#xA;  -multipass         <int>        E..V....... Set the multipass encoding (from 0 to 2) (default disabled)&#xA;     disabled        0            E..V....... Single Pass&#xA;     qres            1            E..V....... Two Pass encoding is enabled where first Pass is quarter resolution&#xA;     fullres         2            E..V....... Two Pass encoding is enabled where first Pass is full resolution&#xA;  -ldkfs             <int>        E..V....... Low delay key frame scale; Specifies the Scene Change frame size increase allowed in case of single frame VBV and CBR (from 0 to 255) (default 0)&#xA;</int></int></int></boolean></int></int></int></int></int></int></int></boolean></boolean></float></int></boolean></boolean></boolean></boolean></boolean></boolean></boolean></boolean></boolean></boolean></int></int></boolean></boolean></int></int></int></int></int></int></int>

    &#xA;

    If anyone has some idea or needs more information to help me, I would appreciate it.

    &#xA;

  • How to take screenshots of streamers using the Twitch API

    10 décembre 2020, par oo92

    My goal is to create a dataset of gameplays on Twitch using the API. How I want to do it is this :

    &#xA;

      &#xA;
    1. Get a list of live streams using the API.
    2. &#xA;

    3. Use streamlink and ffmpeg on Python to take the screenshots through the Stream source
    4. &#xA;

    &#xA;

    To get the streams, I have the following code thanks to a SO user :

    &#xA;

    from twitch import TwitchClient&#xA;&#xA;client = TwitchClient(client_id=&#x27;<my client="client">&#x27;)&#xA;streams = client.streams.get_live_streams(limit=100)&#xA;&#xA;print(streams)&#xA;</my>

    &#xA;

    The output is this. Its a lot larger, I just made it shorter... :

    &#xA;

    [{&#x27;id&#x27;: 40889579422, &#x27;game&#x27;: &#x27;Among Us&#x27;, &#x27;broadcast_platform&#x27;: &#x27;live&#x27;, &#x27;community_id&#x27;: &#x27;&#x27;, &#x27;community_ids&#x27;: [], &#x27;viewers&#x27;: 74594, &#x27;video_height&#x27;: 1080, &#x27;average_fps&#x27;: 60, &#x27;delay&#x27;: 0, &#x27;created_at&#x27;: datetime.datetime(2020, 12, 9, 23, 53, 34), &#x27;is_playlist&#x27;: False, &#x27;stream_type&#x27;: &#x27;live&#x27;, &#x27;preview&#x27;: {&#x27;small&#x27;: &#x27;https://static-cdn.jtvnw.net/previews-ttv/live_user_sykkuno-80x45.jpg&#x27;, &#x27;medium&#x27;: &#x27;https://static-cdn.jtvnw.net/previews-ttv/live_user_sykkuno-320x180.jpg&#x27;, &#x27;large&#x27;: &#x27;https://static-cdn.jtvnw.net/previews-ttv/live_user_sykkuno-640x360.jpg&#x27;, &#x27;template&#x27;: &#x27;https://static-cdn.jtvnw.net/previews-ttv/live_user_sykkuno-{width}x{height}.jpg&#x27;}, &#x27;channel&#x27;: {&#x27;mature&#x27;: False, &#x27;status&#x27;: &#x27;amongus at 4 !!&#x27;, &#x27;broadcaster_language&#x27;: &#x27;en&#x27;, &#x27;broadcaster_software&#x27;: &#x27;&#x27;, &#x27;display_name&#x27;: &#x27;Sykkuno&#x27;, &#x27;game&#x27;: &#x27;Among Us&#x27;, &#x27;language&#x27;: &#x27;en&#x27;, &#x27;id&#x27;: 26154978, &#x27;name&#x27;: &#x27;sykkuno&#x27;, &#x27;created_at&#x27;: datetime.datetime(2011, 11, 15, 1, 29, 29, 140794), &#x27;updated_at&#x27;: datetime.datetime(2020, 12, 10, 0, 35, 50, 916363), &#x27;partner&#x27;: True, &#x27;logo&#x27;: &#x27;https://static-cdn.jtvnw.net/jtv_user_pictures/sykkuno-profile_image-6ab1e70e07e29e9b-300x300.jpeg&#x27;, &#x27;video_banner&#x27;: &#x27;https://static-cdn.jtvnw.net/jtv_user_pictures/4b654ce5-58dc-4fa6-b77c-7250bb2d5269-channel_offline_image-1920x1080.png&#x27;, &#x27;profile_banner&#x27;: &#x27;https://static-cdn.jtvnw.net/jtv_user_pictures/1caee146-3323-4d45-9907-96c20c224d3e-profile_banner-480.png&#x27;, &#x27;profile_banner_background_color&#x27;: &#x27;&#x27;, &#x27;url&#x27;: &#x27;https://www.twitch.tv/sykkuno&#x27;, &#x27;views&#x27;: 23590965, &#x27;followers&#x27;: 1928724, &#x27;broadcaster_type&#x27;: &#x27;&#x27;, &#x27;description&#x27;: &#x27;Hi ! &#x27;, &#x27;private_video&#x27;: False, &#x27;privacy_options_enabled&#x27;: False}}, ... &#xA;

    &#xA;

    First, I want to know how I can iterate through the JSON to get the channel name using the id. I tried to do it on my own but it said that it isn't subscriptable.

    &#xA;

    Second, I have the following code that tries to use ffmpeg to get a screenshot of the stream through its source :

    &#xA;

    import streamlink, os&#xA;&#xA;# This code connects to the streamer&#x27;s source&#xA;# Get the Twitch API to work so you can add the streamer&#x27;s name at the end of the link&#xA;username = &#x27;Sykkuno&#x27;&#xA;streams = streamlink.streams(&#x27;http://twitch.tv/&#x27; &#x2B; username)&#xA;&#xA;# Stream source&#xA;stream = streams["best"].url&#xA;&#xA;# Directory where the screenshots will be saved&#xA;dir_path = os.getcwd() &#x2B; &#x27;/&#x27; &#x2B; username&#xA;&#xA;# number of streamers&#xA;streamers = 1&#xA;&#xA;os.system(&#x27;ffmpeg -i &#x27; &#x2B; stream &#x2B;&#x27; -r 0.5 -f image2 ${dir}/output_%09d.jpg&#x27;)&#xA;

    &#xA;

    But that is throwing the following error :

    &#xA;

    ffmpeg version 4.1.3-0ppa1~18.04 Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)&#xA;  configuration: --prefix=/usr --extra-version=&#x27;0ppa1~18.04&#x27; --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-nonfree --enable-libfdk-aac --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared&#xA;  libavutil      56. 22.100 / 56. 22.100&#xA;  libavcodec     58. 35.100 / 58. 35.100&#xA;  libavformat    58. 20.100 / 58. 20.100&#xA;  libavdevice    58.  5.100 / 58.  5.100&#xA;  libavfilter     7. 40.101 /  7. 40.101&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  3.100 /  5.  3.100&#xA;  libswresample   3.  3.100 /  3.  3.100&#xA;  libpostproc    55.  3.100 / 55.  3.100&#xA;[hls,applehttp @ 0x557212854940] Opening &#x27;https://video-edge-c2a360.yto01.abs.hls.ttvnw.net/v1/segment/CuAErHgNDEVK3cqjkRZLcz4El99YD2ZSy9tgtjc3ZTrPuN4584-GY3DKYO3MFCBt9M3v8_7IfHAlLvHeUn2wq4d-VC7u4Zv2-k1Bee9IPmIXbFQLZFKrYiT98OTzFMDaElsEZ9Sr4MXz6FoAC1yXhhZ0MYahZVnZa1Tuqnn217nN_rN8wr7kdScBIir_Uo1s2C_I8_54mi2uzdgxB9AYj0a0kG2UtdPkUVA6Qc7XIZ0nUhEeObEf80N0uW9ZU6WHpO3V6G9RD0VkmwUexDWk9MaLy1NJuvLSzRaMfOmKxhrzn3UDoY4CrQN11KOnHYCiCOfvhZmMKzSqtiA8YP0Q9iS03eZZhPQ3WxBHWhd6VeZ0btNeeoudGX73EBIj4ujZnKWKfPiN8K_HLj5FZWqQ5m_4Q1llQlnSAfmhzXR9PHAkz8nxRVcFR-tFokGzFEfkZGHngPNz9boLmo4KHx6404rocPUcXbTHkYsWXZwFC356AhfrNn6x0JYHGfcDpRsEFebLQljEpCyhnNOHFEf9b7Ipeiy521cCupzoEz1uMrzW77h9FJwn0GwvY3jp2KwRXJMvArYwiUHccBmfW7ZDLO9vH7eJGUnAzoy586KMSPLVeLxWMWRDfKkAcI8vYXOIuxNb_MZKm2O_dcoFrDDta5TZn-MLjFquT47P9NbXxlTTJfimlYyMG17SPoW3KJVtAJmjoj0GZ1ehftLJWz1Qgd8zmg40u4g8fz867eCHW_Tiv65yd6qJZD-_bD3G916fm3KeA9bPyhalTD99CWhQL7f0apCfX_6IiQElgPT6kOrFI-ISEG4GdhIpFi4ubzSx29pm7H4aDIXx6BAI5ziHVMPbrg.ts&#x27; for reading&#xA;[hls,applehttp @ 0x557212854940] Opening &#x27;https://video-edge-c2a360.yto01.abs.hls.ttvnw.net/v1/segment/CuIECWLarz2I5hNCtGLSTDXbCIgahI91KOHXVmPHddzZediyiVbcicZpGakO99CJp1cK_6OnmOKBzZ3sn3KogNyPVRqSy32IpanlyPPUTz23TojfR5DTmJa3zampOzVMfETvvPEpj58-kGhQeQQGtK1zLV2h465RElCLkmc7SeWbXEZ5j6IQ38OVFZ0vdcMHVTNPtJaY7509bE196-9-5YYFiET_-kdkS2X6_lhVQBZrq45PBxApTzeLkDx9ZtGQx78dLr_tZepww_uVnJTwxI_TA3tU8z5_w8ml6rh0GK1W6lTlvuDkPKAwIDLvG736MtbPGz9cFPoRAFQxD3QSwAM-bO1grvWlNsOUDUYLXLNjuejmz8xmRpeE0pqJYxUboRZpxrPXTi52HcX8lpGT4Lx2z6hJcoi9npQttK58HDSHQ3cYH3rlNsYV_RlZ3F-u-fZSn8Em67-vAYeXAMaBe9xxv0Zu2n1TrdPICMyGmk-VgLK788IeDhxqM441GONGLxo6AF8RE5_OawTf9n_MVzImsX4LMn0oN8e8w6mjk7YDuNdA4mEl99Erg8xMdX6Q3fDYTdStaC-zQwXgMctfGpIsUpp91BtRBPMynFCxZ8fZB7NvGFNZTYWDvCZjisiwzs0N1pDdDM_Fkj3i46_Ou105z348PLHRA28Dt1qgn_NjzwRNoaowFx7PxQ-X2zRpAhwNcqaTOHYh5NYZHToVE16WiOe9HzVs_I_3Wqu44bypEsGrhxYhgXSGfvO757iTbErZHmkidsBF2BET5j3JeIifr4fJooalAKc_5uiSPMCGSTtV9hIQX5mQWJudg9UsMRp1AWVrnBoMQPAhy1UwBDtAOrBs.ts&#x27; for reading&#xA;Input #0, hls,applehttp, from &#x27;https://video-weaver.yto01.hls.ttvnw.net/v1/playlist/CvADco9ZO_szpL7RVLVI3U6zl4IMo2uaUBvZTWAyEOKETN-SxI3m3hLLxpmCfz06rlyCGCPimEbk28kKPSbVYtMThiZFRtLxnrdpLr5DWBQwbpIStPQwMetU4Z04Mkm3nEWplL8hpn69Cmd_eWSdI1yHubK_sRL-n1ml5akAEWWGkS0OgVRQTTsYv4RpkbeWc8wrr3DsDBDfyrxciGSZevnStZOLwg-tNuNu3VNugLigNG1HMsNdxoJGO6wLyO-6FL5EQidOiSw2THSibAvADAWMVOxNX2z39d-nJwbVprbWFnox_lDlh-y88uhjj_MpU6OwkXP9vgrBDEmKjtRbYsIN5N94-8pDFEB3yIYk10vUiuod1yfqztVCqWo5m9r48uINP1CD-Bwgybo6K7Oko-TUjMj43GqAu0mmPtkgPFO69LpQQMifZTn_XbVQ5UUfoCwyl-ljObfRE51aCvZP_dOTsUyqi_JRE8h-C3306aW1ISXwCs3YpnjDxJv6yKyWTktBvsN5NWMVzJg-_-MAtTmoy-w2ppbbOozLzyrGF4zfCetaHLmHtbsKe1Ed1nndJg9b6T7v-87ExrI0eQwRjH3gmBTgqu_peS5oQGBaDOe4QSGMNFgf8lQfuqvFH-miXgpk8RytdorzT7wB05iX7c3bhBIQ3FvvjNIal3IgvyxKatZs4BoMW_P_CuyZOUJs2_Yr.m3u8&#x27;:&#xA;  Duration: N/A, start: 60.000000, bitrate: N/A&#xA;  Program 0 &#xA;    Metadata:&#xA;      variant_bitrate : 0&#xA;    Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp&#xA;    Metadata:&#xA;      variant_bitrate : 0&#xA;    Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, unknown/bt709/unknown), 1920x1080, 29.97 tbr, 90k tbn, 2k tbc&#xA;    Metadata:&#xA;      variant_bitrate : 0&#xA;    Stream #0:2: Data: timed_id3 (ID3  / 0x20334449)&#xA;    Metadata:&#xA;      variant_bitrate : 0&#xA;Stream mapping:&#xA;  Stream #0:1 -> #0:0 (h264 (native) -> mjpeg (native))&#xA;Press [q] to stop, [?] for help&#xA;[swscaler @ 0x557213e262c0] deprecated pixel format used, make sure you did set range correctly&#xA;Output #0, image2, to &#x27;/output_%09d.jpg&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf58.20.100&#xA;    Stream #0:0: Video: mjpeg, yuvj420p(pc), 1920x1080, q=2-31, 200 kb/s, 0.50 fps, 0.50 tbn, 0.50 tbc&#xA;    Metadata:&#xA;      variant_bitrate : 0&#xA;      encoder         : Lavc58.35.100 mjpeg&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1&#xA;[image2 @ 0x557213012040] Could not open file : /output_000000001.jpg&#xA;av_interleaved_write_frame(): Input/output error&#xA;frame=    1 fps=0.0 q=7.5 Lsize=N/A time=00:00:02.00 bitrate=N/A speed=27.7x    &#xA;video:46kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;Conversion failed!&#xA;

    &#xA;

  • Is there a way to extract frames from a video file using ffmpeg to memory and make some manipulation on each frame ?

    28 octobre 2022, par Rojer Brief

    The goal is to extract each time a frame from the video file then make histogram from the image and then to move to the next frame. this way all the frames.

    &#xA;

    The frames extraction and the histogram manipulation is working fine when the frames have saved as images on the hard disk. but now i want to do it all in memory.

    &#xA;

    to extract the frames i'm using ffmpeg because i think it's fast enough :

    &#xA;

    ffmpeg -r 1 -i MyVid.mp4 -r 1 "$filename%03d.png&#xA;

    &#xA;

    for now i'm using the ffmpeg in command prompt window.

    &#xA;

    with this command it will save on the hard disk over 65000 images(frames).&#xA;but instead saving them on the hard disk i wonder if i can make the histogram manipulation on each frame in memory instead saving all the 65000 frames to the hard disk.

    &#xA;

    then i want to find specific images using the histogram and save to the hard disk this frames.

    &#xA;

    the histogram part for now is also using files from the hard disk and not from the memory :

    &#xA;

    private void btnLoadHistogram_Click(object sender, System.EventArgs e)&#xA;        {&#xA;            string[] files = Directory.GetFiles(@"d:\screenshots\", "*.jpg");&#xA;&#xA;            for (int i = 0; i &lt; files.Length; i&#x2B;&#x2B;)&#xA;            {&#xA;                sbInfo.Text = "Loading image";&#xA;                if (pbImage.Image != null)&#xA;                    pbImage.Image.Dispose();&#xA;&#xA;                pbImage.Image = Image.FromFile(files[i]);//txtFileName.Text);&#xA;&#xA;                Application.DoEvents();&#xA;&#xA;                sbInfo.Text = "Computing histogram";&#xA;                long[] myValues = GetHistogram(new Bitmap(pbImage.Image));&#xA;&#xA;                Histogram.DrawHistogram(myValues);&#xA;&#xA;                sbInfo.Text = "";   &#xA;            }   &#xA;        }&#xA;&#xA;        public long[] GetHistogram(System.Drawing.Bitmap picture)&#xA;        {&#xA;            long[] myHistogram = new long[256];&#xA;&#xA;            for (int i=0;i3;&#xA;                    myHistogram[Temp]&#x2B;&#x2B;;&#xA;                }&#xA;&#xA;            return myHistogram;&#xA;        }&#xA;

    &#xA;

    and the code of the class of the constrol HistogramaDesenat :

    &#xA;

    using System;&#xA;using System.Collections;&#xA;using System.ComponentModel;&#xA;using System.Drawing;&#xA;using System.Data;&#xA;using System.Windows.Forms;&#xA;&#xA;namespace Histograma&#xA;{&#xA;    /// <summary>&#xA;    /// Summary description for HistogramaDesenat.&#xA;    /// </summary>&#xA;    public class HistogramaDesenat : System.Windows.Forms.UserControl&#xA;    {&#xA;        /// <summary> &#xA;        /// Required designer variable.&#xA;        /// </summary>&#xA;        private System.ComponentModel.Container components = null;&#xA;&#xA;        public HistogramaDesenat()&#xA;        {&#xA;            // This call is required by the Windows.Forms Form Designer.&#xA;            InitializeComponent();&#xA;&#xA;            // TODO: Add any initialization after the InitializeComponent call&#xA;&#xA;            this.Paint &#x2B;= new PaintEventHandler(HistogramaDesenat_Paint);&#xA;            this.Resize&#x2B;=new EventHandler(HistogramaDesenat_Resize);&#xA;        }&#xA;&#xA;        /// <summary> &#xA;        /// Clean up any resources being used.&#xA;        /// </summary>&#xA;        protected override void Dispose( bool disposing )&#xA;        {&#xA;            if( disposing )&#xA;            {&#xA;                if(components != null)&#xA;                {&#xA;                    components.Dispose();&#xA;                }&#xA;            }&#xA;            base.Dispose( disposing );&#xA;        }&#xA;&#xA;        #region Component Designer generated code&#xA;        /// <summary> &#xA;        /// Required method for Designer support - do not modify &#xA;        /// the contents of this method with the code editor.&#xA;        /// </summary>&#xA;        private void InitializeComponent()&#xA;        {&#xA;            // &#xA;            // HistogramaDesenat&#xA;            // &#xA;            this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));&#xA;            this.Name = "HistogramaDesenat";&#xA;            this.Size = new System.Drawing.Size(208, 176);&#xA;        }&#xA;        #endregion&#xA;&#xA;        private void HistogramaDesenat_Paint(object sender, PaintEventArgs e)&#xA;        {&#xA;            if (myIsDrawing)&#xA;            {&#xA;&#xA;                Graphics g = e.Graphics;&#xA;                Pen myPen = new Pen(new SolidBrush(myColor),myXUnit);&#xA;                //The width of the pen is given by the XUnit for the control.&#xA;                for (int i=0;i/We draw each line &#xA;                    g.DrawLine(myPen,&#xA;                        new PointF(myOffset &#x2B; (i*myXUnit), this.Height - myOffset), &#xA;                        new PointF(myOffset &#x2B; (i*myXUnit), this.Height - myOffset - myValues[i] * myYUnit));&#xA;&#xA;                    //We plot the coresponding index for the maximum value.&#xA;                    if (myValues[i]==myMaxValue)&#xA;                    {&#xA;                        SizeF mySize = g.MeasureString(i.ToString(),myFont);&#xA;&#xA;                        g.DrawString(i.ToString(),myFont,new SolidBrush(myColor),&#xA;                            new PointF(myOffset &#x2B; (i*myXUnit) - (mySize.Width/2), this.Height - myFont.Height ),&#xA;                            System.Drawing.StringFormat.GenericDefault);&#xA;                    }&#xA;                }&#xA;&#xA;                //We draw the indexes for 0 and for the length of the array beeing plotted&#xA;                g.DrawString("0",myFont, new SolidBrush(myColor),new PointF(myOffset,this.Height - myFont.Height),System.Drawing.StringFormat.GenericDefault);&#xA;                g.DrawString((myValues.Length-1).ToString(),myFont, &#xA;                    new SolidBrush(myColor),&#xA;                    new PointF(myOffset &#x2B; (myValues.Length * myXUnit) - g.MeasureString((myValues.Length-1).ToString(),myFont).Width,&#xA;                    this.Height - myFont.Height),&#xA;                    System.Drawing.StringFormat.GenericDefault);&#xA;&#xA;                //We draw a rectangle surrounding the control.&#xA;                g.DrawRectangle(new System.Drawing.Pen(new SolidBrush(Color.Black),1),0,0,this.Width-1,this.Height-1);&#xA;            }&#xA;&#xA;        }&#xA;&#xA;        long myMaxValue;&#xA;        private long[] myValues;&#xA;        private bool myIsDrawing;&#xA;&#xA;        private float myYUnit; //this gives the vertical unit used to scale our values&#xA;        private float myXUnit; //this gives the horizontal unit used to scale our values&#xA;        private int myOffset = 20; //the offset, in pixels, from the control margins.&#xA;&#xA;        private Color myColor = Color.Black;&#xA;        private Font myFont = new Font("Tahoma",10);&#xA;&#xA;        [Category("Histogram Options")]&#xA;        [Description ("The distance from the margins for the histogram")]&#xA;        public int Offset&#xA;        {&#xA;            set&#xA;            {&#xA;                if (value>0)&#xA;                    myOffset= value;&#xA;            }&#xA;            get&#xA;            {&#xA;                return myOffset;&#xA;            }&#xA;        }&#xA;&#xA;        [Category("Histogram Options")]&#xA;        [Description ("The color used within the control")]&#xA;        public Color DisplayColor&#xA;        {&#xA;            set&#xA;            {&#xA;                myColor = value;&#xA;            }&#xA;            get&#xA;            {&#xA;                return myColor;&#xA;            }&#xA;        }&#xA;&#xA;        /// <summary>&#xA;        /// We draw the histogram on the control&#xA;        /// </summary>&#xA;        /// The values beeing draw&#xA;        public void DrawHistogram(long[] Values)&#xA;        {&#xA;            myValues = new long[Values.Length];&#xA;            Values.CopyTo(myValues,0);&#xA;&#xA;            myIsDrawing = true;&#xA;            myMaxValue = getMaxim(myValues);&#xA;&#xA;            ComputeXYUnitValues();&#xA;&#xA;            this.Refresh();&#xA;        }&#xA;&#xA;        /// <summary>&#xA;        /// We get the highest value from the array&#xA;        /// </summary>&#xA;        /// The array of values in which we look&#xA;        /// <returns>The maximum value</returns>&#xA;        private long getMaxim(long[] Vals)&#xA;        {&#xA;            if (myIsDrawing)&#xA;            {&#xA;                long max = 0;&#xA;                for (int i=0;i max)&#xA;                        max = Vals[i];&#xA;                }&#xA;                return max;&#xA;            }&#xA;            return 1;&#xA;        }&#xA;&#xA;        private void HistogramaDesenat_Resize(object sender, EventArgs e)&#xA;        {&#xA;            if (myIsDrawing)&#xA;            {&#xA;                ComputeXYUnitValues();&#xA;            }&#xA;            this.Refresh();&#xA;        }&#xA;&#xA;        private void ComputeXYUnitValues()&#xA;        {&#xA;            myYUnit = (float) (this.Height - (2 * myOffset)) / myMaxValue;&#xA;            myXUnit = (float) (this.Width - (2 * myOffset)) / (myValues.Length-1);&#xA;        }&#xA;    }&#xA;}&#xA;

    &#xA;

    so in the end this is what i want to do :

    &#xA;

      &#xA;
    • extract the frames from the video file in memory using the ffmpeg.

      &#xA;

    • &#xA;

    • instead using Directory.GetFiles i want to make the histogram manipulation on each frame from the memory that is extracted by the ffmpeg.

      &#xA;

    • &#xA;

    • each extracted frame image to use the histogram to find if there is a lightning(weather lightning) in the image.

      &#xA;

    • &#xA;

    • if there is a lightning save the frame image to the hard disk.

      &#xA;

    • &#xA;

    &#xA;