Recherche avancée

Médias (1)

Mot : - Tags -/illustrator

Autres articles (90)

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

  • Qu’est ce qu’un éditorial

    21 juin 2013, par

    Ecrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
    Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
    Vous pouvez personnaliser le formulaire de création d’un éditorial.
    Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...)

  • Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs

    12 avril 2011, par

    La manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
    Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.

Sur d’autres sites (6283)

  • memory leak reading video frames to numpy array using ffmpeg as a python subprocess

    19 novembre 2023, par paddyg

    I can stream videos frame by frame to an OpenGL Texture2D OK in python (pi3d module, example in pi3d_demos/VideoWalk.py) but I've noticed that it gradually leaks memory. Below is a stripped down version of the code that shows the problem.

    


    Can anyone see where I'm leaking ? The memory seems to be recovered when python stops. I've tried explicitly setting things to None or calling the garbage collector manually.

    


    #!/usr/bin/python
import os
import numpy as np
import subprocess
import threading
import time
import json

def get_dimensions(video_path):
    probe_cmd = f'ffprobe -v error -show_entries stream=width,height,avg_frame_rate -of json "{video_path}"'
    probe_result = subprocess.check_output(probe_cmd, shell=True, text=True)
    video_info_list = [vinfo for vinfo in json.loads(probe_result)['streams'] if 'width' in vinfo]
    if len(video_info_list) > 0:
        video_info = video_info_list[0] # use first if more than one!
        return(video_info['width'], video_info['height'])
    else:
        return None

class VideoStreamer:
    def __init__(self, video_path):
        self.flag = False # use to signal new texture
        self.kill_thread = False
        self.command = [ 'ffmpeg', '-i', video_path, '-f', 'image2pipe',
                        '-pix_fmt', 'rgb24', '-vcodec', 'rawvideo', '-']
        dimensions = get_dimensions(video_path)
        if dimensions is not None:
            (self.W, self.H) = dimensions
            self.P = 3
            self.image = np.zeros((self.H, self.W, self.P), dtype='uint8')
            self.t = threading.Thread(target=self.pipe_thread)
            self.t.start()
        else: # couldn't get dimensions for some reason - assume not able to read video
            self.W = 240
            self.H = 180
            self.P = 3
            self.image = np.zeros((self.H, self.W, self.P), dtype='uint8')
            self.t = None

    def pipe_thread(self):
        pipe = None
        while not self.kill_thread:
            st_tm = time.time()
            if pipe is None:
                pipe = subprocess.Popen(self.command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1)
            self.image = np.frombuffer(pipe.stdout.read(self.H * self.W * self.P), dtype='uint8') # overwrite array
            pipe.stdout.flush() # presumably nothing else has arrived since read()
            pipe.stderr.flush() # ffmpeg sends commentary to stderr
            if len(self.image) < self.H * self.W * self.P: # end of video, reload
                pipe.terminate()
                pipe = None
            else:
                self.image.shape = (self.H, self.W, self.P)
                self.flag = True
            step = time.time() - st_tm
            time.sleep(max(0.04 - step, 0.0)) # adding fps info to ffmpeg doesn't seem to have any effect
        if pipe is not None:
            pipe.terminate()
            pipe = None

    def kill(self):
        self.kill_thread = True
        if self.t is not None:
            self.t.join()

vs = None
try:
    while True:
        for (path, _, videos) in os.walk("/home/patrick/Pictures/videos"):
            for video in videos:
                print(video)
                os.system("free") # shows gradually declining memory available
                vs = VideoStreamer(os.path.join(path, video))
                for i in range(500):
                    tries = 0
                    while not vs.flag and tries < 5:
                        time.sleep(0.001)
                        tries += 1
                    # at this point vs.image is a numpy array HxWxP bytes
                    vs.flag = False
                vs.kill()
except KeyboardInterrupt:
    if vs is not None:
        vs.kill()


os.system("free")


    


  • colored TV-Noise with windows

    8 janvier 2024, par LookAndSee

    I have some question to the colored noise at image 2 of the following thread :

    


    Simulating TV noise

    


      

    • how can i get this in windows ? I like a random pattern consisting of red, green, blue, white and black points, like 255:0:0, 0:255:0, 0:0:255, 255:255:0, 0:0:0 and 255:255:255 - no pink, no orange, no cyan ... at the first step.
    • 


    


    but random in all 3 places always delievers (with ceil, floor or round) whole black, or whole white or bw-noise :-(
does it mean, the random(1) per point is 3 times the same in one computing-cycle ?

    


    Any suggestion ?

    


    This is what i tried :

    


    ffmpeg -y -f lavfi -i nullsrc=s=1280x720 -filter_complex "geq=r=(round(random(1)))*255:g=(round(random(1)))*255:b=(round(random(1)))*255;aevalsrc=-2+random(0)" -t 5 output.mkv


    


  • Can I only use video file to countdown at last frame ? [closed]

    5 mai 2024, par mikezang

    I save the last frame to image when I create a video, then I convert image to 10 seconds video and put countdown on it, at last, merge this two videos. I can also use video to countdown but that start from first frame, how can I countdown at last frame ?

    


    countdown.bat

    


    ffmpeg -hide_banner ^
    -i "C:\myvideos\video.mp4" ^
    -filter_complex_script countdown.txt ^
    -t 30 -y %2.mp4


    


    countdown.txt

    


    [0:v]scale=864:504:force_original_aspect_ratio=decrease,pad=864:504:-1:-1,setsar=1[s0];
[s0]drawtext=fontfile='/WINDOWS/Fonts/Arial.ttf':text='%{eif\:10-t\:d}':
box=1:boxborderw=10:boxcolor=orange@0.4:
fontsize=24:x=w-tw-10:y=10:fontcolor=red:enable='between(t,0,10)';