Recherche avancée

Médias (91)

Autres articles (107)

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

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Que fait exactement ce script ?

    18 janvier 2011, par

    Ce script est écrit en bash. Il est donc facilement utilisable sur n’importe quel serveur.
    Il n’est compatible qu’avec une liste de distributions précises (voir Liste des distributions compatibles).
    Installation de dépendances de MediaSPIP
    Son rôle principal est d’installer l’ensemble des dépendances logicielles nécessaires coté serveur à savoir :
    Les outils de base pour pouvoir installer le reste des dépendances Les outils de développements : build-essential (via APT depuis les dépôts officiels) ; (...)

Sur d’autres sites (9630)

  • 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

    


  • Use ffmpeg to stream live content to azure media services

    19 mars 2018, par Dadicool

    I’ve been trying to stream content to azure media services using ffmpeg as it’s one of the options described here : http://azure.microsoft.com/blog/2014/09/18/azure-media-services-rtmp-support-and-live-encoders/

    My command is :

    ffmpeg -v verbose -i 300.mp4 -strict -2 -c:a aac -b:a 128k -ar 44100 -r 30 -g 60 -keyint_min 60 -b:v 400000 -c:v libx264 -preset medium -bufsize 400k -maxrate 400k -f flv rtmp://nessma-****.channel.mediaservices.windows.net:1935/live/584c99f5c47f424d9e83ac95364331e7

    I have made sure that the streaming endpoint has one active streaming unit, I also made sure that the channel is actually Ready and I even get it to start streaming (which makes a PublishURL available).

    When I execute the ffmpeg command to start streaming, I keep getting the following error :

    ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
     built on Dec 30 2014 11:31:18 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
     configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --arch=x86_64 --enable-runtime-cpudetect
     libavutil      54. 15.100 / 54. 15.100
     libavcodec     56. 13.100 / 56. 13.100
     libavformat    56. 15.102 / 56. 15.102
     libavdevice    56.  3.100 / 56.  3.100
     libavfilter     5.  2.103 /  5.  2.103
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  1.100 /  1.  1.100
     libpostproc    53.  3.100 / 53.  3.100
    Routing option strict to both codec and muxer layer
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] overread end of atom 'colr' by 1 bytes
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] stream 0, timescale not set
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] max_analyze_duration 5000000 reached at 5003637 microseconds
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '300.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: mp42isomavc1
       creation_time   : 2014-01-11 05:39:32
       genre           : Trailer
       artist          : Warner Bros.
       title           : 300: Rise of an Empire - Trailer 2
       encoder         : HandBrake 0.9.9 2013051800
       date            : 2014
     Duration: 00:02:33.24, start: 0.000000, bitrate: 7377 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 (1920x1088), 7219 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc (default)
       Metadata:
         creation_time   : 2014-01-11 05:39:32
         encoder         : JVT/AVC Coding
       Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 157 kb/s (default)
       Metadata:
         creation_time   : 2014-01-11 05:39:32
       Stream #0:2: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 101x150 [SAR 72:72 DAR 101:150], 90k tbr, 90k tbn, 90k tbc
    rtmp://nessma-****.channel.mediaservices.windows.net:1935/live/584c99f5c47f424d9e83ac95364331e7: Input/output error

    The Azure blog post clearly states that this should be possible but I can’t find a working example anywhere.

    Environment :

    • MacOS Maverick
    • FFMPEG installed from official build
    • 300.mp4 : 1080p trailer of the latest 300 movie
  • Use ffmpeg to stream live content to azure media services

    9 juin 2016, par Dadicool

    I’ve been trying to stream content to azure media services using ffmpeg as it’s one of the options described here : http://azure.microsoft.com/blog/2014/09/18/azure-media-services-rtmp-support-and-live-encoders/

    My command is :

    ffmpeg -v verbose -i 300.mp4 -strict -2 -c:a aac -b:a 128k -ar 44100 -r 30 -g 60 -keyint_min 60 -b:v 400000 -c:v libx264 -preset medium -bufsize 400k -maxrate 400k -f flv rtmp://nessma-****.channel.mediaservices.windows.net:1935/live/584c99f5c47f424d9e83ac95364331e7

    I have made sure that the streaming endpoint has one active streaming unit, I also made sure that the channel is actually Ready and I even get it to start streaming (which makes a PublishURL available).

    When I execute the ffmpeg command to start streaming, I keep getting the following error :

    ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
     built on Dec 30 2014 11:31:18 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
     configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --arch=x86_64 --enable-runtime-cpudetect
     libavutil      54. 15.100 / 54. 15.100
     libavcodec     56. 13.100 / 56. 13.100
     libavformat    56. 15.102 / 56. 15.102
     libavdevice    56.  3.100 / 56.  3.100
     libavfilter     5.  2.103 /  5.  2.103
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  1.100 /  1.  1.100
     libpostproc    53.  3.100 / 53.  3.100
    Routing option strict to both codec and muxer layer
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] overread end of atom 'colr' by 1 bytes
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] stream 0, timescale not set
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9a0a002c00] max_analyze_duration 5000000 reached at 5003637 microseconds
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '300.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: mp42isomavc1
       creation_time   : 2014-01-11 05:39:32
       genre           : Trailer
       artist          : Warner Bros.
       title           : 300: Rise of an Empire - Trailer 2
       encoder         : HandBrake 0.9.9 2013051800
       date            : 2014
     Duration: 00:02:33.24, start: 0.000000, bitrate: 7377 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 (1920x1088), 7219 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc (default)
       Metadata:
         creation_time   : 2014-01-11 05:39:32
         encoder         : JVT/AVC Coding
       Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 157 kb/s (default)
       Metadata:
         creation_time   : 2014-01-11 05:39:32
       Stream #0:2: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 101x150 [SAR 72:72 DAR 101:150], 90k tbr, 90k tbn, 90k tbc
    rtmp://nessma-****.channel.mediaservices.windows.net:1935/live/584c99f5c47f424d9e83ac95364331e7: Input/output error

    The Azure blog post clearly states that this should be possible but I can’t find a working example anywhere.

    Environment :

    • MacOS Maverick
    • FFMPEG installed from official build
    • 300.mp4 : 1080p trailer of the latest 300 movie