Recherche avancée

Médias (91)

Autres articles (97)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

  • Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs

    12 avril 2011, par

    La manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
    Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.

Sur d’autres sites (9161)

  • Matplotlib use Ffmpeg to save plot to be mp4 not include full step

    21 décembre 2020, par 昌翰余

    I use ffmpeg to store the dynamic graph drawn on matplotlib, but the output file is only 2 seconds
but It should have been 30 seconds.
I set a graph to run three curves, a total of 30 seconds of data,
the graph that ran on the py file is normal,
but the output is only the first two seconds of the output.
May I ask if I missed something

    


    Below is my code

    


    import matplotlib.pyplot as plt
from matplotlib import animation
from numpy import random 
import pandas as pd
from matplotlib.animation import FFMpegWriter

FFwriter=animation.FFMpegWriter(fps=30, extra_args=['-vcodec', 'libx264'])
data = pd.read_csv('apple1.csv', delimiter = ',', dtype = None)
data = data.values
AccX1=[]
AccY1=[]
AccZ1=[]
AccX2=[]
AccY2=[]
AccZ2=[]

time = []

for i in range(600):
        AccX1.append(data[i][8])
        AccY1.append(data[i][9])
        AccZ1.append(data[i][10])
        AccX2.append(data[i][24])
        AccY2.append(data[i][25])
        AccZ2.append(data[i][26])
        
        time.append(data[i][0])
        
fig = plt.figure()
ax1 = plt.axes(xlim=(0,3000), ylim=(6,-6))
line, = ax1.plot([], [], lw=2)
plt.xlabel('ACC')
plt.ylabel('Time')

plotlays, plotcols = [3], ["r","g","b"]
lines = []
for index in range(3):
    lobj = ax1.plot([],[],lw=2,color=plotcols[index])[0]
    lines.append(lobj)


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

x1,y1 = [],[]
x2,y2 = [],[]
x3,y3 = [],[]



i=0

def animate(frame):
    global i
    
    i+=1
    x = i
    y = AccX1[i]

    x1.append(x)
    y1.append(y)

    x = i
    y = AccY1[i]
    x2.append(x)
    y2.append(y)

    x = i
    y = AccZ1[i]
    x3.append(x)
    y3.append(y)
    

    xlist = [x1, x2,x3]
    ylist = [y1, y2,y3]


    for lnum,line in enumerate(lines):
        line.set_data(xlist[lnum], ylist[lnum]) 


    return lines


anim = animation.FuncAnimation(fig, animate,
                    init_func=init, blit=True,interval=10)
anim.save('test.mp4',writer=FFwriter)
plt.show()


    


    The dynamic picture ran out using plt.show is correct.
And I don't think I have set the length of storage. Did I add something ?

    


  • How to save python compatible audio file from JavaScript blob

    16 septembre 2020, par Talha Anwar

    I am trying to save an audio blob to the backend.
Here is an audio blob

    


     const blob = new Blob(chunks, { 'type' : 'audio/wav; codecs=0' });


    


    Here is the upload function

    


    function uploadAudio( blob ) {
  var reader = new FileReader();
  reader.onload = function(event){
    var fd = {};
    fd["data"] = event.target.result;
    $.ajax({
     // contentType:"application/x-www-form-urlencoded; charset=UTF-8",
      type: 'POST',
      url: 'testing/',
      data: fd,
      dataType: 'text'
    }).done(function(data) {
        console.log(data);
        document.getElementById("response").innerHTML=data;
       // alert(data);
    });
  };


    


    Here is the function to save the file.

    


    def upload_audio(request):
    print('upload_audio')
    if request.is_ajax():
        
        req=request.POST.get('data')
        d=req.split(",")[1]
        print("Yes, AJAX!")
        #print(request.body)
        f = open('./file.wav', 'wb')
        
        f.write(base64.b64decode(d))
        #f.write(request.body)
        f.close()
    return HttpResponse('audio received')


    


    When I try to read it in python for converting to text. I got following error

    


    ValueError: Audio file could not be read as PCM WAV, AIFF/AIFF-C, or Native FLAC; check if file is corrupted or in another format


    


    I tried to convert the file

    


    import ffmpeg
stream = ffmpeg.input('file.wav')
stream = ffmpeg.output(stream, 'filen.wav')
ffmpeg.run(stream)


    


    I got following error

    


    Traceback (most recent call last):&#xA;  File "script.py", line 8, in <module>&#xA;    ffmpeg.run(stream)&#xA;  File "C:\Anaconda3\envs\VA\lib\site-packages\ffmpeg\_run.py", line 320, in run&#xA;    overwrite_output=overwrite_output,&#xA;  File "C:\Anaconda3\envs\VA\lib\site-packages\ffmpeg\_run.py", line 285, in run_async&#xA;    args, stdin=stdin_stream, stdout=stdout_stream, stderr=stderr_stream&#xA;  File "C:\Anaconda3\envs\VA\lib\subprocess.py", line 729, in __init__&#xA;    restore_signals, start_new_session)&#xA;  File "C:\Anaconda3\envs\VA\lib\subprocess.py", line 1017, in _execute_child&#xA;    startupinfo)&#xA;FileNotFoundError: [WinError 2] The system cannot find the file specified&#xA;</module>

    &#xA;

  • In Python, why do 'writer' is considered to be as an unexpected keyword argument for save

    23 mars 2014, par Strömungsmechanik

    I would like to save an animation using the function save in Python. During compilation, I get the following message :

    anim.save(&#39;mymovie.mp4&#39;,writer="ffmpeg")
    TypeError: save() got an unexpected keyword argument &#39;writer&#39;

    Please note that I have installed successfully FFmpeg. Here is a minimal working environment :

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

    X,Y = np.meshgrid(np.arange(0,2*np.pi,.2),np.arange(0,2*np.pi,.2) )  
    U = np.cos(X)
    V = np.sin(Y)

    fig,ax = plt.subplots(1,1)
    Q = ax.quiver( X, Y, U, V, pivot=&#39;mid&#39;, color=&#39;r&#39;, units=&#39;inches&#39;)

    ax.set_xlim(0, 2*pi)
    ax.set_ylim(0, 2*pi)

    def update_quiver(num, Q, X, Y):
       U = np.cos(X + num*0.1)
       V = np.sin(Y + num*0.1)
       Q.set_UVC(U,V)
       return Q,

    anim = animation.FuncAnimation(fig, update_quiver, fargs=(Q, X, Y),
       interval=10, blit=False)

    anim.save(&#39;mymovie.mp4&#39;,writer="ffmpeg")