
Recherche avancée
Médias (91)
-
Corona Radiata
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Lights in the Sky
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Head Down
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Echoplex
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Discipline
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Letting You
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (88)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
De l’upload à la vidéo finale [version standalone]
31 janvier 2010, parLe chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
Upload et récupération d’informations de la vidéo source
Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...) -
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 : (...)
Sur d’autres sites (11320)
-
Speedup matplotlib animation to video file
9 juillet 2015, par gaggioOn Raspbian (Raspberry Pi 2), the following minimal example stripped from my script correctly produces an mp4 file :
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation
def anim_lift(x, y):
#set up the figure
fig = plt.figure(figsize=(15, 9))
def animate(i):
# update plot
pointplot.set_data(x[i], y[i])
return pointplot
# First frame
ax0 = plt.plot(x,y)
pointplot, = ax0.plot(x[0], y[0], 'or')
anim = animation.FuncAnimation(fig, animate, repeat = False,
frames=range(1,len(x)),
interval=200,
blit=True, repeat_delay=1000)
anim.save('out.mp4')
plt.close(fig)
# Number of frames
nframes = 200
# Generate data
x = np.linspace(0, 100, num=nframes)
y = np.random.random_sample(np.size(x))
anim_lift(x, y)Now, the file is produced with good quality and pretty small file size, but it takes 15 minutes to produce a 170 frames movie, which is not acceptable for my application. i’m looking for a significant speedup, video file size increase is not a problem.
I believe the bottleneck in the video production is in the temporary saving of the frames in png format. During processing I can see the png files apprearing in my working directory, with the CPU load at 25% only.
Please suggest a solution, that might also be based on a different package rather than simply
matplotlib.animation
, likeOpenCV
(which is anyway already imported in my project) ormoviepy
.Versions in use :
- python 2.7.3
- matplotlib 1.1.1rc2
- ffmpeg 0.8.17-6:0.8.17-1+rpi1
-
Speedup matplotlib animation to video file
20 mai 2022, par gaggioOn Raspbian (Raspberry Pi 2), the following minimal example stripped from my script correctly produces an mp4 file :



import numpy as np
import matplotlib.pyplot as plt
from matplotlib import animation

def anim_lift(x, y):

 #set up the figure
 fig = plt.figure(figsize=(15, 9))

 def animate(i):
 # update plot
 pointplot.set_data(x[i], y[i])

 return pointplot

 # First frame
 ax0 = plt.plot(x,y)
 pointplot, = ax0.plot(x[0], y[0], 'or')

 anim = animation.FuncAnimation(fig, animate, repeat = False,
 frames=range(1,len(x)), 
 interval=200,
 blit=True, repeat_delay=1000)

 anim.save('out.mp4')
 plt.close(fig)

# Number of frames
nframes = 200

# Generate data
x = np.linspace(0, 100, num=nframes)
y = np.random.random_sample(np.size(x))

anim_lift(x, y)




Now, the file is produced with good quality and pretty small file size, but it takes 15 minutes to produce a 170 frames movie, which is not acceptable for my application. i'm looking for a significant speedup, video file size increase is not a problem.



I believe the bottleneck in the video production is in the temporary saving of the frames in png format. During processing I can see the png files apprearing in my working directory, with the CPU load at 25% only.



Please suggest a solution, that might also be based on a different package rather than simply
matplotlib.animation
, likeOpenCV
(which is anyway already imported in my project) ormoviepy
.


Versions in use :



- 

- python 2.7.3
- matplotlib 1.1.1rc2
- ffmpeg 0.8.17-6:0.8.17-1+rpi1








-
If conditions in a loop breaking ffmpeg zoom command
6 mai 2017, par SulliI have built a bash script where I am trying to zoom in an image with ffmpeg, for 10s :
ffmpeg -r 25 -i image0.jpg -filter_complex "scale=-2:10*ih,zoompan=z='min(zoom+0.0015,1.5)':d=250:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)',scale=-2:720" -y -shortest -c:v libx264 -pix_fmt yuv420p temp_1.mp4
This command is included in a while loop, with two "if" conditions at the beginning of the loop :
first=1017
i=0
while read status author mySource myFormat urlIllustration credit shot_id originalShot categories title_EN length_title_EN text_EN tags_EN title_FR length_title_FR text_FR tags_FR title_BR length_title_BR text_BR tags_BR; do
if [ $myFormat != "diaporama" ]; then
let "i = i + 1"
continue
fi
if [ "$shot_id" -lt "$first" ]; then
let "i = i + 1"
continue
fi
rm temp_1.mp4
ffmpeg -r 25 -i image0.jpg -filter_complex "scale=-2:10*ih,zoompan=z='min(zoom+0.0015,1.5)':d=250:x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)',scale=-2:720" -y -shortest -c:v libx264 -pix_fmt yuv420p temp_1.mp4
let "i = i + 1"
done <../data.tsv
echo "All done."(I have removed stuff in the loop, this is the minimal code that is able to capture the problem).
Now the weird bug : if I run this code like that, the video I am trying to generate will not be 10s long, only 1-2s long. ffmpeg exits with error "[out_0_0 @ 0x2fa4c00] 100 buffers queued in out_0_0, something may be wrong."
Now if I remove one of the "if" conditions at the beginning of my loop (the first or the second, it doesn’t matter), the video will be generated fine and be 10s long.
What could be the cause of this problem ?