Recherche avancée

Médias (1)

Mot : - Tags -/wave

Autres articles (77)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (5896)

  • 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

  • Issue with running codebook background subtraction sample program in OpenCV

    3 février 2013, par Anderson neo

    While I am trying to run the sample code in opencv samples directory for codebook based background subtraction in OpenCV. I am getting the following message on running it with the
    default tree.avi file as input.

    "Truncating packet of size 15414 to 1"

    I am using 32bit machine with Ubunutu and OpenCV version 2.4.9.
    I am not sure if their is an issue with my ffmpeg installation.
    Any help would be appreciated.
    Many Thanks !

  • How to calculate ffmpeg output file size ?

    25 septembre 2011, par poundifdef

    I am using ffmpeg to convert home videos to DVD format and want to calculate the output file size before doing the conversion.

    My input file has a bit rate of 7700 kbps and is 114 seconds long. The audio bitrate is 256 kbit (per second ?) The input file is 77MB. To get this information I ran :

    mplayer -vo null -ao null -frames 0 -identify input.MOD

    So in theory, the input file should have (roughly) a file size of :

    ((7700 / 8) * 114) / 1024

    That is, (7700 / 8) is kilobytes/second, multiplied by 114 seconds, and then converted to megabytes. This gives me 107MB, which is way beyond my 77. Thus I am skeptical of his formula.

    That said, after converting the video :

    ffmpeg -i input.MOD -y -target ntsc-dvd -sameq -aspect 4:3 output.mpg

    The numbers seem to make more sense. Bitrate is 9000 kbps, and applying the above formula, I get 125MB, and my actual output file size is 126MB.

    So, two questions :

    1. How do I factor the audio bitrate into this calculation ? Is it additive (video file size + audio file size) ?

    2. Do DVDs always have a 9000 kilobit/second rate ? Is that the definition of a DVD ? Or might that change depending on video quality of my input video ? What does "-target ntsc-dvd" guarantee about my video ?

    3. Why does my input file not "match" the calculation, but the output file does ? Is there some other variable I'm not accounting for ?

    What is the correct way to calculate filesize ?