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

  • Can't save matplotlib animation

    2 janvier 2020, par renger

    I am trying to get a simple animation saved using ffmpeg. I followed a tutorial to install ffmpeg, and I can now access it from the command prompt.

    Now I run this piece of code :

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

    fig = plt.figure()
    ax = plt.axes(xlim=(0, 2), ylim=(-2, 2))
    line, = ax.plot([], [], lw=2)

    def init():
       line.set_data([], [])
       return line,

    def animate(i):
       x = np.linspace(0, 2, 1000)
       y = np.sin(2 * np.pi * (x - 0.01 * i))
       line.set_data(x, y)
       return line,

    anim = animation.FuncAnimation(fig, animate, init_func=init,
                                  frames=200, interval=20, blit=True)

    mywriter = animation.FFMpegWriter()
    anim.save('mymovie.mp4',writer=mywriter)

    plt.show()

    I get this error :

    Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
      File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 523, in runfile
       execfile(filename, namespace)
     File "C:\Users\Renger\.xy\startups\b.py", line 23, in <module>
       anim.save('mymovie.mp4',writer=mywriter)
     File "C:\Python27\lib\site-packages\matplotlib\animation.py", line 609, in save
       with writer.saving(self._fig, filename, dpi):
     File "C:\Python27\lib\contextlib.py", line 17, in __enter__
       return self.gen.next()
     File "C:\Python27\lib\site-packages\matplotlib\animation.py", line 166, in saving
       self.setup(*args)
     File "C:\Python27\lib\site-packages\matplotlib\animation.py", line 156, in setup
       self._run()
     File "C:\Python27\lib\site-packages\matplotlib\animation.py", line 183, in _run
       stdin=subprocess.PIPE)
     File "C:\Python27\lib\subprocess.py", line 711, in __init__
       errread, errwrite)
     File "C:\Python27\lib\subprocess.py", line 948, in _execute_child
       startupinfo)
    WindowsError: [Error 2] Het systeem kan het opgegeven bestand niet vinden
    </module></module></stdin>

    The last dutch sentence does mean something like : The system can’t find the specified file.

    What do these errors mean, and how can I solve them ?

  • Anaconda ffmpeg package as a MovieWriter for Matlibplot-Animation

    28 décembre 2019, par DScott

    There was a useful discussion on this question in the following link, but i don’t have 50 reputation so cant comment there, and i wish clarification on a suggestion within the post.

    I wish to create MP4 videos using python. I work in an environment where I am prohibited from installing ffmpeg from http://ffmpeg.zeranoe.com/builds/

    A user named Fiat suggested installing a package named ffmpeg :

    https://github.com/kkroening/ffmpeg-python

    I have installed the package through Anaconda. This solved the issue for the original questioner, however I have had no such success.

    Could anyone advise how to use the ffmpeg package to allow the Matplotlib-Animation package to create MP4 videos ?

  • Python matplotlib.animation [Errno 13] Permission denied

    5 décembre 2019, par Fishman

    I am trying to create a simple animated histogram and save it as a .mp4 using matplotlib and ffmpeg on a mac. I have already installed ffMpeg, specified the ffmpeg path, and now I am getting a permission denied error when writing to a folder in my desktop. I tried running as sudo and still get the same error. Help is much appreciated, thank you !

    Here is the code :

    df = pd.read_csv('.../data.csv')

    df = df.dropna()
    #Get list of weeks
    weeks = df.ot_date.unique()
    fig, ax = plt.subplots()

    data = df.intervals_filled[df['ot_date'].isin([weeks[0]])]
    n, bins = np.histogram( data , 20)

    # get the corners of the rectangles for the histogram
    left = np.array(bins[:-1])
    right = np.array(bins[1:])
    bottom = np.zeros(len(left))
    top = bottom + n
    nrects = len(left)

    # here comes the tricky part -- we have to set up the vertex and path
    # codes arrays using moveto, lineto and closepoly

    # for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the
    # CLOSEPOLY; the vert for the closepoly is ignored but we still need
    # it to keep the codes aligned with the vertices
    nverts = nrects*(1 + 3 + 1)
    verts = np.zeros((nverts, 2))
    codes = np.ones(nverts, int) * path.Path.LINETO
    codes[0::5] = path.Path.MOVETO
    codes[4::5] = path.Path.CLOSEPOLY
    verts[0::5, 0] = left
    verts[0::5, 1] = bottom
    verts[1::5, 0] = left
    verts[1::5, 1] = top
    verts[2::5, 0] = right
    verts[2::5, 1] = top
    verts[3::5, 0] = right
    verts[3::5, 1] = bottom

    barpath = path.Path(verts, codes)
    patch = patches.PathPatch(
       barpath, facecolor='green', edgecolor='yellow', alpha=0.5)
    ax.add_patch(patch)

    ax.set_xlim(left[0], right[-1])
    ax.set_ylim(bottom.min(), top.max()+40)
    ax.set_xlabel('Number of intervals/week')
    ax.set_ylabel('Count of CSAs')
    plt.rcParams['animation.ffmpeg_path'] = '/usr/local/Cellar/ffmpeg'
    FFwriter = animation.FFMpegWriter()

    def animate(i):
       print i
       # simulate new data coming in
       data = df.intervals_filled[df['ot_date'].isin([weeks[i-1]])]
       n, bins = np.histogram(data, 20)
       yearweek = str(weeks[i-1])
       year = yearweek[0:4]
       week = yearweek[4:]
       title = 'Week %(wk)s of %(yr)s' %{'wk': week, 'yr': year}
       ax.set_title(title)
       top = bottom + n
       verts[1::5, 1] = top
       verts[2::5, 1] = top
       return [patch, ]

    ani = animation.FuncAnimation(fig, animate, 53,interval=1000, repeat=False)
    ani.save('/Users/.../Desktop/1b.mp4', writer = FFwriter)
    plt.show()

    And here is the traceback :

    Traceback (most recent call last):
     File "/Users/Fishman1049/Desktop/reserves_histogram_timeline/python/1b_text.py", line 109, in <module>
       ani.save('/Users/Fishman1049/Desktop/1b', writer = FFwriter)
     File "/Users/Fishman1049/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 761, in save
       with writer.saving(self._fig, filename, dpi):
     File "/Users/Fishman1049/anaconda/lib/python2.7/contextlib.py", line 17, in __enter__
       return self.gen.next()
     File "/Users/Fishman1049/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 186, in saving
       self.setup(*args)
     File "/Users/Fishman1049/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 176, in setup
       self._run()
     File "/Users/Fishman1049/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 204, in _run
       creationflags=subprocess_creation_flags)
     File "/Users/Fishman1049/anaconda/lib/python2.7/subprocess.py", line 710, in __init__
       errread, errwrite)
     File "/Users/Fishman1049/anaconda/lib/python2.7/subprocess.py", line 1335, in _execute_child
       raise child_exception
    OSError: [Errno 13] Permission denied
    </module>

    I am running matplotlib version 1.5.1, just installed FFmpeg today using homebrew, spyder 2.3.8, python 2.7 and OS X 10.10.5. Thank you !.