
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (21)
-
Librairies et binaires spécifiques au traitement vidéo et sonore
31 janvier 2010, parLes 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, parPour 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, parPHP 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 gfI'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
type object 'FuncAnimation' has no attribute '_first_draw_id'
 File "C:\Users\Fernando\Documents\Circulos\circulos.py", line 102, in <module> anim.save(anim, filename="my_animation.gif", writer=FFwriter)
</module>


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.


import smtplib, os
import matplotlib.pyplot as plt
from matplotlib import animation
import math
from celluloid import Camera

plt.rcParams['animation.ffmpeg_path'] = os.getcwd() + '\\Circulos\\ffmpeg\\bin\\ffmpeg.exe'


#axes
figure, axes = plt.subplots()
axes.set_aspect(1)
axes.set_xlim((-xmax(C)),(xmax(C)))
axes.set_ylim((-ymax(C)),(ymax(C)))

b = 0

#add initial circles
for a in range 5:
 draw_circle = plt.Circle((a, a), 2, fc = 'None', ec = 'r')
 axes.add_artist(draw_circle)


#create figure and camera
figure, axes = plt.subplots()
axes.set_aspect(1)
axes.set_xlim((-xmax(C)),(xmax(C)))
axes.set_ylim((-ymax(C)),(ymax(C)))
camera = Camera(figure) 

Frame_time = 10

for b in range(Frame_time):

 #add circles
 for a in range 5:
 draw_circle = plt.Circle((a, a), 2, fc = 'None', ec = 'r')
 axes.add_artist(draw_circle)

 #Frame Picture
 camera.snap()


#create animation
anim = camera.animate()
anim = animation.FuncAnimation
FFwriter = animation.FFMpegWriter()
anim.save(anim, filename="my_animation.gif", writer=FFwriter)



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


-
Create endless loop animation using ffmpeg using only certain frames
26 juillet 2021, par Rick TI can create an animated gif using the commands below.


ffmpeg -i wrist_0001.png -vf palettegen=16 palette.png

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



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


- 

- Create another animated gif using just the first 20 frames and the animation loops endlessly (no pausing at the end of the animation).
- 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...)






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 ?


-
matplotlib 3D linecollection animation gets slower over time
15 juin 2021, par Vignesh DesmondI'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 :


def generate_video(nframes):

 fig = plt.figure(figsize=(16, 9), dpi=120)
 canvas_width, canvas_height = fig.canvas.get_width_height()
 ax = fig.add_axes([0, 0, 1, 1], projection='3d')

 X = np.random.random(nframes)
 Y = np.random.random(nframes)
 Z = np.random.random(nframes)

 cmap = plt.cm.get_cmap("hsv")
 line = Line3DCollection([], cmap=cmap)
 ax.add_collection3d(line)
 line.set_segments([])

 def update(frame):
 i = frame % len(vect.X)
 points = np.array([vect.X[:i], vect.Y[:i], vect.Z[:i]]).transpose().reshape(-1,1,3)
 segs = np.concatenate([points[:-1],points[1:]],axis=1)
 line.set_segments(segs)
 line.set_array(np.array(vect.Y)) # Color gradient
 ax.elev += 0.0001
 ax.azim += 0.1

 outf = 'test.mp4'
 cmdstring = ('ffmpeg', 
 '-y', '-r', '60', # overwrite, 1fps
 '-s', '%dx%d' % (canvas_width, canvas_height),
 '-pix_fmt', 'argb',
 '-f', 'rawvideo', '-i', '-',
 '-b:v', '5000k','-vcodec', 'mpeg4', outf)
 p = subprocess.Popen(cmdstring, stdin=subprocess.PIPE)

 for frame in range(nframes):
 update(frame)
 fig.canvas.draw()
 string = fig.canvas.tostring_argb()
 p.stdin.write(string)

 p.communicate()

generate_video(nframes=10000)



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.


Versions :
Matplotlib : 3.4.2
FFMpeg : 4.2.4-1ubuntu0.1