Recherche avancée

Médias (91)

Autres articles (37)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (6089)

  • Anomalie #4708 : Comportement du modèle différent en 3.3

    30 mars 2021, par Fabrice Véronneau

    Après comparaisons sur 2 sites en 3.3 et avec 2 comportements différents, puis de multiples vidages de cache (spip, varnish, navigateurs) j’arrive au même résultat qu’en 3.2.
    Selon moi, ce ticket n’aurait donc plus lieu d’être puisque je ne reproduis plus le bug.

  • How to use audio frame after decode mp3 file using pyav, ffmpeg, python

    2 janvier 2021, par Long Tran Dai

    I am using using python with pyav, ffmpeg to decode mp3 in the memory. I know there are some other way to do it, like pipe ffmpeg command. However, I would like to explore pyav and ffmpeg API. So I have the following code. It works but the sound is very noisy, although hearable :

    


    import numpy as np&#xA;import av # to convert mp3 to wav using ffmpeg&#xA;import pyaudio # to play music&#xA;&#xA;mp3_path = &#x27;D:/MyProg/python/SauTimThiepHong.mp3&#x27;&#xA;&#xA;def decodeStream(mp3_path):&#xA;  # Run NOT OK&#xA;  &#xA;  container = av.open(mp3_path)&#xA;  stream = next(s for s in container.streams if s.type == &#x27;audio&#x27;)&#xA;  frame_count = 0&#xA;  data = bytearray()&#xA;  for packet in container.demux(stream):&#xA;    # <class>&#xA;    # We need to skip the "flushing" packets that `demux` generates.&#xA;    #if frame_count == 5000 : break         &#xA;    if packet.dts is None:&#xA;        continue&#xA;    for frame in packet.decode():   &#xA;        #&#xA;        # type(frame) : <class>&#xA;        #frame.samples = 1152 : 1152 diem du lieu : Number of audio samples (per channel)&#xA;        # moi frame co size = 1152 (diem) * 2 (channels) * 4 (bytes / diem) = 9216 bytes&#xA;        # 11021 frames&#xA;        #arr = frame.to_ndarray() # arr.nbytes = 9216&#xA;&#xA;        #channels = []  &#xA;        channels = frame.to_ndarray().astype("float16")&#xA;        #for plane in frame.planes:&#xA;            #channels.append(plane.to_bytes()) #plane has 4 bytes / sample, but audio has only 2 bytes&#xA;        #    channels.append(np.frombuffer(plane, dtype=np.single).astype("float16"))&#xA;            #channels.append(np.frombuffer(plane, dtype=np.single)) # kieu np.single co 4 bytes&#xA;        if not frame.is_corrupt:&#xA;            #data.extend(np.frombuffer(frame.planes[0], dtype=np.single).astype("float16")) # 1 channel: noisy&#xA;            # type(planes) : <class>&#xA;            frame_count &#x2B;= 1&#xA;            #print( &#x27;>>>> %04d&#x27; % frame_count, frame)   &#xA;            #if frame_count == 5000 : break     &#xA;            # mix channels:&#xA;            for i in range(frame.samples):                &#xA;                for ch in channels: # dec_ctx->channels&#xA;                    data.extend(ch[i]) #noisy&#xA;                    #fwrite(frame->data[ch] &#x2B; data_size*i, 1, data_size, outfile)&#xA;  return bytes(data)&#xA;</class></class></class>

    &#xA;

    I use pipe ffmpeg to get decoded data to compare and find they are different :

    &#xA;

    def RunFFMPEG(mp3_path, target_fs = "44100"):&#xA;    # Run OK&#xA;    import subprocess&#xA;    # init command&#xA;    ffmpeg_command = ["ffmpeg", "-i", mp3_path,&#xA;                   "-ab", "128k", "-acodec", "pcm_s16le", "-ac", "0", "-ar", target_fs, "-map",&#xA;                   "0:a", "-map_metadata", "-1", "-sn", "-vn", "-y",&#xA;                   "-f", "wav", "pipe:1"]&#xA;    # excute ffmpeg command&#xA;    pipe = subprocess.run(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize= 10**8)&#xA;    # debug&#xA;    #print(pipe.stdout, pipe.stderr)&#xA;    # read signal as numpy array and assign sampling rate&#xA;    #audio_np = np.frombuffer(buffer=pipe.stdout, dtype=np.uint16, offset=44)&#xA;    #audio_np = np.frombuffer(buffer=pipe.stdout, dtype=np.uint16)&#xA;    #sig, fs  = audio_np, target_fs&#xA;    #return audio_np&#xA;    return pipe.stdout[78:]     &#xA;

    &#xA;

    Then I use pyaudio to play data and find it very noisy

    &#xA;

    p = pyaudio.PyAudio()&#xA;streamOut = p.open(format=pyaudio.paInt16, channels=2, rate= 44100, output=True)&#xA;#streamOut = p.open(format=pyaudio.paInt16, channels=1, rate= 44100, output=True)&#xA;&#xA;mydata = decodeStream(mp3_path)&#xA;print("bytes of mydata = ", len(mydata))&#xA;#print("bytes of mydata = ", mydata.nbytes)&#xA;&#xA;ffMpegdata = RunFFMPEG(mp3_path)&#xA;print("bytes of ffMpegdata = ", len(ffMpegdata)) &#xA;#print("bytes of ffMpegdata = ", ffMpegdata.nbytes)&#xA;&#xA;minlen = min(len(mydata), len(ffMpegdata))&#xA;print("mydata == ffMpegdata", mydata[:minlen] == ffMpegdata[:minlen]) # ffMpegdata.tobytes()[:minlen] )&#xA;&#xA;#bytes of mydata =  50784768&#xA;#bytes of ffMpegdata =  50784768&#xA;#mydata == ffMpegdata False&#xA;&#xA;streamOut.write(mydata)&#xA;streamOut.write(ffMpegdata)&#xA;streamOut.stop_stream()&#xA;streamOut.close()&#xA;p.terminate()&#xA;

    &#xA;

    Please help me to understand decoded frame of pyav api (after for frame in packet.decode() :). Should it be processed more ? or I have some error ?

    &#xA;

    It makes me crazy for 3 days. I could not guess where to go.

    &#xA;

    Thank you very much.

    &#xA;

  • Evolution #4604 (Nouveau) : Remplacer les input type="submit" par des button

    9 novembre 2020, par nicod _

    Histoire de se moderniser un peu et de perdre de mauvaises habitudes, je propose de remplacer tous les <input type="submit" /> par des <button></button>

    Aucun inconvénient (à part des css qui cibleraient input[type=submit] au lieu de .submit) et de multiples avantages :

    • un <button></button> peut contenir du html (une image par exemple, ou des ), un non
    • un <button></button> peut passer une value différente du texte affiché
    • un <input />, comme un <select></select>, est géré par l’OS et ne peut pas être stylé complètement (notamment les pseudos sélecteurs :before, pour y mettre une icone SVG en background par exemple)

    Un exemple de regex pour les remplacer :
    ]*)>
    remplacé par
    $3

    Par contre, même si type="submit" est le rôle par défaut des <button></button> il est conseillé de le conserver.

    PS : ce ticket concerne aussi Formidable