Recherche avancée

Médias (3)

Mot : - Tags -/Valkaama

Autres articles (68)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (10351)

  • 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;

  • 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&#xA;but It should have been 30 seconds.&#xA;I set a graph to run three curves, a total of 30 seconds of data,&#xA;the graph that ran on the py file is normal,&#xA;but the output is only the first two seconds of the output.&#xA;May I ask if I missed something

    &#xA;

    Below is my code

    &#xA;

    import matplotlib.pyplot as plt&#xA;from matplotlib import animation&#xA;from numpy import random &#xA;import pandas as pd&#xA;from matplotlib.animation import FFMpegWriter&#xA;&#xA;FFwriter=animation.FFMpegWriter(fps=30, extra_args=[&#x27;-vcodec&#x27;, &#x27;libx264&#x27;])&#xA;data = pd.read_csv(&#x27;apple1.csv&#x27;, delimiter = &#x27;,&#x27;, dtype = None)&#xA;data = data.values&#xA;AccX1=[]&#xA;AccY1=[]&#xA;AccZ1=[]&#xA;AccX2=[]&#xA;AccY2=[]&#xA;AccZ2=[]&#xA;&#xA;time = []&#xA;&#xA;for i in range(600):&#xA;        AccX1.append(data[i][8])&#xA;        AccY1.append(data[i][9])&#xA;        AccZ1.append(data[i][10])&#xA;        AccX2.append(data[i][24])&#xA;        AccY2.append(data[i][25])&#xA;        AccZ2.append(data[i][26])&#xA;        &#xA;        time.append(data[i][0])&#xA;        &#xA;fig = plt.figure()&#xA;ax1 = plt.axes(xlim=(0,3000), ylim=(6,-6))&#xA;line, = ax1.plot([], [], lw=2)&#xA;plt.xlabel(&#x27;ACC&#x27;)&#xA;plt.ylabel(&#x27;Time&#x27;)&#xA;&#xA;plotlays, plotcols = [3], ["r","g","b"]&#xA;lines = []&#xA;for index in range(3):&#xA;    lobj = ax1.plot([],[],lw=2,color=plotcols[index])[0]&#xA;    lines.append(lobj)&#xA;&#xA;&#xA;def init():&#xA;    for line in lines:&#xA;        line.set_data([],[])&#xA;    return lines&#xA;&#xA;x1,y1 = [],[]&#xA;x2,y2 = [],[]&#xA;x3,y3 = [],[]&#xA;&#xA;&#xA;&#xA;i=0&#xA;&#xA;def animate(frame):&#xA;    global i&#xA;    &#xA;    i&#x2B;=1&#xA;    x = i&#xA;    y = AccX1[i]&#xA;&#xA;    x1.append(x)&#xA;    y1.append(y)&#xA;&#xA;    x = i&#xA;    y = AccY1[i]&#xA;    x2.append(x)&#xA;    y2.append(y)&#xA;&#xA;    x = i&#xA;    y = AccZ1[i]&#xA;    x3.append(x)&#xA;    y3.append(y)&#xA;    &#xA;&#xA;    xlist = [x1, x2,x3]&#xA;    ylist = [y1, y2,y3]&#xA;&#xA;&#xA;    for lnum,line in enumerate(lines):&#xA;        line.set_data(xlist[lnum], ylist[lnum]) &#xA;&#xA;&#xA;    return lines&#xA;&#xA;&#xA;anim = animation.FuncAnimation(fig, animate,&#xA;                    init_func=init, blit=True,interval=10)&#xA;anim.save(&#x27;test.mp4&#x27;,writer=FFwriter)&#xA;plt.show()&#xA;

    &#xA;

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

    &#xA;

  • FFMPEG unable to take frame and save as image

    2 mai 2013, par alex

    I'm trying to save an image from a video frame and save it as a jpeg.
    This function works for smaller video files, but if the video is over 10 minutes it won't save the jpeg image. An error comes up as before trans.

    public function VideoToJpeg($localVideoPath, $localOutImgPath)
    {
       $Name = dirname(__FILE__) . "/ffmpeg";
       $Str = "$Name -i \"$localVideoPath\" -an -ss 00:00:03 -an -r 1 -vframes 1 -y \"$localOutImgPath\"";

       exec($Str);
    }

    Here is the error I got from ffmpeg

    [NULL @ 0370e760] Unable to find a suitable output format for &#39;path&#39;
    : Invalid argument