Recherche avancée

Médias (0)

Mot : - Tags -/flash

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (66)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

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

Sur d’autres sites (5456)

  • FFmpeg - add an image (cropped by mask) to the video

    10 mars 2021, par zeromodule

    I have 3 inputs :

    


      

    1. Video file
    2. 


    3. Image file (GIF)
    4. 


    5. Mask file (transparent PNG with some black pixels) - the same resolution as the video
    6. 


    


    I want to put the image on the video, but throw out all image pixels that are transparent in the mask (replace them with transparent ones).

    


    Video
    
Mask
    
Image
    
Result

    


    My current command, without masking (it works fine) :

    


    ffmpeg -i input.mp4 -ignore_loop 0 -i image.gif -filter_complex "[1]scale=700x700[scaled_gif];[0][scaled_gif]overlay=50:30:shortest=1" -codec:a copy output.mp4


    


    I know I should probably use alphamerge, but I don't understand how to use it properly.

    


  • avcodec/cbs : ensure user_data is padded for GBC parsing

    5 octobre 2018, par Aman Gupta
    avcodec/cbs : ensure user_data is padded for GBC parsing
    

    Fixes crash noticed in the cbs_userdata patchset.

    ====ERROR : AddressSanitizer : heap-buffer-overflow on address 0x609000026c89 at pc 0x00010725d37b bp 0x7ffeea04e750 sp 0x7ffeea04e748
    READ of size 4 at 0x609000026c89 thread T0
    #0 0x10725d37a in ff_cbs_read_unsigned get_bits.h:274
    #1 0x1072d2767 in ff_cbs_read_a53_user_data cbs_misc_syntax_template.c:119
    #2 0x1078251a7 in h264_metadata_filter h264_metadata_bsf.c:595
    #3 0x105c1321d in output_packet ffmpeg.c:853

    0x609000026c89 is located 1 bytes to the right of 8-byte region [0x609000026c80,0x609000026c88)
    allocated by thread T0 here :
    #0 0x10aef08d7 in wrap_posix_memalign (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x578d7)
    #1 0x10aca95e6 in av_malloc mem.c:87
    #2 0x10ac545fe in av_buffer_allocz buffer.c:72
    #3 0x107263b27 in cbs_h264_read_nal_unit cbs_h264_syntax_template.c:722
    #4 0x10725b688 in cbs_read_fragment_content cbs.c:155

    Signed-off-by : Aman Gupta <aman@tmm1.net>

    • [DH] libavcodec/cbs_h264_syntax_template.c
    • [DH] libavcodec/cbs_mpeg2_syntax_template.c
  • Python cv2 script that scans a giant image to a video. Raises error : Unknown C++ exception from OpenCV code

    26 avril 2022, par Nolrenea

    I wrote a script that scans a giant image to make a video. Normally I just post my scripts straight to my Code Review account, but this script is ugly, needs to be refactored, implements only horizontal scrolling and contains a bug that I can't get rid of.

    &#xA;

    It is working but not perfect, I can't get the last line at the bottom of the image, with height of image_height % 1080. If I ignore it, the code is working fine, if I try to fix it, it throws exceptions.

    &#xA;

    Example :

    &#xA;

    Original image (Google Drive)

    &#xA;

    Video Output (Google Drive)

    &#xA;

    As you can see from the video, everything is working properly except the fact that I can't get the bottom line.

    &#xA;

    Full working code

    &#xA;


    &#xA;
    import cv2&#xA;import numpy as np&#xA;import random&#xA;import rpack&#xA;from fractions import Fraction&#xA;from math import prod&#xA;&#xA;def resize_guide(image_size, target_area):&#xA;    aspect_ratio = Fraction(*image_size).limit_denominator()&#xA;    horizontal = aspect_ratio.numerator&#xA;    vertical = aspect_ratio.denominator&#xA;    unit_length = (target_area/(horizontal*vertical))**.5&#xA;    return (int(horizontal*unit_length), int(vertical*unit_length))&#xA;&#xA;fourcc = cv2.VideoWriter_fourcc(*&#x27;h264&#x27;)&#xA;FRAME = np.zeros((1080, 1920, 3), dtype=np.uint8)&#xA;&#xA;def new_frame():&#xA;    return np.ndarray.copy(FRAME)&#xA;&#xA;def center(image):&#xA;    frame = new_frame()&#xA;    h, w = image.shape[:2]&#xA;    yoff = round((1080-h)/2)&#xA;    xoff = round((1920-w)/2)&#xA;    frame[yoff:yoff&#x2B;h, xoff:xoff&#x2B;w] = image&#xA;    return frame&#xA;&#xA;def image_scanning(file, fps=60, pan_increment=64, horizontal_increment=8, fast_decrement=256):&#xA;    image = cv2.imread(file)&#xA;    height, width = image.shape[:2]&#xA;    assert width*height >= 1920*1080&#xA;    video_writer = cv2.VideoWriter(file&#x2B;&#x27;.mp4&#x27;, fourcc, fps, (1920, 1080))&#xA;    fit_height = True&#xA;    if height &lt; 1080:&#xA;        width = width*1080/height&#xA;        image = cv2.resize(image, (width, 1080), interpolation = cv2.INTER_AREA)&#xA;    aspect_ratio = width / height&#xA;    zooming_needed = False&#xA;    if 4/9 &lt;= aspect_ratio &lt;= 16/9:&#xA;        new_width = round(width*1080/height)&#xA;        fit = cv2.resize(image, (new_width, 1080), interpolation = cv2.INTER_AREA)&#xA;        zooming_needed = True&#xA;    &#xA;    elif 16/9 &lt; aspect_ratio &lt;= 32/9:&#xA;        new_height = round(height*1920/width)&#xA;        fit = cv2.resize(image, (1920, new_height), interpolation = cv2.INTER_AREA)&#xA;        fit_height = False&#xA;        zooming_needed = True&#xA;    &#xA;    centered = center(fit)&#xA;    for i in range(fps):&#xA;        video_writer.write(centered)&#xA;    if fit_height:&#xA;        xoff = round((1920 - new_width)/2)&#xA;        while xoff:&#xA;            if xoff - pan_increment >= 0:&#xA;                xoff -= pan_increment&#xA;            else:&#xA;                xoff = 0&#xA;            frame = new_frame()&#xA;            frame[0:1080, xoff:xoff&#x2B;new_width] = fit&#xA;            video_writer.write(frame)&#xA;    else:&#xA;        yoff = round((1080 - new_height)/2)&#xA;        while yoff:&#xA;            if yoff - pan_increment >= 0:&#xA;                yoff -= pan_increment&#xA;            else:&#xA;                yoff = 0&#xA;            frame = new_frame()&#xA;            frame[yoff:yoff&#x2B;new_height, 0:1920] = fit&#xA;            video_writer.write(frame)&#xA;    &#xA;    if zooming_needed:&#xA;        if fit_height:&#xA;            width_1, height_1 = new_width, 1080&#xA;        else:&#xA;            width_1, height_1 = 1920, new_height&#xA;        new_area = width_1 * height_1&#xA;        original_area = width * height&#xA;        area_diff = original_area - new_area&#xA;        unit_diff = area_diff / fps&#xA;        for i in range(1, fps&#x2B;1):&#xA;            zoomed = cv2.resize(image, resize_guide((width_1, height_1), new_area&#x2B;unit_diff*i), interpolation=cv2.INTER_AREA)&#xA;            zheight, zwidth = zoomed.shape[:2]&#xA;            zheight = min(zheight, 1080)&#xA;            zwidth = min(zwidth, 1920)&#xA;            frame = new_frame()&#xA;            frame[0:zheight, 0:zwidth] = zoomed[0:zheight, 0:zwidth]&#xA;            video_writer.write(frame)&#xA;    y, x = 0, 0&#xA;    completed = False&#xA;    while y != height - 1080:&#xA;        x = 0&#xA;        while x != width - 1920:&#xA;            if x &#x2B; horizontal_increment &#x2B; 1920 &lt;= width:&#xA;                x &#x2B;= horizontal_increment&#xA;                frame = image[y:y&#x2B;1080, x:x&#x2B;1920]&#xA;                video_writer.write(frame)&#xA;            else:&#xA;                x = width - 1920&#xA;                frame = image[y:y&#x2B;1080, x:x&#x2B;1920]&#xA;                for i in range(round(fps/3)):&#xA;                    video_writer.write(frame)&#xA;                if y == height - 1080:&#xA;                    completed = True&#xA;        while x != 0:&#xA;            if x - fast_decrement - 1920 >= 0:&#xA;                x -= fast_decrement&#xA;            else:&#xA;                x = 0&#xA;            frame = image[y:y&#x2B;1080, x:x&#x2B;1920]&#xA;            video_writer.write(frame)&#xA;        if y &#x2B; 2160 &lt;= height:&#xA;            y &#x2B;= 1080&#xA;        else:&#xA;            y = height - 1080&#xA;    cv2.destroyAllWindows()&#xA;    video_writer.release()&#xA;    del video_writer&#xA;

    &#xA;

    The above the the code needed to produce the example video. It is working but the bottom line is missing.

    &#xA;

    Now if I change the last few lines to this :

    &#xA;

            if y &#x2B; 2160 &lt;= height:&#xA;            y &#x2B;= 1080&#xA;        else:&#xA;            y = height - 1080&#xA;            x = 0&#xA;            while x != width - 1920:&#xA;                if x &#x2B; horizontal_increment &#x2B; 1920 &lt;= width:&#xA;                    x &#x2B;= horizontal_increment&#xA;                    frame = image[y:y&#x2B;1080, x:x&#x2B;1920]&#xA;                    video_writer.write(frame)&#xA;    cv2.destroyAllWindows()&#xA;    video_writer.release()&#xA;    del video_writer&#xA;

    &#xA;

    I expect it to include the bottom line, but it just throws exceptions instead :

    &#xA;

    OpenCV: FFMPEG: tag 0x34363268/&#x27;h264&#x27; is not supported with codec id 27 and format &#x27;mp4 / MP4 (MPEG-4 Part 14)&#x27;&#xA;OpenCV: FFMPEG: fallback to use tag 0x31637661/&#x27;avc1&#x27;&#xA;---------------------------------------------------------------------------&#xA;error                                     Traceback (most recent call last)&#xA; in <module>&#xA;----> 1 image_scanning("D:/collages/91f53ebcea2a.png")&#xA;&#xA; in image_scanning(file, fps, pan_increment, horizontal_increment, fast_decrement)&#xA;    122                     x &#x2B;= horizontal_increment&#xA;    123                     frame = image[y:y&#x2B;1080, x:x&#x2B;1920]&#xA;--> 124                     video_writer.write(frame)&#xA;    125     cv2.destroyAllWindows()&#xA;    126     video_writer.release()&#xA;&#xA;error: Unknown C&#x2B;&#x2B; exception from OpenCV code&#xA;</module>

    &#xA;

    (If you can't get the example code working I can't help you, but I am using Python 3.9.10 x64 on Windows 10, and I have this file : "C :\Windows\System32\openh264-1.8.0-win64.dll", the '.avi' format generates video files with Gibibytes (binary unit, not SI Gigabyte) of size)

    &#xA;

    How to get rid of the exception ?

    &#xA;