Recherche avancée

Médias (0)

Mot : - Tags -/protocoles

Aucun média correspondant à vos critères n’est disponible sur le site.

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 (4032)

  • Matplotlib can not save animation

    1er avril 2020, par Justin Furuness

    I have a matplotlib animation and it will not save. If I do not save it, it runs totally fine and without error. When I try to save it errors with a message that is not helpful. I have googled this error and checked everything, but I cannot seem to find an answer to this problem. I have installed ffmpeg. Am I doing something wrong that is obvious ? I am running on ubuntu 19.10 with matplotlib 3.2.1 if that matters.

    



    The code to save the animation is below :

    



        def run_animation(self, total_rounds):
        anim = animation.FuncAnimation(self.fig, self.animate,
                                       init_func=self.init,
                                       frames=total_rounds * 100,
                                       interval=40,
                                       blit=True)
#        Writer = animation.writers['ffmpeg']
#        writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)
        anim.save('animation.mp4')


    



    The error traceback :

    



    2020-04-01 02:20:58,279-INFO: MovieWriter._run: running command: ffmpeg -f rawvideo -vcodec rawvideo -s 1200x500 -pix_fmt rgba -r 25.0 -loglevel error -i pipe: -vcodec h264 -pix_fmt yuv420p -y animation.mp4
Traceback (most recent call last):
  File "/home/anon/.local/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2785, in _wait_cursor_for_draw_cm
    self.set_cursor(cursors.WAIT)
  File "/home/anon/.local/lib/python3.7/site-packages/matplotlib/backends/backend_gtk3.py", line 468, in set_cursor
    self.canvas.get_property("window").set_cursor(cursord[cursor])
AttributeError: 'NoneType' object has no attribute 'set_cursor'


    



    Thanks a million for your help

    


  • Why does ffmpeg could only record the first 100 frames of the animation ?

    9 février 2020, par jack fang

    I am using the following Python code to make an animation and want to save it as a video through FFmpeg (in PyCharm) :

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

    def func():
       for j in range(1, len(t)):
           time = j * 0.01
           print('time:{:2}'.format(time))
           yield time

    def animate(data):
       time = data
       ax2.plot(time, time, **{'marker':'o'})
       ax2.set_title('t = {:.2}'.format(time))
       return  ax2

    def init():
       ax2.plot(0, 0)
       return ax2

    dt = 0.01
    t = np.arange(0, 50, dt)

    fig2 = plt.figure()
    ax2 = fig2.add_subplot(111, autoscale_on=True)
    ax2.grid()

    ani = animation.FuncAnimation(fig2, animate, func, interval=dt*1000, blit=False, init_func=init, repeat=False)

    plt.rcParams['animation.ffmpeg_path'] = 'C:\Program Files\\ffmpeg\\bin\\ffmpeg.exe'
    writer = FFMpegWriter(fps=15, metadata=dict(artist='Me'), bitrate=1800)
    ani.save("movie.mp4", writer=writer)

    #plt.show()

    But when time reaches 1.0, the process stopped but it is supposed to stop when time reaches 50.0. The following picture shows when the process stopped. The PyCharm Run console
    I then check movie.mp4 and find that the video ends when time reaches 1.0.
    That is to say, only the first 100 frames of the animation were converted into the .mp4 file, so I was very confused where did the rest of the frames went ?

    I tried to run the code through windows cmd but got the same result.
    I then uncomment the line #plt.show() and found that the process stopped when time reaches 50.0 and the animation could be displayed properly but still only the first 100 frames was converted.

    I am now very confused about this problem and don’t know how to solve it. Appreciated for your help. :)

  • Matplotlib - Why is my saved animation video blank ?

    4 juillet 2022, par Pat X

    This should be pretty simple but I just don't know.

    



    A newbie to Python and FFmpeg. Just trying to save a test video from ArtistAnimation but got blank video.

    



    Before I tried to produce the video, I can see the animation by plt.show() (without "matplotlib.use("Agg")" ). I have already installed FFmpeg in Anaconda as well.

    



    To ensure my FFmpeg is functioning, I used the code from matplotlib example and produced a video that looks perfect. (I guess this means my FFmpeg will work fine from now on ?)

    



    Then, I only changed the figure to my version. Having compared the figure part, I didn't see anything wrong obviously. But in the saved video of my version, it's blank.

    



    import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import matplotlib.animation as ani
import numpy as np
import pandas as pd


fig = plt.figure()
ims = []
for i in range(10):
    ax1 = plt.subplot2grid((2, 2), (0, 0), colspan=2, rowspan=2)
    data = np.random.normal(0, 1, i+1)
    pd.DataFrame(data).plot(kind='bar', ax=ax1)
    ims.append([ax1])



# Set up formatting for the movie files
Writer = ani.writers['ffmpeg']
writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)

anim = ani.ArtistAnimation(fig, ims, interval=500, repeat_delay=3000, blit=True)
anim.save('textmovie.mp4', writer=writer)
plt.show()