
Recherche avancée
Autres articles (52)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Changer son thème graphique
22 février 2011, parLe thème graphique ne touche pas à la disposition à proprement dite des éléments dans la page. Il ne fait que modifier l’apparence des éléments.
Le placement peut être modifié effectivement, mais cette modification n’est que visuelle et non pas au niveau de la représentation sémantique de la page.
Modifier le thème graphique utilisé
Pour modifier le thème graphique utilisé, il est nécessaire que le plugin zen-garden soit activé sur le site.
Il suffit ensuite de se rendre dans l’espace de configuration du (...) -
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
Sur d’autres sites (9575)
-
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








-
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
-
Cut a video in between key frames without re-encoding the full video using ffpmeg ? [closed]
13 juillet 2024, par bguizI would like to cut a video at the beginning at any particular timestamp, and it need to be precise, so the nearest key frame is not good enough.


Also, these videos are rather long - an hour or longer - so I would like to avoid re-encoding this altogether if possible, or otherwise only re-encode a minimal fraction of the total duration. Thus, would like to maximise the use of
-vcodec copy
.

How can I accomplish this using
ffmpeg
?

NOTE : See scenario, and my own rough idea for a possible solution below.



Scenario :


- 

- Original video

- 

- Length of 1:00:00
- Has a key frame every 10s






- Desired cut :

- 

- From 0:01:35 through till the end




- Attempt #1 :

- 

- Using
-ss 0:01:35 -i blah.mp4 -vcodec copy
, what results is a file where : - audio starts at 0:01:30
- video also starts at 0:01:30
- this starts both the audio and the video too early










- Using
- using
-i blah.mp4 -ss 0:01:35 -vcodec copy
, what results is a file where :
- 

- audio starts at 0:01:35,
- but the video is blank/ black for the first 5 seconds,

- 

- until 0:01:40, when the video starts




- this starts the audio on time,
but the video starts too late



















Rough idea


- 

- (1) cut 0:01:30 to 0:01:40

- 

- re-encode this to have new key frames,
including one at the target time of 0:01:35
- then cut this to get the 5 seconds from 0:01:35 through 0:01:40






- (2) cut 0:01:40 through till the end

- 

- without re-encoding, using
-vcodec copy




- without re-encoding, using
- (3)
ffmpeg concat
the first short clip (the 5 second one)
with the second long clip








I know/ can work out the commands for (2) and (3), but am unsure about what commands are needed for (1).


- Original video