Recherche avancée

Médias (2)

Mot : - Tags -/documentation

Autres articles (52)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Soumettre améliorations et plugins supplémentaires

    10 avril 2011

    Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
    Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...)

Sur d’autres sites (7244)

  • Why does OpenCV read video faster than FFMPEG ?

    17 septembre 2022, par tadejsv

    I noticed that OpenCV reads video frames almost 2x faster than FFMPEG.

    


    Why is that ? I thought all OpenCV does is call FFMPEG under the hood, possibly adding its own overhead.

    


    Here's the code I use to obtain these results

    


    import cv2
import time
import numpy as np

cap = cv2.VideoCapture("BigBuckBunny.mp4", apiPreference=cv2.CAP_FFMPEG)
frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))

start = time.perf_counter()
while True:
    ret, frame = cap.read()
    if ret is False:
        break
    assert frame.shape == (720, 1280, 3)
    assert frame.dtype == np.uint8
end = time.perf_counter()

print(f"{frames/(end-start):.1f} frames per second")
# Output: 692.3 frames per second

cap.release()


    


    For FFMPEG (using the python-ffmpeg library :

    


    import ffmpeg
import numpy as np
import time

vid_info = ffmpeg.probe("BigBuckBunny.mp4")['streams'][1]
frames = int(vid_info['nb_frames'])

process1 = (
    ffmpeg
    .input("BigBuckBunny.mp4")
    .output('pipe:', format='rawvideo', pix_fmt='bgr24')
)
print(process1.compile())
# Output: ['ffmpeg', '-i', 'BigBuckBunny.mp4', '-f', 'rawvideo', '-pix_fmt', 'bgr24', 'pipe:']


process1 = process1.run_async(pipe_stdout=True)

start = time.perf_counter()
while True:
    in_bytes = process1.stdout.read(1280 * 720 * 3)
    if not in_bytes:
        break
    frame = np.frombuffer(in_bytes, np.uint8).reshape([720, 1280, 3])
end = time.perf_counter()
print(f"{frames/(end-start):.1f} frames per second")
# Output: 373.6 frames per second
process1.wait()


    


    Here's information about the video ( 10 minutes length)

    


    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'BigBuckBunny.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2010-01-10T08:29:06.000000Z
  Duration: 00:09:56.47, start: 0.000000, bitrate: 2119 kb/s
  Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1991 kb/s, 24 fps, 24 tbr, 24k tbn, 48 tbc (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]


    


    And FFMPEG and OpenCV versions :

    


    ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers


    


    opencv-python-headless        4.6.0.66


    


  • error while compiling simple c++ file with libavformat library

    21 février 2023, par Abdo Daood

    i create simple c++ file called test.cpp

    


    #include <iostream>&#xA;#include &#xA;using namespace std;&#xA;&#xA;int main() &#xA;{&#xA;    cout &lt;&lt; "Hello, World!";&#xA;    return 0;&#xA;}&#xA;&#xA;</iostream>

    &#xA;

    and using g++ in terminal to compile test.cpp file with the command :

    &#xA;

    &#xA;

    g++ test.cpp -o test

    &#xA;

    &#xA;

    i get this error =>

    &#xA;

    test.cpp:2:10: fatal error: libavformat\avformat.h: No such file or directory&#xA;    2 | #include &#xA;      |          ^~~~~~~~~~~~~~~~~~~~~~~~&#xA;compilation terminated.&#xA;

    &#xA;

    Notes :&#xA;libavformat\avformat.h path is : /usr/include/x86_64-linux-gnu/libavformat/avformat.h

    &#xA;

    and using ffmpeg version is :

    &#xA;

    $ ffmpeg -version

    &#xA;

    ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers&#xA;built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)&#xA;configuration : —prefix=/usr —extra-version=0ubuntu0.22.04.1 —toolchain=hardened —libdir=/usr/lib/x86_64-linux-gnu —incdir=/usr/include/x86_64-linux-gnu —arch=amd64 —enable-gpl —disable-stripping —enable-gnutls —enable-ladspa —enable-libaom —enable-libass —enable-libbluray —enable-libbs2b —enable-libcaca —enable-libcdio —enable-libcodec2 —enable-libdav1d —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-librabbitmq —enable-librubberband —enable-libshine —enable-libsnappy —enable-libsoxr —enable-libspeex —enable-libsrt —enable-libssh —enable-libtheora —enable-libtwolame —enable-libvidstab —enable-libvorbis —enable-libvpx —enable-libwebp —enable-libx265 —enable-libxml2 —enable-libxvid —enable-libzimg —enable-libzmq —enable-libzvbi —enable-lv2 —enable-omx —enable-openal —enable-opencl —enable-opengl —enable-sdl2 —enable-pocketsphinx —enable-librsvg —enable-libmfx —enable-libdc1394 —enable-libdrm —enable-libiec61883 —enable-chromaprint —enable-frei0r —enable-libx264 —enable-shared&#xA;libavutil 56. 70.100 / 56. 70.100&#xA;libavcodec 58.134.100 / 58.134.100&#xA;libavformat 58. 76.100 / 58. 76.100&#xA;libavdevice 58. 13.100 / 58. 13.100&#xA;libavfilter 7.110.100 / 7.110.100&#xA;libswscale 5. 9.100 / 5. 9.100&#xA;libswresample 3. 9.100 / 3. 9.100&#xA;libpostproc 55. 9.100 / 55. 9.100

    &#xA;

    using this command :

    &#xA;

    g&#x2B;&#x2B; `pkg-config --cflags libavformat` test.cpp  `pkg-config --libs libavformat` -o test&#xA;&#xA;

    &#xA;

  • ffmpeg -f sdl works, ffmpeg -c codec -f sdl doesn't

    3 octobre 2022, par lunadir

    running on windows
    &#xA;anyone knows why this works

    &#xA;

    ffmpeg -re -i "sample_itunes.mp4" -an -f sdl2 -&#xA;

    &#xA;

    and this doesn't

    &#xA;

    ffmpeg -re -i "sample_itunes.mp4" -an -c libx264 -f sdl2 -&#xA;

    &#xA;

    doesn't show any window, output is

    &#xA;

    ffmpeg.exe -re -i "sample_itunes.mp4" -an -c libx264 -r 1 -f sdl2 -&#xA;ffmpeg version n4.4-79-gde1132a891-20210803 Copyright (c) 2000-2021 the FFmpeg developers&#xA;  built with gcc 10-win32 (GCC) 20210408&#xA;  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libvmaf --enable-vulkan --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-libglslang --enable-libgme --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20210803&#xA;  libavutil      56. 70.100 / 56. 70.100&#xA;  libavcodec     58.134.100 / 58.134.100&#xA;  libavformat    58. 76.100 / 58. 76.100&#xA;  libavdevice    58. 13.100 / 58. 13.100&#xA;  libavfilter     7.110.100 /  7.110.100&#xA;  libswscale      5.  9.100 /  5.  9.100&#xA;  libswresample   3.  9.100 /  3.  9.100&#xA;  libpostproc    55.  9.100 / 55.  9.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;sample_itunes.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    creation_time   : 2036-02-06T06:28:16.000000Z&#xA;    encoder         : HandBrake 0.10.2 2015060900&#xA;  Duration: 00:01:25.50, start: 0.000000, bitrate: 245 kb/s&#xA;  Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 640x480 [SAR 1:1 DAR 4:3], 116 kb/s, 10 fps, 10 tbr, 90k tbn, 180k tbc (default)&#xA;    Metadata:&#xA;      creation_time   : 2036-02-06T06:28:16.000000Z&#xA;      handler_name    : VideoHandler&#xA;      vendor_id       : [0][0][0][0]&#xA;  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 32000 Hz, mono, fltp, 125 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2036-02-06T06:28:16.000000Z&#xA;      handler_name    : Mono&#xA;      vendor_id       : [0][0][0][0]&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))&#xA;Press [q] to stop, [?] for help&#xA;[libx264 @ 0000025cce1ab7c0] using SAR=1/1&#xA;[libx264 @ 0000025cce1ab7c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2&#xA;[libx264 @ 0000025cce1ab7c0] profile High, level 2.2, 4:2:0, 8-bit&#xA;[sdl,sdl2 @ 0000025cce769040] Only supports one rawvideo stream&#xA;Output #0, sdl,sdl2, to &#x27;pipe:&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    encoder         : Lavf58.76.100&#xA;  Stream #0:0(und): Video: h264, yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 640x480 [SAR 1:1 DAR 4:3], q=2-31, 1 fps, 1 tbn (default)&#xA;    Metadata:&#xA;      creation_time   : 2036-02-06T06:28:16.000000Z&#xA;      handler_name    : VideoHandler&#xA;      vendor_id       : [0][0][0][0]&#xA;      encoder         : Lavc58.134.100 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A&#xA;[libx264 @ 0000025cce1ab7c0] non-strictly-monotonic PTSrate=N/A speed=   0x&#xA;    Last message repeated 3 times&#xA;[libx264 @ 0000025cce1ab7c0] non-strictly-monotonic PTSrate=N/A speed=   0x&#xA;    Last message repeated 3 times&#xA;[libx264 @ 0000025cce1ab7c0] non-strictly-monotonic PTSrate=N/A speed=   0x&#xA;    Last message repeated 4 times&#xA;[libx264 @ 0000025cce1ab7c0] non-strictly-monotonic PTSrate=N/A speed=   0x&#xA;    Last message repeated 3 times&#xA;[libx264 @ 0000025cce1ab7c0] non-strictly-monotonic PTSrate=N/A speed=   0x&#xA;    Last message repeated 4 times&#xA;[libx264 @ 0000025cce1ab7c0] non-strictly-monotonic PTSrate=N/A speed=   0x&#xA;    Last message repeated 3 times&#xA;[libx264 @ 0000025cce1ab7c0] non-strictly-monotonic PTSrate=N/A speed=   0x&#xA;debug=1&#xA;cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;    Last message repeated 4 times&#xA;[h264 @ 0000025ccc8fd8c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0&#xA;[libx264 @ 0000025cce1ab7c0] non-strictly-monotonic PTS&#xA;[h264 @ 0000025ccc8fd8c0] slice:1 F mb:0 B fix frame:15 poc:65622/65622 ref:1/1 qp:7 loop:1:0:0 weight:0 SPAT&#xA;cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;    Last message repeated 8 times&#xA;...&#xA;frame=   60 fps=8.4 q=25.0 Lsize=N/A time=-00:00:00.10 bitrate=N/A speed=N/A&#xA;video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;Input file #0 (sample_itunes.mp4):&#xA;  Input stream #0:0 (video): 74 packets read (22110 bytes); 61 frames decoded;&#xA;  Input stream #0:1 (audio): 1 packets read (18 bytes);&#xA;  Total: 75 packets (22128 bytes) demuxed&#xA;Output file #0 (pipe:):&#xA;  Output stream #0:0 (video): 60 frames encoded; 1 packets muxed (866 bytes);&#xA;  Total: 1 packets (866 bytes) muxed&#xA;61 frames successfully decoded, 0 decoding errors&#xA;[libx264 @ 000001d2952aa600] frame I:1     Avg QP: 7.93  size:   866&#xA;[libx264 @ 000001d2952aa600] frame P:23    Avg QP:13.48  size:   535&#xA;[libx264 @ 000001d2952aa600] frame B:36    Avg QP:10.98  size:    81&#xA;[libx264 @ 000001d2952aa600] consecutive B-frames: 16.7% 10.0%  0.0% 73.3%&#xA;[libx264 @ 000001d2952aa600] mb I  I16..4: 99.7%  0.1%  0.2%&#xA;[libx264 @ 000001d2952aa600] mb P  I16..4:  6.2%  3.1%  0.8%  P16..4:  1.4%  0.4%  0.2%  0.0%  0.0%    skip:88.1%&#xA;[libx264 @ 000001d2952aa600] mb B  I16..4:  0.2%  0.0%  0.0%  B16..8:  2.2%  0.2%  0.0%  direct: 0.1%  skip:97.2%  L0:35.9% L1:61.8% BI: 2.3%&#xA;[libx264 @ 000001d2952aa600] 8x8 transform intra:21.1% inter:48.3%&#xA;[libx264 @ 000001d2952aa600] coded y,uvDC,uvAC intra: 6.7% 1.9% 0.5% inter: 0.2% 0.1% 0.0%&#xA;[libx264 @ 000001d2952aa600] i16 v,h,dc,p: 57% 41%  2%  0%&#xA;[libx264 @ 000001d2952aa600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 34% 51%  0%  0%  0%  0%  1%  0%&#xA;[libx264 @ 000001d2952aa600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 34% 21%  2%  2%  3%  3%  3%  2%&#xA;[libx264 @ 000001d2952aa600] i8c dc,h,v,p: 84% 15%  2%  0%&#xA;[libx264 @ 000001d2952aa600] Weighted P-Frames: Y:0.0% UV:0.0%&#xA;[libx264 @ 000001d2952aa600] ref P L0: 84.5%  3.6%  6.3%  5.5%&#xA;[libx264 @ 000001d2952aa600] ref B L0: 78.0% 21.2%  0.9%&#xA;[libx264 @ 000001d2952aa600] ref B L1: 96.8%  3.2%&#xA;[libx264 @ 000001d2952aa600] kb/s:21.46&#xA;[AVIOContext @ 000001d29529e780] Statistics: 232272 bytes read, 2 seeks&#xA;Conversion failed!&#xA;

    &#xA;