Recherche avancée

Médias (1)

Mot : - Tags -/école

Autres articles (84)

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

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (11386)

  • vulkan : temporarily disable threading for ASIC-based hwaccels

    9 août, par Lynne
    vulkan : temporarily disable threading for ASIC-based hwaccels
    

    The issue is that a race condition exists between threads locking
    frames, which results in cyclic loops and deadlocks.

    Compute-based implementations are not affected.

    Fixes #20169

    • [DH] libavcodec/vulkan_av1.c
    • [DH] libavcodec/vulkan_h264.c
    • [DH] libavcodec/vulkan_hevc.c
    • [DH] libavcodec/vulkan_vp9.c
  • How to dynamically overlay images with ffmpeg

    23 mai, par Rorschy

    As a part of a bigger project, I'm trying to stream a live feed using ffmpeg through RTSP while also dynamically changing subtitles depending on the situation.

    


    As of now, I'm able to live stream with no issue. I also came across a solution for the subtitles by using a text file.

    


    However, I'd like to avoid having this text file in my project. I thought about creating a picture with the subtitles and overlaying it with the screen stream. However, with my current solution, the data is streamed only when I kill the running code (data streamed for a few seconds).

    


    Here is the current code for this problem :

    


    import subprocess
import threading
import string
import random
import time
import io
from PIL import Image, ImageDraw, ImageFont

RTSP_URL = "..."
ffmpeg = None

def generate_subtitle():
    width = 640
    height = 100
    font_size = 32
    while True:
        if ffmpeg:
            try:
                text = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))

                image = Image.new("RGBA", (width, height), (0, 0, 0, 128))
                draw = ImageDraw.Draw(image)

                try:
                    font = ImageFont.truetype("arial.ttf", font_size)
                except IOError:
                    font = ImageFont.load_default()

                bbox = draw.textbbox((0, 0), text, font=font)
                text_width = bbox[2] - bbox[0]
                text_height = bbox[3] - bbox[1]

                x = (width - text_width) // 2
                y = (height - text_height) // 2

                draw.text((x, y), text, font=font, fill=(255, 255, 255, 255))
                buffer = io.BytesIO()
                image.save(buffer, format="PNG")
                ffmpeg.stdin.write(buffer.getvalue())
                ffmpeg.stdin.flush()
                time.sleep(5)
            except Exception as e:
                print("Erreur d'envoi d'image :", e)
                break
        else:
            time.sleep(1)

def run_ffmpeg():
    global ffmpeg
    ffmpeg = subprocess.Popen([
        'ffmpeg',

        # Input 0: capture desktop
        "-f", "gdigrab",
        "-offset_x", "0",
        "-offset_y", "0",
        "-video_size", "1920x1080",
        "-i", "desktop",

        # Input 1: PNG overlay from stdin
        "-f", "image2pipe",
        "-vcodec", "png",
        "-i", "-",

        # Filter to overlay Input 1 on Input 0
        "-filter_complex", "[0:v][1:v]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)-10",

        # Output settings
        "-vcodec", "libx264",
        "-preset", "ultrafast",
        "-tune", "zerolatency",
        "-g", "30",
        "-sc_threshold", "0",
        "-f", "rtsp",
        RTSP_URL
    ], stdin=subprocess.PIPE)

threading.Thread(target=run_ffmpeg, daemon=True).start()

threading.Thread(target=generate_subtitle, daemon=True).start()

while True:
    time.sleep(1)



    


    My question is how can I stream the data correctly ?
If there is another solution to change dynamically the subtitles without using a text file or a temporary file I'd be glad to hear it.

    


  • avcodec/mpegvideo_dec : Move memcpy'ing ctx to mpeg4videodec.c

    29 avril, par Andreas Rheinhardt
    avcodec/mpegvideo_dec : Move memcpy'ing ctx to mpeg4videodec.c
    

    When the destination MpegEncContext in ff_mpeg_update_thread_context()
    is not initialized, the source MpegEncContext is simply copied
    over it before (potentially) calling ff_mpv_common_init().
    This leads to data races when this code is executed which is why
    it should be replaced with only copying the necessary fields
    (this is for future commits).

    Given that the RV30 and RV40 decoders always call said function
    with an already initialized MpegEncContext (they use context_reinit
    in case of frame size changes), they don't need this ugly
    initialization (and are therefore race-free). This means that
    this code can be moved to the only decoder that actually needs it :
    MPEG-4. This commit does so.

    Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@outlook.com>

    • [DH] libavcodec/mpeg4videodec.c
    • [DH] libavcodec/mpegvideo_dec.c