Recherche avancée

Médias (91)

Autres articles (53)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

Sur d’autres sites (7697)

  • Matplotlib : Live animation works fine but displays a blank plot when being saved

    18 juillet 2017, par Loïc Poncin

    I made a little forest fire animation. My code is at the end of the question.

    Here is some information before I ask my question :

    • No tree : forest[i,j] = 0
    • A tree : forest[i,j] = 1
    • A tree on fire : forest[i,j] = 2

    Basically what happens is that constructforest creates a 2 dimensional array called forest of size n by m with a probability of tree occupancy called p. After that setonfire sets on fire the forest and while the forest can burn spreadfire spread the fire.

    When I run forestfire with the Python prompt or the IPython prompt I get a nice animation but when I go check the video file that I saved I only see a blank plot.

    I did some research, I found many questions about this issue but none of the advice I read was helpful :

    Can someone tell me what is going on please ?

    forestfire.py

    from random import random

    import numpy as np

    import matplotlib.pylab as plt
    import matplotlib.colors as mcolors
    import matplotlib.animation as animation


    def hazard(p):
       r=random()
       assert p>=0 and p<=1
       return r <= p


    def constructforest(n,m,p):
       forest = np.zeros((n,n))
       for i in xrange(n):
           for j in xrange(m):
               if hazard(p):
                   forest[i,j] = 1
       return forest


    def setfire(forest,i,j):
       forest[i,j] = 2
       return forest


    def spreadfire(forest):    

       n,m=forest.shape
       c = np.copy(forest)

       for i in xrange(n):
           for j in xrange(m):

               if c[i,j] == 1:

                   Y, X = xrange(max(0,i-1),min(n,i+2)), xrange(max(0,j-1),min(m,j+2))

                   for y in Y:
                       for x in X:

                           if c[y,x] == 2:
                               forest[i,j] = 2                        
       return forest


    def canburn(forest):    

       n,m=forest.shape
       c = np.copy(forest)

       for i in xrange(n):
           for j in xrange(m):

               if c[i,j] == 1:

                   Y, X = xrange(max(0,i-1),min(n,i+2)), xrange(max(0,j-1),min(m,j+2))

                   for y in Y:
                       for x in X:

                           if c[y,x] == 2:
                               return True                      
       return False


    def forestfire(forest):

       fig, ax = plt.subplots()

       movie = []    

       # Colormap
       red, green, blue = [(1,0,0,1)], [(0,1,0,1)], [(0,0,1,1)]  

       colors = np.vstack((blue, green, red))
       mycmap = mcolors.LinearSegmentedColormap.from_list('my_colormap', colors)

       # Initialization
       k = 0

       forest = spreadfire(forest)

       im = plt.imshow(forest, animated=True, cmap = mycmap, interpolation="none", origin='lower')
       movie.append([im])

       # Fire propagation
       while canburn(forest):
           k += 1
           print k

           forest = spreadfire(forest)

           im = plt.imshow(forest, animated=True, cmap = mycmap, interpolation="none", origin='lower')
           movie.append([im])

       return animation.ArtistAnimation(fig, movie, blit=True, repeat_delay=100)



    ani = forestfire(setfire(constructforest(101,101,0.4),50,50))

    ani.save("forestfire_test.mp4", writer = 'ffmpeg', fps=5, dpi=500)

    EDIT

    As requested by @Y.Luo by @ImportanceOfBeingErnest in the comments I downgraded matplotlib to 2.0.0 and I changed the framerate of the animation but forestfire_test.mp4 still displays a blank plot.

    Here are my settings :
    enter image description here
    enter image description here

  • FFmpeg and Jupyter Notebooks

    12 mai 2022, par Clerni

    I'm getting the error RuntimeError: Requested MovieWriter (ffmpeg) not available when trying to run this simple example of creating and displaying an animation in a Jupyter Notebook.

    


    ---------------------------------------------------------------------------&#xA;RuntimeError                              Traceback (most recent call last)&#xA; in <module>&#xA;      8 &#xA;      9 # Define the meta data for the movie&#xA;---> 10 FFMpegWriter = manimation.writers[&#x27;ffmpeg&#x27;]&#xA;     11 metadata = dict(title=&#x27;Movie Test&#x27;, artist=&#x27;Matplotlib&#x27;,&#xA;     12                 comment=&#x27;a red circle following a blue sine wave&#x27;)&#xA;&#xA;/usr/local/lib/python3.8/dist-packages/matplotlib/animation.py in __getitem__(self, name)&#xA;    164         if self.is_available(name):&#xA;    165             return self._registered[name]&#xA;--> 166         raise RuntimeError(f"Requested MovieWriter ({name}) not available")&#xA;    167 &#xA;    168 &#xA;&#xA;RuntimeError: Requested MovieWriter (ffmpeg) not available&#xA;&#xA;</module>

    &#xA;

    Running !pip install ffmpeg didn't help, as ffmpeg is already installed, apparently :

    &#xA;

    Requirement already satisfied: ffmpeg in /home/username/.local/lib/python3.8/site-packages&#xA;

    &#xA;

    How can I make this work ?

    &#xA;

  • Does the incoming codec or audio-video sync matter when encoding from Xvfb using FFMPEG ?

    15 décembre 2022, par Nav

    How I'm capturing :
    &#xA;I'm using Xvfb on Linux, to capture a video and audio from an app that is also running on Linux. I'm using -f x11grab when capturing that video headlessly from Xvfb's frambuffer using FFMPEG, and encoding it using a few other parameters like -c:v libx264 -pix_fmt yuv420p.

    &#xA;

    The questions :
    &#xA;Since I'm reading from Xvfb framebuffer :

    &#xA;

      &#xA;
    1. Would it matter that the app uses SVC to encode the video, and I'm using H.264 ?
    2. &#xA;

    3. Would it matter if I use a different framerate than the app is using ?
    4. &#xA;

    5. Would it matter if I use a different pix_fmt than what the app is using ?
    6. &#xA;

    &#xA;

    Reason for asking :

    &#xA;

    enter image description here
    &#xA;As shown in the image (blue is the app, red is FFMPEG, green is Xvfb) ;

    &#xA;

      &#xA;
    • The CPU percentage consumed by FFMPEG shoots up when the app's CPU percentage shoots up. I've also encountered audio being ahead of video for some participants, but I'm unable to figure out whether it's due to network lag or due to FFMPEG's encoding.
    • &#xA;

    • Also, the aim is to reduce CPU consumption, so I was looking to see if I could do FFMPEG encoding in the same format as the app.
    • &#xA;

    &#xA;