Recherche avancée

Médias (91)

Autres articles (55)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

  • Problèmes fréquents

    10 mars 2010, par

    PHP et safe_mode activé
    Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
    La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site

Sur d’autres sites (6109)

  • I created a Python code to capture live video using FFmpeg, but the output screen only shows noise

    16 octobre 2024, par chun3 hyun

    The code below is Python code that made my computer screen video capture in real time via ffmpeg.

    


    When I run the code below, it goes well until a new window named 'Captured Frame' is created. But this 'Captured Frame' window doesn't show the full screen of my computer, and the gray screen is generating a lot of noise.

    


    import cv2
import numpy as np
import subprocess

def frame_capture():
    # Set FFmpeg command (capture desired window or area)
    ffmpeg_command = [
        'ffmpeg',
        '-f', 'gdigrab',  # Windows screen capture (using gdigrab)
        '-framerate', '30',  # Setting the Frame Speed
        '-i', 'desktop',  # What to capture (for example, full screen)
        '-pix_fmt', 'bgr0',
        '-vcodec', 'rawvideo',  # Video codec settings
        '-tune', 'zerolatency',
        '-an',  # Disable audio
        '-sn',  # Disable Caption
        '-f', 'rawvideo', '-'
    ]

    # Running the FFmpeg process
    process = subprocess.Popen(ffmpeg_command, stdout=subprocess.PIPE, bufsize=10**8)

    while True:
        # Read Frame from FFmpeg (Resolution Example: 1920x1080)
        raw_frame = process.stdout.read(1920 * 1080 * 3)  # 1920x1080 resolution, BGR format
        if not raw_frame:
            break  # Shut down the loop when you can no longer receive frames

        # Converting frame data to a numpy array
        frame = np.frombuffer(raw_frame, np.uint8).reshape((1080, 1920, 3))

        # Add frame processing code here
        # Example: Showing a frame on the screen
        cv2.imshow('Captured Frame', frame)

        # Press the 'q' key to end
        if cv2.waitKey(1) & 0xFF == ord('q'):
            break

    # End of process and release of resources
    process.stdout.close()
    process.wait()
    cv2.destroyAllWindows()
frame_capture()


    


    What could I have done wrong ? When I directly input the FFmpeg command in the Windows command prompt(knows as 'cmd') as shown below to save the video (in .mp4 format), I can see that the screen is output normally in the saved file. It seems that FFmpeg itself is installed correctly, but I don't know what the cause is.

    


    hwnd=132554 -pix_fmt yuv420p -vf "scale=iw-mod(iw\,2):ih-mod(ih\,2)" -draw_mouse 1 -t 10 output.mp4


    


    The handle number written above was the handle of the active Chrome window on my computer.

    


    My ffmpeg version is 2024-10-10-git-0f5592cfc7-full_build-www.gyan.dev My Python version is 3.12.4
My Windows version and build are as specified below.
:Windows 11 Home, 10.0.22631

    


    Capturing the computer screen with FFmpeg. I tried it, but the output screen shows only noise.

    


  • Moviepy is unable to load video

    20 octobre 2024, par Alex

    Using python 3.11.10 and moviepy 1.0.3 on ubuntu 24.04.1 (in a VirtualBox 7.1.3 on windows 10) I have problems to load a video clip. The test code is just

    


    from moviepy.editor import VideoFileClip
clip = VideoFileClip("testvideo.ts")


    


    but the error is

    


    Traceback (most recent call last):&#xA;  File "/home/alex/.cache/pypoetry/virtualenvs/pypdzug-WqasAXAr-py3.11/lib/python3.11/site-packages/moviepy/video/io/ffmpeg_reader.py", line 285, in ffmpeg_parse_infos&#xA;    line = [l for l in lines if keyword in l][index]&#xA;           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^&#xA;IndexError: list index out of range&#xA;&#xA;During handling of the above exception, another exception occurred:&#xA;&#xA;Traceback (most recent call last):&#xA;  File "/home/alex/Repos/pypdzug/tester.py", line 5, in <module>&#xA;    clip = VideoFileClip("testvideo.ts")&#xA;           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "/home/alex/.cache/pypoetry/virtualenvs/pypdzug-WqasAXAr-py3.11/lib/python3.11/site-packages/moviepy/video/io/VideoFileClip.py", line 88, in __init__&#xA;    self.reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt,&#xA;                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "/home/alex/.cache/pypoetry/virtualenvs/pypdzug-WqasAXAr-py3.11/lib/python3.11/site-packages/moviepy/video/io/ffmpeg_reader.py", line 35, in __init__&#xA;    infos = ffmpeg_parse_infos(filename, print_infos, check_duration,&#xA;            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "/home/alex/.cache/pypoetry/virtualenvs/pypdzug-WqasAXAr-py3.11/lib/python3.11/site-packages/moviepy/video/io/ffmpeg_reader.py", line 289, in ffmpeg_parse_infos&#xA;    raise IOError(("MoviePy error: failed to read the duration of file %s.\n"&#xA;OSError: MoviePy error: failed to read the duration of file testvideo.ts.&#xA;Here are the file infos returned by ffmpeg:&#xA;&#xA;ffmpeg version 4.2.2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with gcc 8 (Debian 8.3.0-6)&#xA;  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg&#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;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;</module>

    &#xA;

    It says it failed to read the duration of the file, but the file plays properly (with mplayer) and ffmpeg -i testvideo.ts returns

    &#xA;

    ffmpeg version 6.1.1-3ubuntu5 Copyright (c) 2000-2023 the FFmpeg developers&#xA;  built with gcc 13 (Ubuntu 13.2.0-23ubuntu3)&#xA;  configuration: --prefix=/usr --extra-version=3ubuntu5 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --disable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared&#xA;  libavutil      58. 29.100 / 58. 29.100&#xA;  libavcodec     60. 31.102 / 60. 31.102&#xA;  libavformat    60. 16.100 / 60. 16.100&#xA;  libavdevice    60.  3.100 / 60.  3.100&#xA;  libavfilter     9. 12.100 /  9. 12.100&#xA;  libswscale      7.  5.100 /  7.  5.100&#xA;  libswresample   4. 12.100 /  4. 12.100&#xA;  libpostproc    57.  3.100 / 57.  3.100&#xA;Input #0, mpegts, from &#x27;testvideo.ts&#x27;:&#xA;  Duration: 00:10:10.13, start: 0.133333, bitrate: 3256 kb/s&#xA;  Program 1 &#xA;    Metadata:&#xA;      service_name    : 2024-10-04 11:49:49.917&#xA;      service_provider: gvos-6.0&#xA;  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080, 15 fps, 15 tbr, 90k tbn&#xA;

    &#xA;

    Here the duration is clearly given to be 10 minutes and 10.13 seconds. So what could be the cause of this error/issue ?

    &#xA;

  • avformat : remove deprecated FF_API_GET_DUR_ESTIMATE_METHOD

    19 février, par James Almer
    avformat : remove deprecated FF_API_GET_DUR_ESTIMATE_METHOD
    

    Deprecated since 2024-03-06.

    Signed-off-by : James Almer <jamrial@gmail.com>

    • [DH] libavformat/avformat.h
    • [DH] libavformat/options.c
    • [DH] libavformat/version_major.h