Recherche avancée

Médias (91)

Autres articles (74)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

Sur d’autres sites (7933)

  • How extract JPEG image from H264 stream in constant time

    27 août 2021, par Ross Gardiner

    I want to extract a JPEG frame from a H264 stream on disk. The extraction needs to be as fast as possible for my real-time requirements.

    


    Until now I have been using ffmpeg-python lib which is just a python wrapper for ffmpeg. Here is a code snippet :

    


    out, _ = (
    ffmpeg
    .input('./5sec.h264')
    .filter('select', 'gte(n,{})'.format(144))
    .output('pipe:', vframes=1, format='image2', vcodec='h264')
    .run(capture_stdout=True)
)


    


    This outputs the jpeg to stdout, with some effort I could read this into my program.

    


    However, as I use larger and larger stream files the extraction time to grab the JPEG increases. I thought lookup time would be constant as ffmpeg is highly optimised ?

    


    Is there a constant time solution to lookup and return a frame from a h264 (or even mjpeg) format stream on disk ?

    


    Edit :
Heres the command I use without the python wrapper :
ffmpeg -i 5sec.h264 -frames:v 1 -filter:v "select=gte(n\,25)" -f image2 frame.jpg

    


    here's output :

    


    ffmpeg version 4.1.6-1~deb10u1+rpt2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (Raspbian 8.3.0-6+rpi1)
  configuration: --prefix=/usr --extra-version='1~deb10u1+rpt2' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, h264, from '5sec.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 640x480, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 0x1a25390] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'frame.jpg':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: mjpeg, yuvj420p(pc), 640x480, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.35.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame=    1 fps=0.4 q=6.8 Lsize=N/A time=00:00:01.04 bitrate=N/A speed=0.467x    
video:63kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown


    


    Note, achieved FPS is 0.4. When I increase the requested frame to be the 125th frame rather than the 25th, the FPS goes down to 0.1.

    


  • avformat/aviobuf : Avoid allocation when using dynamic buffer

    4 août 2021, par Andreas Rheinhardt
    avformat/aviobuf : Avoid allocation when using dynamic buffer
    

    This can be achieved by allocating the AVIOContext and
    the dynamic buffer's opaque and internal write buffer together.

    Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@outlook.com>

    • [DH] libavformat/aviobuf.c
  • asyncio.create_subprocess_shell error : Future exception was never retrieved - BrokenPipeError

    10 juin 2021, par Abdelmalek

    Whenever I use asyncio.create_subprocess_shell() with sp.communicate() I get this error at the end of my program.

    &#xA;

    If I run multiple suprocesses using asyncio, the error would be print at the end for each one of them.

    &#xA;

    Aulthough it doesn't affect my program, I want to find the source and fix the issue. Thanks for the help !

    &#xA;

    Traceback :

    &#xA;

    Future exception was never retrieved&#xA;future: <future finished="finished" exception="BrokenPipeError(32," pipe="pipe" has="has" been="been">&#xA;Traceback (most recent call last):&#xA;  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\asyncio\subprocess.py", line 153, in _feed_stdin&#xA;    await self.stdin.drain()&#xA;  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\asyncio\streams.py", line 387, in drain&#xA;    await self._protocol._drain_helper()&#xA;  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\asyncio\streams.py", line 197, in _drain_helper&#xA;    await waiter&#xA;  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 379, in _loop_writing&#xA;    f.result()&#xA;  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 812, in _poll&#xA;    value = callback(transferred, key, ov)&#xA;  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 538, in finish_send&#xA;    return ov.getresult()&#xA;BrokenPipeError: [WinError 109] The pipe has been ended&#xA;</future>

    &#xA;

    Code :

    &#xA;

    async def get(cs, url):&#xA;    async with cs.get(url) as r:&#xA;        b = b&#x27;&#x27;&#xA;        while True:&#xA;            chunk = await r.content.read(4000000)&#xA;            b &#x2B;= chunk&#xA;            if not chunk:&#xA;                break&#xA;        &#xA;        if int(r.headers[&#x27;content-length&#x27;]) &lt; 8000000:&#xA;            result = BytesIO(b)&#xA;            return [result, &#x27;full&#x27;]&#xA;        else:&#xA;            command = f"ffmpeg -y -i - -c:v copy -fs 8000000 -f matroska -"&#xA;            sp = await asyncio.create_subprocess_shell(command, stdin=asyncio.subprocess.PIPE,&#xA;                stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)&#xA;            stdout, stderr = await sp.communicate(b)&#xA;            sp.wait()&#xA;&#xA;            print(stderr.decode())&#xA;            print(len(stdout))&#xA;            output = str(stderr)&#xA;            index_d = output.find(&#x27;Duration: &#x27;)&#xA;            index_t = output.rfind(&#x27;time=&#x27;)&#xA;            duration = await get_sec(output[index_d &#x2B; 10:].split(",")[0])&#xA;            time_ = await get_sec(output[index_t &#x2B; 5:].split(" ")[0])&#xA;            percentage = f"{round((time_ / duration) * 100)}%"&#xA;&#xA;            result = BytesIO(stdout)&#xA;            return [result, &#x27;preview&#x27;, percentage]&#xA;&#xA;async def main(urls):&#xA;    async with aiohttp.ClientSession() as cs:&#xA;            &#xA;        tasks = []&#xA;        for url in urls:&#xA;            task = asyncio.create_task(get(cs, url))&#xA;            tasks.append(task)&#xA;        &#xA;        results = []&#xA;        for task in tasks:&#xA;            result = await task&#xA;            results.append(result)&#xA;        &#xA;        return results&#xA;&#xA;loop = asyncio.get_event_loop()&#xA;results = loop.run_until_complete(main(urls))&#xA;

    &#xA;