Recherche avancée

Médias (1)

Mot : - Tags -/biomaping

Autres articles (99)

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

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

Sur d’autres sites (14485)

  • Extremely slow ffmpeg/sws_scale() - only on heavy duty

    28 septembre 2020, par user2328447

    I am writing a video player using ffmpeg (Windows only, Visual Studio 2015, 64 bit compile).
With common videos (up to 4K @ 30FPS), it works pretty good. But with my maximum target - 4K @ 60FPS, it fails. Decoding still is fast enough, but when it comes to YUV/BGRA conversion it is simply not fast enough, even though it's done in 16 threads (one thread per frame on a 16/32 core machine).

    



    So as a first countermeasure I skipped the conversion of some frames and got a stable frame rate of 40 that way. Comparing the two versions in Concurrency Visualizer, I found a strange issue I don't know the reason of.

    



    .

    



    Here's an image of the frameskip version :
enter image description here
You see that the conversion is pretty quick (average roughly 35ms)
Thus, as multiple threads are used, it also should be quick enough for 60FPS, but it isn't !

    



    .

    



    The image of the non-frameskip version shows why :
enter image description here
The conversion of a single frame has become ten times slower than before (average roughly 350ms). Now a heavy workload on many cores would of course cause a minor slowdown per core due to reduced turbo - let's say 10 or 20%. But never an extreme slowdown of 1000%.

    



    .

    



    Interesting detail is, that the stack trace of the non-frameskip version shows some system activity I don't really understand - beginning with ntoskrnl.exe!KiPageFault+0x373. There are no exceptions, other error messages or such - it just becomes extremely slow.

    



    Edit : A colleague just told me that this looks like a memory problem with paged-out memory at first glance - but my memory utilization is low (below 1GB, and more than 20GB free)

    



    Can anyone tell me what could be causing this ?

    


  • Open CV Codec FFMPEG Error fallback to use tag 0x7634706d/'mp4v'

    22 mai 2019, par Cohen

    Doing a filter recording and all is fine. The code is running, but at the end the video is not saved as MP4. I have this error :

    OpenCV: FFMPEG: tag 0x44495658/'XVID' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'

    Using a MAC and the code is running correctly, but is not saving. I tried to find more details about this error, but wasn’t so fortunate. I use as editor Sublime. The code run on Atom tough but is giving this error :

    OpenCV: FFMPEG: tag 0x44495658/'XVID' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
    2018-05-28 15:04:25.274 Python[17483:2224774] AVF: AVAssetWriter status: Cannot create file

    ....

    import numpy as np
    import cv2
    import random
    from utils import CFEVideoConf, image_resize
    import glob
    import math


    cap = cv2.VideoCapture(0)

    frames_per_seconds = 24
    save_path='saved-media/filter.mp4'
    config = CFEVideoConf(cap, filepath=save_path, res='360p')
    out = cv2.VideoWriter(save_path, config.video_type, frames_per_seconds, config.dims)


    def verify_alpha_channel(frame):
       try:
           frame.shape[3] # looking for the alpha channel
       except IndexError:
           frame = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)
       return frame


    def apply_hue_saturation(frame, alpha, beta):
       hsv_image = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
       h, s, v = cv2.split(hsv_image)
       s.fill(199)
       v.fill(255)
       hsv_image = cv2.merge([h, s, v])

       out = cv2.cvtColor(hsv_image, cv2.COLOR_HSV2BGR)
       frame = verify_alpha_channel(frame)
       out = verify_alpha_channel(out)
       cv2.addWeighted(out, 0.25, frame, 1.0, .23, frame)
       return frame


    def apply_color_overlay(frame, intensity=0.5, blue=0, green=0, red=0):
       frame = verify_alpha_channel(frame)
       frame_h, frame_w, frame_c = frame.shape
       sepia_bgra = (blue, green, red, 1)
       overlay = np.full((frame_h, frame_w, 4), sepia_bgra, dtype='uint8')
       cv2.addWeighted(overlay, intensity, frame, 1.0, 0, frame)
       return frame


    def apply_sepia(frame, intensity=0.5):
       frame = verify_alpha_channel(frame)
       frame_h, frame_w, frame_c = frame.shape
       sepia_bgra = (20, 66, 112, 1)
       overlay = np.full((frame_h, frame_w, 4), sepia_bgra, dtype='uint8')
       cv2.addWeighted(overlay, intensity, frame, 1.0, 0, frame)
       return frame


    def alpha_blend(frame_1, frame_2, mask):
       alpha = mask/255.0
       blended = cv2.convertScaleAbs(frame_1*(1-alpha) + frame_2*alpha)
       return blended


    def apply_circle_focus_blur(frame, intensity=0.2):
       frame = verify_alpha_channel(frame)
       frame_h, frame_w, frame_c = frame.shape
       y = int(frame_h/2)
       x = int(frame_w/2)

       mask = np.zeros((frame_h, frame_w, 4), dtype='uint8')
       cv2.circle(mask, (x, y), int(y/2), (255,255,255), -1, cv2.LINE_AA)
       mask = cv2.GaussianBlur(mask, (21,21),11 )

       blured = cv2.GaussianBlur(frame, (21,21), 11)
       blended = alpha_blend(frame, blured, 255-mask)
       frame = cv2.cvtColor(blended, cv2.COLOR_BGRA2BGR)
       return frame


    def portrait_mode(frame):
       cv2.imshow('frame', frame)
       gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
       _, mask = cv2.threshold(gray, 120,255,cv2.THRESH_BINARY)

       mask = cv2.cvtColor(mask, cv2.COLOR_GRAY2BGRA)
       blured = cv2.GaussianBlur(frame, (21,21), 11)
       blended = alpha_blend(frame, blured, mask)
       frame = cv2.cvtColor(blended, cv2.COLOR_BGRA2BGR)
       return frame


    def apply_invert(frame):
       return cv2.bitwise_not(frame)

    while(True):
       # Capture frame-by-frame
       ret, frame = cap.read()
       frame = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)
       #cv2.imshow('frame',frame)


       hue_sat = apply_hue_saturation(frame.copy(), alpha=3, beta=3)
       cv2.imshow('hue_sat', hue_sat)

       sepia = apply_sepia(frame.copy(), intensity=.8)
       cv2.imshow('sepia',sepia)

       color_overlay = apply_color_overlay(frame.copy(), intensity=.8, red=123, green=231)
       cv2.imshow('color_overlay',color_overlay)

       invert = apply_invert(frame.copy())
       cv2.imshow('invert', invert)

       blur_mask = apply_circle_focus_blur(frame.copy())
       cv2.imshow('blur_mask', blur_mask)

       portrait = portrait_mode(frame.copy())
       cv2.imshow('portrait',portrait)

       if cv2.waitKey(20) & 0xFF == ord('q'):
           break

    # When everything done, release the capture
    cap.release()
    cv2.destroyAllWindows()
  • Trouble getting video stream from Bebop 2 (python, open cv and ffmpeg)

    20 décembre 2018, par Seb A

    I’m currently working with the Bebop 2 drone from parrot and I would like to get the video stream from the bebop and to use the frame I get. To control the bebop I’m using this library : https://github.com/amymcgovern/pyparrot.

    First I’ve tried to use opencv by opening the sdp file used by the bebop to stream the video with this code :

    capture = cv2.VideoCapture('./bebop.sdp')

       while True :
           rt,img = capture.read()
           cv2.imshow("cam",img)
           cv2.waitKey(10)

    here is the content of the sdp file :

    c=IN IP4 192.168.42.1
    m=video 55004 RTP/AVP 96
    a=rtpmap:96 H264/90000

    but I got this error

    [rtp @ 0000020b890b3300] Protocol 'rtp' not on whitelist 'file,crypto'!
    warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:808)
    warning: ./bebop.sdp (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:809)
    False
    OpenCV Error: Assertion failed (size.width>0 && size.height>0) in cv::imshow, file C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp, line 331
    Traceback (most recent call last):
    File "pilotage.py", line 109, in <module>
      _main_(args)
    File "pilotage.py", line 56, in main
      cv2.imshow('drone view',im)
    cv2.error: C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:331: error: (-215) size.width>0 &amp;&amp; size.height>0 in function cv::imshow
    </module>

    I’ve seen that this is due to the ffmpeg command used by opencv that does not include the option -protocol_whitelist
    So I tried to get the image directly with ffmpeg by using this command

    "ffmpeg -protocol_whitelist \"file,rtp,udp\"  -i  ./bebop.sdp -r 30 -b:v 800k image_%03d.png &amp;"

    But the images I got were awful and useless.
    Like this one :
    bad quality photo

    So I tried different options to improve the quality but I can’t get it to work.
    Thanks for your help.

    I’m on windows 10 and using latest python version