Recherche avancée

Médias (91)

Autres articles (112)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

Sur d’autres sites (12030)

  • Difficulties saving an animation (matplotlib)

    14 avril 2020, par Ben C.

    I have a simple animation that I want to save. I followed the example : https://matplotlib.org/examples/animation/basic_example_writer.html

    



    But I get the following error : RuntimeError : Requested MovieWriter (ffmpeg) not available

    



    I installed ffmpeg and checked via ffmpeg -version that it really is installed and the path correct.

    



    Here is my code :

    



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

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

fig, ax = plt.subplots()

x = np.random.uniform(0,1)
y = np.random.uniform(0,1)


scat = ax.scatter(x,y, color= 'blue')
circle = plt.Circle((x,y), radius=0.1, color='blue', fill=False, lw=0.5)
ax.add_patch(circle)

def init():
    scat = ax.scatter(x, y, color = 'blue')
    circle = plt.Circle((x,y), radius=0.1, color='blue', fill=False, lw=0.5)

def animate(i):
    random = np.random.uniform(0,1)
    if random < 0.5:
        scat.set_color('red')
        circle.set_edgecolor('blue')
    else:
        scat.set_color('blue')
        circle.set_edgecolor('red')
    return circle, scat,


ani = animation.FuncAnimation(fig, animate, init_func=init(), interval=1000, blit=True)
ani.save('test.mp4', writer=writer)


    



    None of the proposed solution in RuntimeError : No MovieWriters available in Matplotlib animation worked for me. Any ideas ?

    



    Edit : I am using Windows (10)

    


  • Saving raw YUV420P frame FFmpeg/Libav

    14 mars 2016, par Sir DrinksCoffeeALot

    Previously i successfully opened, decoded and saved frames from .mp4 file. Raw frames were in YUV420P format which i converted to RGB24 using sws_scale() function and saved them into a .ppm file. What i’m trying to do now is to keep raw decoded frames in YUV420P, or convert frames that i get to YUV420P just to make sure they are in YUV420P. But the problem is that i don’t know which type of file should i use, i’m guessing .yuv ? And another problem is that i also don’t know how to save YUV420P data.

    I used to save RGB24 in .ppmlike this :

    for (y = 0; y < height; y++)
    {
    fwrite(frame->data[0] + y*frame->linesize[0], 1, width * 3, pf);
    }

    which worked fine since i was using only 1 plane. But YUV420P uses 3 planes (Y,Cb,Cr). What i tried to do is to save Y component first, and Cb/Cr after that.

    for (y = 0; y < height; y++)
    {
       fwrite(frame->data[0] + y*frame->linesize[0], 1, width, pf);
    }

    for (y = 0; y < height / 2; y++)
    {
       fwrite(frame->data[1] + y*frame->linesize[1], 1, width, pf);
       fwrite(frame->data[2] + y*frame->linesize[2], 1, width, pf);
    }

    But as you can guess that is not working at all. Actually it does, but it saves only Y component. Could anyone guide me to right direction please ?

    EDIT
    I’ve changed mine saveFrame() function like you said, but instead of interleaved chroma writing i used planar. But, i’m still getting only Y component picture (black-white).

    fprintf(pf, "P5\n%d %d\n255\n", width, height);

    for (y = 0; y < height; y++)
    {
       fwrite(frame->data[0] + y*frame->linesize[0], 1, width, pf);
    }

    for (y = 0; y < height / 2; y++)
    {
       fwrite(frame->data[1] + y*frame->linesize[1], 1, width / 2, pf);
    }

    for (y = 0; y < height / 2; y++)
    {
       fwrite(frame->data[2] + y*frame->linesize[2], 1, width / 2, pf);
    }
  • Trouble saving matplotlib animation with ffmpeg

    21 avril 2017, par kevinkayaks

    I installed ffmpeg and would like to save an animation.

    My code is

    #evo is the dataset composed of sequence of images

    evo = np.load('bed_evolution_3000iter_2.npy')
    fig = plt.figure(figsize=(15,15*2*width/length))
    # make axesimage object
    # the vmin and vmax here are very important to get the color map correct
    im = plt.imshow(np.transpose(evo[0]), cmap=plt.get_cmap('jet'), vmin=0, vmax=1300)
    cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
    fig.colorbar(im, cax=cbar_ax)
    fig.subplots_adjust(right=0.8)

    def updatefig(j):    
       # set the data in the axesimage object
       im.set_array(np.transpose(evo[j]))
       # return the artists set
       return im,
    # kick off the animation
    ani = animation.FuncAnimation(fig, updatefig, frames=range(len(evo)),
                             interval=100, blit=True)

    #now just need to get the ability to save... this uses

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

    The animation runs and it looks good, but I just can’t get it to save. The error message (at this stage) is

    error

    I am not sure what’s going wrong. Any help is appreciated.

    EDIT :
    Following Can’t save matplotlib animation I added

    plt.rcParams['animation.ffmpeg_path'] ='C:\\Program Files\\ffmpeg  \\bin\\ffmpeg.exe'

    Which returns
    Warning : Cannot change to a different GUI toolkit : qt. Using qt4 instead.
    ERROR : execution aborted