Recherche avancée

Médias (1)

Mot : - Tags -/école

Autres articles (21)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

  • Les statuts des instances de mutualisation

    13 mars 2010, par

    Pour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
    Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...)

  • Problèmes fréquents

    10 mars 2010, par

    PHP et safe_mode activé
    Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
    La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site

Sur d’autres sites (4021)

  • AttributeError while saving an animation using celluloid, Python 3.9

    26 juillet 2021, par rafael gf

    I'm trying to create a simple animation using the celluloid library, but I'm getting an attribute error when trying to save it. I'm not familiar with ffmpeg, but I read I should install it and point to its executable file for the saving to work, not sure what's going wrong. The massage I'm getting is :

    


    Exception has occurred: AttributeError&#xA;type object &#x27;FuncAnimation&#x27; has no attribute &#x27;_first_draw_id&#x27;&#xA; File "C:\Users\Fernando\Documents\Circulos\circulos.py", line 102, in <module>  anim.save(anim, filename="my_animation.gif", writer=FFwriter)&#xA;</module>

    &#xA;

    I'll out the simplification version of the code below - I'm suppressing the part where I do some tucking with the circles, but I've done some testing plot by plot and it is working fine.

    &#xA;

    import smtplib, os&#xA;import matplotlib.pyplot as plt&#xA;from matplotlib import animation&#xA;import math&#xA;from celluloid import Camera&#xA;&#xA;plt.rcParams[&#x27;animation.ffmpeg_path&#x27;] = os.getcwd() &#x2B; &#x27;\\Circulos\\ffmpeg\\bin\\ffmpeg.exe&#x27;&#xA;&#xA;&#xA;#axes&#xA;figure, axes = plt.subplots()&#xA;axes.set_aspect(1)&#xA;axes.set_xlim((-xmax(C)),(xmax(C)))&#xA;axes.set_ylim((-ymax(C)),(ymax(C)))&#xA;&#xA;b = 0&#xA;&#xA;#add initial circles&#xA;for a in range 5:&#xA;    draw_circle = plt.Circle((a, a), 2, fc = &#x27;None&#x27;, ec = &#x27;r&#x27;)&#xA;    axes.add_artist(draw_circle)&#xA;&#xA;&#xA;#create figure and camera&#xA;figure, axes = plt.subplots()&#xA;axes.set_aspect(1)&#xA;axes.set_xlim((-xmax(C)),(xmax(C)))&#xA;axes.set_ylim((-ymax(C)),(ymax(C)))&#xA;camera = Camera(figure) &#xA;&#xA;Frame_time = 10&#xA;&#xA;for b in range(Frame_time):&#xA;&#xA;     #add circles&#xA;     for a in range 5:&#xA;        draw_circle = plt.Circle((a, a), 2, fc = &#x27;None&#x27;, ec = &#x27;r&#x27;)&#xA;        axes.add_artist(draw_circle)&#xA;&#xA;    #Frame Picture&#xA;    camera.snap()&#xA;&#xA;&#xA;#create animation&#xA;anim = camera.animate()&#xA;anim = animation.FuncAnimation&#xA;FFwriter = animation.FFMpegWriter()&#xA;anim.save(anim, filename="my_animation.gif", writer=FFwriter)&#xA;

    &#xA;

    I'm working on VS code, the latest version I just updated it, and python 3.9

    &#xA;

  • Create endless loop animation using ffmpeg using only certain frames

    26 juillet 2021, par Rick T

    I can create an animated gif using the commands below.

    &#xA;

    ffmpeg -i wrist_0001.png -vf palettegen=16 palette.png&#xA;&#xA;ffmpeg -i wrist_%04d.png -i palette.png -filter_complex "fps=20,scale=720:-1:flags=lanczos[x];[x][1:v]paletteuse" logo.gif&#xA;

    &#xA;

    What I'm trying to know how to do is :

    &#xA;

      &#xA;
    1. Create another animated gif using just the first 20 frames and the animation loops endlessly (no pausing at the end of the animation).
    2. &#xA;

    3. Create another animated gif using just the first 20 frames where the animation plays then pauses at the end for 3 seconds then continues. (endlessly) Example : (play animation - pause 3 seconds - play animation - pause 3 seconds - play animation - pause 3 seconds...)
    4. &#xA;

    &#xA;

    Note : I'm trying to avoid having to type in wrist_0001.png wrist_0002.png...is there away to do wrist_0001.png to wrist_0020.png ?

    &#xA;

  • matplotlib 3D linecollection animation gets slower over time

    15 juin 2021, par Vignesh Desmond

    I'm trying to animate a 3d line plot for attractors, using Line3DCollection. The animation is initally fast but it gets progressively slower over time. A minimal example of my code :

    &#xA;

    def generate_video(nframes):&#xA;&#xA;    fig = plt.figure(figsize=(16, 9), dpi=120)&#xA;    canvas_width, canvas_height = fig.canvas.get_width_height()&#xA;    ax = fig.add_axes([0, 0, 1, 1], projection=&#x27;3d&#x27;)&#xA;&#xA;    X = np.random.random(nframes)&#xA;    Y = np.random.random(nframes)&#xA;    Z = np.random.random(nframes)&#xA;&#xA;    cmap = plt.cm.get_cmap("hsv")&#xA;    line = Line3DCollection([], cmap=cmap)&#xA;    ax.add_collection3d(line)&#xA;    line.set_segments([])&#xA;&#xA;    def update(frame):&#xA;        i = frame % len(vect.X)&#xA;        points = np.array([vect.X[:i], vect.Y[:i], vect.Z[:i]]).transpose().reshape(-1,1,3)&#xA;        segs = np.concatenate([points[:-1],points[1:]],axis=1)&#xA;        line.set_segments(segs)&#xA;        line.set_array(np.array(vect.Y)) # Color gradient&#xA;        ax.elev &#x2B;= 0.0001&#xA;        ax.azim &#x2B;= 0.1&#xA;&#xA;    outf = &#x27;test.mp4&#x27;&#xA;    cmdstring = (&#x27;ffmpeg&#x27;, &#xA;                    &#x27;-y&#x27;, &#x27;-r&#x27;, &#x27;60&#x27;, # overwrite, 1fps&#xA;                    &#x27;-s&#x27;, &#x27;%dx%d&#x27; % (canvas_width, canvas_height),&#xA;                    &#x27;-pix_fmt&#x27;, &#x27;argb&#x27;,&#xA;                    &#x27;-f&#x27;, &#x27;rawvideo&#x27;,  &#x27;-i&#x27;, &#x27;-&#x27;,&#xA;                    &#x27;-b:v&#x27;, &#x27;5000k&#x27;,&#x27;-vcodec&#x27;, &#x27;mpeg4&#x27;, outf)&#xA;    p = subprocess.Popen(cmdstring, stdin=subprocess.PIPE)&#xA;&#xA;    for frame in range(nframes):&#xA;        update(frame)&#xA;        fig.canvas.draw()&#xA;        string = fig.canvas.tostring_argb()&#xA;        p.stdin.write(string)&#xA;&#xA;    p.communicate()&#xA;&#xA;generate_video(nframes=10000)&#xA;

    &#xA;

    I used the code from this answer to save the animation to mp4 using ffmpeg instead of anim.FuncAnimation as its much faster for me. But both methods get slower over time and I'm not sure how to make the animation not become slower. Any advice is welcome.

    &#xA;

    Versions :&#xA;Matplotlib : 3.4.2&#xA;FFMpeg : 4.2.4-1ubuntu0.1

    &#xA;