Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (96)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

Sur d’autres sites (5594)

  • moviepy black border around png when compositing into an MP4

    27 août 2022, par OneWorld

    compositing a png into an MP4 video creates a black border around the edge.

    


    This is using moviepy 1.0.0

    


    Code below reproduces the MP4 with the attached red text png.

    


    enter image description here

    


    import numpy as np
import moviepy.editor as mped
def composite_txtpng_on_colour():
    bg_color = mped.ColorClip(size=[400, 300], color=np.array([0, 255, 0]).astype(np.uint8),
                          duration=2).set_position((0, 0))
    text_png_postition = [5, 5]
    text_png = mped.ImageClip("./txtpng.png", duration=3).set_position((text_png_postition))

    canvas_size = bg_color.size
    stacked_clips = mped.CompositeVideoClip([bg_color, text_png], size=canvas_size).set_duration(2)
    stacked_clips.write_videofile('text_with_black_border_video.mp4', fps=24)

composite_txtpng_on_colour()


    


    The result is an MP4 that can be played in VLC player. A screenshot of the black edge can be seen below :-

    


    enter image description here

    


    Any suggestions to remove the black borders would be much appreciated.

    


    Update : It looks like moviepy does a blit instead of alpha compositing.

    


    def blit(im1, im2, pos=None, mask=None, ismask=False):
    """ Blit an image over another.  Blits ``im1`` on ``im2`` as position ``pos=(x,y)``, using the
    ``mask`` if provided. If ``im1`` and ``im2`` are mask pictures
    (2D float arrays) then ``ismask`` must be ``True``.
    """
    if pos is None:
        pos = [0, 0]

    # xp1,yp1,xp2,yp2 = blit area on im2
    # x1,y1,x2,y2 = area of im1 to blit on im2
    xp, yp = pos
    x1 = max(0, -xp)
    y1 = max(0, -yp)
    h1, w1 = im1.shape[:2]
    h2, w2 = im2.shape[:2]
    xp2 = min(w2, xp + w1)
    yp2 = min(h2, yp + h1)
    x2 = min(w1, w2 - xp)
    y2 = min(h1, h2 - yp)
    xp1 = max(0, xp)
    yp1 = max(0, yp)

    if (xp1 >= xp2) or (yp1 >= yp2):
        return im2

    blitted = im1[y1:y2, x1:x2]

    new_im2 = +im2

    if mask is None:
        new_im2[yp1:yp2, xp1:xp2] = blitted
    else:
        mask = mask[y1:y2, x1:x2]
        if len(im1.shape) == 3:
            mask = np.dstack(3 * [mask])
        blit_region = new_im2[yp1:yp2, xp1:xp2]
        new_im2[yp1:yp2, xp1:xp2] = (1.0 * mask * blitted + (1.0 - mask) * blit_region)
    
    return new_im2.astype('uint8') if (not ismask) else new_im2


    


    and so, Rotem is right.

    


    new_im2[yp1:yp2, xp1:xp2] = (1.0 * mask * blitted + (1.0 - mask) * blit_region)


    


    is

    


    (alpha * img_rgb + (1.0 - alpha) * bg)


    


    and this is how moviepy composites. And this is why we see black at the edges.

    


  • avfilter/vf_ciescope : Fix undefined behavior in rgb_to_xy() with black

    5 juin 2021, par Michael Niedermayer
    avfilter/vf_ciescope : Fix undefined behavior in rgb_to_xy() with black
    

    Fixes : floating point division by 0
    Fixes : undefined behavior in handling NaN
    Fixes : Ticket 8268

    Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>

    • [DH] libavfilter/vf_ciescope.c
  • ffmpeg how to remove black borders when resizing an image

    3 juin 2021, par Mapg

    I am creating some thumbnails using FFmpeg and I see that some black borders are created when I resize them.

    &#xA;

    I guess this is happening because the video source dimension doesn't match exactly the target dimension, so FFmpeg fills out the blank space with this black color.

    &#xA;

    My question is ...

    &#xA;

    Can I change this "black color" used by FFmpeg by default so I can match these extra borders added with the background of my application ?

    &#xA;

    If this is not possible ...

    &#xA;

    Can I convert these black borders to a transparent area so I can create a PNG to match my background which has a different color (a kind of light green)

    &#xA;

    I have attached an example where you will see two black pixels height in the bottom zone of the picture.

    &#xA;

    This is what I want to convert to transparent or being able to choose my own color.

    &#xA;

    Any idea to solve this issue will be very helpful for me ?

    &#xA;

    Thank you very much in advance !

    &#xA;

    Mapg

    &#xA;

    enter image description here

    &#xA;