Recherche avancée

Médias (3)

Mot : - Tags -/pdf

Autres articles (61)

  • 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 (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

Sur d’autres sites (9012)

  • Changing video encoding quality : Raspberry pi+v4l2 (ffmpeg or direct v4l2 API)

    24 octobre 2023, par Bill Shubert

    We are using a raspberry pi 4 to acquire video. Using the x264 library for software encoding, we were able to select a usable quality level (generally in the 16-20 range), but the compression speed was much too slow to keep up with the video feed. We switched to ffmpeg's v4l2 hardware encoder, and it's plenty fast enough to keep up with the incoming video, but now the output is poor quality, too low to be usable for our application. We have tried the ffmpeg -crf flag from 20 all the way down to 5, and it seems to have little or no effect on the video quality. I dug through the ffmpeg source code and can't find any references to "crf", "quality", or even compression rate in the v4l2 codec of ffmpeg.

    


    Is there a way to change the quality level of your encoded video using the PI's v4l2 hardware video encoder ? If so, does ffmpeg support it in some way ? Hopefully I just missed how to pass it in. If raspi+video4linux does support selecting output quality, but ffmpeg doesn't use it, then I could either patch ffmpeg or write my own code to drive v4l2, but it's not a simple API to use so I'd rather stay with ffmpeg if I can.

    


  • Python OpenCV VideoCapture Color Differs from ffmpeg and Other Media Players

    17 avril 2024, par cliffsu

    I’m working on video processing in Python and have noticed a slight color difference when using cv2.VideoCapture to read videos compared to other media players.

    


    enter image description here

    


    I then attempted to read the video frames directly using ffmpeg, and despite using the ffmpeg backend in OpenCV, there are still differences between OpenCV’s and ffmpeg’s output. The frames read by ffmpeg match those from other media players.

    


    enter image description here

    


    Below are the videos I’m using for testing :

    


    test3.webm

    


    test.avi

    


    Here is my code :

    


    import cv2
import numpy as np
import subprocess

def read_frames(path, res):
    """Read numpy arrays of video frames. Path is the file path
       and res is the resolution as a tuple."""
    args = [
        "ffmpeg",
        "-i",
        path,
        "-f",
        "image2pipe",
        "-pix_fmt",
        "rgb24",
        "-vcodec",
        "rawvideo",
        "-",
    ]

    pipe = subprocess.Popen(
        args,
        stdout=subprocess.PIPE,
        stderr=subprocess.DEVNULL,
        bufsize=res[0] * res[1] * 3,
    )

    while pipe.poll() is None:
        frame = pipe.stdout.read(res[0] * res[1] * 3)
        if len(frame) > 0:
            array = np.frombuffer(frame, dtype="uint8")
            break

    pipe.stdout.close()
    pipe.wait()
    array = array.reshape((res[1], res[0], 3))
    array = cv2.cvtColor(array, cv2.COLOR_RGB2BGR)
    return array

ORIGINAL_VIDEO = 'test3.webm'

array = read_frames(ORIGINAL_VIDEO, (1280, 720))

cap = cv2.VideoCapture(ORIGINAL_VIDEO, cv2.CAP_FFMPEG)
while cap.isOpened():
    ret, frame = cap.read()
    if not ret:
        break
    print(frame.shape)
    cv2.imshow("Opencv Read", frame)
    cv2.imshow("FFmpeg Direct Read", array)
    cv2.waitKeyEx()
    cv2.waitKeyEx()
    break
cap.release()


    


    I’ve attempted to use different media players to compare cv2.VideoCapture and ffmpeg’s frame reading, to confirm that the issue lies with opencv. I’m looking to determine whether it’s a bug in OpenCV or if there are issues in my code.

    


    EDIT :

    


    Just use the following code to check the difference between opencv read and ffmpeg read.

    


    cv2.imshow('test', cv2.absdiff(array, frame)*10)
cv2.waitKey(0)


    


    Here is the result :
enter image description here

    


  • ffmpeg doesnt use all the pictures when creating a video

    9 septembre 2022, par Mikhael Karabas

    I have 75 pictures of the same size for an animation. named 0.png ... 74.png
when running ffmpeg to create a video out of them with 24 fps (commmand and log below) the resulting video instead of expected 75/24 = 3.125 sec. is 2.667 sec in lenght and consists only of first 64 frames(pictures), although ffmpeg tells it has processed 75 frames.
I have checked with

    


    ffmpeg -i output.webm out%%d.png - on the resulting video, it indeed exports 64 first frames and not the rest 11 of them.

    


    Cant undertand what am i doing wrong. please kindly advise.

    


    brief output below.

    


    complete log : https://drive.google.com/file/d/1_J7wLPU9PJZ7jztpiJ8g_bZKPZfiK02L/view?usp=sharing

    


    D:\ffmpeg\ffmpeg-64.exe -report -framerate 24 -f image2 -i %01d.png -c:v libvpx-vp9 -pix_fmt yuva420p -crf 10 -b:v 0 output.webm
ffmpeg started on 2022-09-09 at 19:03:15
Report written to "ffmpeg-20220909-190315.log"
Log level: 48
ffmpeg version 2021-12-17-git-b780b6db64-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.2.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      57. 11.100 / 57. 11.100
  libavcodec     59. 14.100 / 59. 14.100
  libavformat    59. 10.100 / 59. 10.100
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8. 20.100 /  8. 20.100
  libswscale      6.  1.101 /  6.  1.101
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, image2, from '%01d.png':
  Duration: 00:00:03.13, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: png, rgba(pc), 300x400, 24 fps, 24 tbr, 24 tbn
File 'output.webm' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 000002dad505c8c0] v1.11.0-62-g7f45e94d9
Output #0, webm, to 'output.webm':
  Metadata:
    encoder         : Lavf59.10.100
  Stream #0:0: Video: vp9, yuva420p(tv, progressive), 300x400, q=2-31, 24 fps, 1k tbn
    Metadata:
      encoder         : Lavc59.14.100 libvpx-vp9
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=   75 fps=9.9 q=0.0 Lsize=    1056kB time=00:00:02.58 bitrate=3347.2kbits/s speed=0.342x
video:1036kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.942318%