Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP 0.2

Autres articles (94)

  • Mediabox : ouvrir les images dans l’espace maximal pour l’utilisateur

    8 février 2011, par

    La visualisation des images est restreinte par la largeur accordée par le design du site (dépendant du thème utilisé). Elles sont donc visibles sous un format réduit. Afin de profiter de l’ensemble de la place disponible sur l’écran de l’utilisateur, il est possible d’ajouter une fonctionnalité d’affichage de l’image dans une boite multimedia apparaissant au dessus du reste du contenu.
    Pour ce faire il est nécessaire d’installer le plugin "Mediabox".
    Configuration de la boite multimédia
    Dès (...)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

Sur d’autres sites (4377)

  • How to plot an animated graph

    2 août 2019, par Mukonza Sabastian Simbarashe

    Following along How to Create Animated Graphs in Python when constructing an animated plot then on writing the ffmpeg I get the following error :

    'Requested MovieWriter ({}) not available'.format(name))
    RuntimeError: Requested MovieWriter (ffmpeg) not available

    After getting this error, I initially tried to install ffmpeg using pip by the following method :

    python -m install ffmpeg

    and it seems to have successfully installed ffmpeg, but going back to my code I still get the same error

    Find below my code :

    import numpy as np
    import pandas as pd
    import seaborn as sns
    import matplotlib
    import matplotlib.pyplot as plt
    import matplotlib.animation as animation

    overdoses = pd.read_excel(r'C:\Users\ACER\Desktop\overdose_data_1999-2015.xls',sheet_name='Online',skiprows =6)

    def get_data(table,rownum,title):
       data = pd.DataFrame(table.loc[rownum][2:]).astype(float)
       data.columns = {title}
       return data

    title = 'Heroin Overdoses'
    d = get_data(overdoses,18,title)
    x = np.array(d.index)
    y = np.array(d['Heroin Overdoses'])
    overdose = pd.DataFrame(y,x)
    overdose.columns = {title}
    Writer = animation.writers['ffmpeg']

    Here is the stack trace :

    Traceback (most recent call last):
     File "C:\Python\Python36\lib\site-packages\matplotlib\animation.py", line 161, in __getitem__
       return self.avail[name]
    KeyError: 'ffmpeg'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
     File "", line 1, in <module>
       Writer = animation.writers['ffmpeg']
     File "C:\Python\Python36\lib\site-packages\matplotlib\animation.py", line 164, in __getitem__
       'Requested MovieWriter ({}) not available'.format(name))
    RuntimeError: Requested MovieWriter (ffmpeg) not available
    </module>
  • FFMPEG file writer in python 2.7

    6 avril 2017, par byBanachTarskiIamcorrect

    Trying to animate a string in python, i think my code is fine but just having difficulties with the file writer. My code is (based off https://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/) :

    import numpy as np
    import scipy as sci
    import matplotlib.pyplot as plt
    import matplotlib.animation as animation
    plt.rcParams['animation.ffmpeg_path'] = 'C:\FFMPEG\bin\ffmpeg'


    s1=10.15
    gamma=(np.pi*np.sqrt(2))/2
    gamma=sci.special.jn_zeros(0,10)
    gamma1=gamma[9]
    gamma2=gamma[8]
    print gamma1,gamma2

    sigma=np.linspace(0,2*s1,10000)

    def xprime(sigma,t):
       alpha = gamma1*(np.cos(np.pi*t/s1)*np.cos((np.pi*sigma)/s1))
       beta = gamma1*(np.sin(np.pi*t/s1)*np.sin((np.pi*sigma)/s1))
       xprime=np.cos(alpha)*np.cos(beta)
       return xprime

    def yprime(sigma,t):
       alpha = gamma2*(np.cos(np.pi*t/s1)*np.cos((np.pi*sigma)/s1))
       beta = gamma2*(np.sin(np.pi*t/s1)*np.sin((np.pi*sigma)/s1))
       yprime=np.cos(alpha)*np.sin(beta)
       return yprime

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

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

    def animate(i):
       sigma=np.linspace(0,2*s1,10000)
       t = (i*2*s1)/200
       yint=sci.integrate.cumtrapz(yprime(sigma,t),sigma)
       xint=sci.integrate.cumtrapz(xprime(sigma,t),sigma)
       line.set_data(xint, yint)
       return line,


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

    FFwriter=animation.FFMpegWriter()
    anim.save('basic_animation.mp4', writer=FFwriter, fps=30, extra_args=['-vcodec', 'libx264'])

    plt.show()

    Currently getting the error message

    RuntimeError: Passing in values for arguments for arguments fps, codec, bitrate, extra_args, or metadata is not supported when writer is an existing MovieWriter instance. These should instead be passed as arguments when creating the MovieWriter instance.'

    I think my error is in the calling or placement of the FFMpeg file but i’m unsure what i’m doing wrong. Probably very obvious but can’t see it at the moment / unsure what the error message actually means.

  • Saving video using matplotlib results in WinError 5 [duplicate]

    8 juillet 2015, par Chris

    This question already has an answer here :

    Using matplotlib it should be possible to animate videos and save them as mpeg. I have found a few tips and tricks on the web but I was not able to get it to work on my Windows 7 machine running Python 3.4. Here are two examples that I found on the web that both give me an exeption PermissionError: [WinError 5] Permission denied :

    import numpy as np
    from matplotlib import pyplot as plt
    from matplotlib import animation
    plt.rcParams['animation.ffmpeg_path'] = r'C:\Users\me\Desktop\ffmpeg-latest-win64-static\ffmpeg-20150702-git-03b2b40-win64-static\bin'

    metadata = dict(title='Movie Test', artist='Matplotlib',
           comment='Movie support!')
    writer = animation.FFMpegWriter(fps=15, metadata=metadata)

    fig = plt.figure()
    l, = plt.plot([], [], 'k-o')

    plt.xlim(-5, 5)
    plt.ylim(-5, 5)

    x0,y0 = 0, 0

    with writer.saving(fig, "writer_test.mp4", 100):
       for i in range(100):
           x0 += 0.1 * np.random.randn()
           y0 += 0.1 * np.random.randn()
           l.set_data(x0, y0)
           writer.grab_frame()

    And this one throws the same exeption :

    import numpy as np
    from matplotlib import pyplot as plt
    from matplotlib import animation
    plt.rcParams['animation.ffmpeg_path'] = r'C:\Users\wiesmeyrc\Desktop\ffmpeg-latest-win64-static\ffmpeg-20150702-git-03b2b40-win64-static\bin'

    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)

    FFwriter = animation.FFMpegWriter()
    anim.save('basic_animation.mp4', writer = FFwriter, fps=30, extra_args=['-vcodec', 'libx264'])

    [EDIT] : Here is the full stack trace :

    Traceback (most recent call last):
     File ".\matplotlib_animation.py", line 37, in <module>
       with writer.saving(fig, r'C:\Users\wiesmeyrc\Documents\Python Scripts\basic_animation.mp4', 100):
     File "C:\Anaconda3\lib\contextlib.py", line 59, in __enter__
       return next(self.gen)
     File "C:\Anaconda3\lib\site-packages\matplotlib\animation.py", line 186, in saving
       self.setup(*args)
     File "C:\Anaconda3\lib\site-packages\matplotlib\animation.py", line 176, in setup
       self._run()
     File "C:\Anaconda3\lib\site-packages\matplotlib\animation.py", line 204, in _run
       creationflags=subprocess_creation_flags)
     File "C:\Anaconda3\lib\subprocess.py", line 858, in __init__
       restore_signals, start_new_session)
     File "C:\Anaconda3\lib\subprocess.py", line 1111, in _execute_child
       startupinfo)
    PermissionError: [WinError 5] Zugriff verweigert
    </module>