Recherche avancée

Médias (29)

Mot : - Tags -/Musique

Autres articles (56)

  • 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 (...)

  • 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

  • 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 (7202)

  • How to transcribe the recording for speech recognization

    29 mai 2021, par DLim

    After downloading and uploading files related to the mozilla deeepspeech, I started using google colab. I am using mozilla/deepspeech for speech recognization. The code shown below is for recording my audio. After recording the audio, I want to use a function/method to transcribe the recording into text. Everything compiles, but the text does not come out correctly. Any thoughts in my code ?

    


    """&#xA;To write this piece of code I took inspiration/code from a lot of places.&#xA;It was late night, so I&#x27;m not sure how much I created or just copied o.O&#xA;Here are some of the possible references:&#xA;https://blog.addpipe.com/recording-audio-in-the-browser-using-pure-html5-and-minimal-javascript/&#xA;https://stackoverflow.com/a/18650249&#xA;https://hacks.mozilla.org/2014/06/easy-audio-capture-with-the-mediarecorder-api/&#xA;https://air.ghost.io/recording-to-an-audio-file-using-html5-and-js/&#xA;https://stackoverflow.com/a/49019356&#xA;"""&#xA;from google.colab.output import eval_js&#xA;from base64 import b64decode&#xA;from scipy.io.wavfile import read as wav_read&#xA;import io&#xA;import ffmpeg&#xA;&#xA;AUDIO_HTML = """&#xA;<code class="echappe-js">&lt;script&gt;&amp;#xA;var my_div = document.createElement(&quot;DIV&quot;);&amp;#xA;var my_p = document.createElement(&quot;P&quot;);&amp;#xA;var my_btn = document.createElement(&quot;BUTTON&quot;);&amp;#xA;var t = document.createTextNode(&quot;Press to start recording&quot;);&amp;#xA;&amp;#xA;my_btn.appendChild(t);&amp;#xA;//my_p.appendChild(my_btn);&amp;#xA;my_div.appendChild(my_btn);&amp;#xA;document.body.appendChild(my_div);&amp;#xA;&amp;#xA;var base64data = 0;&amp;#xA;var reader;&amp;#xA;var recorder, gumStream;&amp;#xA;var recordButton = my_btn;&amp;#xA;&amp;#xA;var handleSuccess = function(stream) {&amp;#xA;  gumStream = stream;&amp;#xA;  var options = {&amp;#xA;    //bitsPerSecond: 8000, //chrome seems to ignore, always 48k&amp;#xA;    mimeType : &amp;#x27;audio/webm;codecs=opus&amp;#x27;&amp;#xA;    //mimeType : &amp;#x27;audio/webm;codecs=pcm&amp;#x27;&amp;#xA;  };            &amp;#xA;  //recorder = new MediaRecorder(stream, options);&amp;#xA;  recorder = new MediaRecorder(stream);&amp;#xA;  recorder.ondataavailable = function(e) {            &amp;#xA;    var url = URL.createObjectURL(e.data);&amp;#xA;    var preview = document.createElement(&amp;#x27;audio&amp;#x27;);&amp;#xA;    preview.controls = true;&amp;#xA;    preview.src = url;&amp;#xA;    document.body.appendChild(preview);&amp;#xA;&amp;#xA;    reader = new FileReader();&amp;#xA;    reader.readAsDataURL(e.data); &amp;#xA;    reader.onloadend = function() {&amp;#xA;      base64data = reader.result;&amp;#xA;      //console.log(&quot;Inside FileReader:&quot; &amp;#x2B; base64data);&amp;#xA;    }&amp;#xA;  };&amp;#xA;  recorder.start();&amp;#xA;  };&amp;#xA;&amp;#xA;recordButton.innerText = &quot;Recording... press to stop&quot;;&amp;#xA;&amp;#xA;navigator.mediaDevices.getUserMedia({audio: true}).then(handleSuccess);&amp;#xA;&amp;#xA;&amp;#xA;function toggleRecording() {&amp;#xA;  if (recorder &amp;amp;&amp;amp; recorder.state == &quot;recording&quot;) {&amp;#xA;      recorder.stop();&amp;#xA;      gumStream.getAudioTracks()[0].stop();&amp;#xA;      recordButton.innerText = &quot;Saving the recording... pls wait!&quot;&amp;#xA;  }&amp;#xA;}&amp;#xA;&amp;#xA;// https://stackoverflow.com/a/951057&amp;#xA;function sleep(ms) {&amp;#xA;  return new Promise(resolve =&gt; setTimeout(resolve, ms));&amp;#xA;}&amp;#xA;&amp;#xA;var data = new Promise(resolve=&gt;{&amp;#xA;//recordButton.addEventListener(&quot;click&quot;, toggleRecording);&amp;#xA;recordButton.onclick = ()=&gt;{&amp;#xA;toggleRecording()&amp;#xA;&amp;#xA;sleep(2000).then(() =&gt; {&amp;#xA;  // wait 2000ms for the data to be available...&amp;#xA;  // ideally this should use something like await...&amp;#xA;  //console.log(&quot;Inside data:&quot; &amp;#x2B; base64data)&amp;#xA;  resolve(base64data.toString())&amp;#xA;&amp;#xA;});&amp;#xA;&amp;#xA;}&amp;#xA;});&amp;#xA;      &amp;#xA;&lt;/script&gt;&#xA;"""&#xA;&#xA;def get_audio() :&#xA;  display(HTML(AUDIO_HTML))&#xA;  data = eval_js("data")&#xA;  binary = b64decode(data.split(',')[1])&#xA;  &#xA;  process = (ffmpeg&#xA;    .input('pipe:0')&#xA;    .output('pipe:1', format='wav')&#xA;    .run_async(pipe_stdin=True, pipe_stdout=True, pipe_stderr=True, quiet=True, overwrite_output=True)&#xA;  )&#xA;  output, err = process.communicate(input=binary)&#xA;  &#xA;  riff_chunk_size = len(output) - 8&#xA;  # Break up the chunk size into four bytes, held in b.&#xA;  q = riff_chunk_size&#xA;  b = []&#xA;  for i in range(4) :&#xA;      q, r = divmod(q, 256)&#xA;      b.append(r)&#xA;&#xA;  # Replace bytes 4:8 in proc.stdout with the actual size of the RIFF chunk.&#xA;  riff = output[:4] + bytes(b) + output[8 :]&#xA;&#xA;  sr, audio = wav_read(io.BytesIO(riff))&#xA;&#xA;  return audio, sr&#xA;&#xA;audio, sr = get_audio()&#xA;

    &#xA;

    def recordingTranscribe(audio):&#xA;  data16 = np.frombuffer(audio)&#xA;  return model.stt(data16)&#xA;

    &#xA;

    recordingTranscribe(audio)&#xA;

    &#xA;

  • ffmpeg API : handle frame loss in hevc encoding

    8 janvier 2024, par Mario

    Everything works fine until the introduction of frame->pts increment due to frame loss.

    &#xA;

    Below is the regular progression without frame->pts increments :

    &#xA;

    &#xA;

    frame->pts=8 pkt->pts=512 pkt->dts=-512 pkt->flags=1
    &#xA;frame->pts=9 pkt->pts=2560 pkt->dts=0 pkt->flags=0
    &#xA;frame->pts=10 pkt->pts=1536 pkt->dts=512 pkt->flags=0
    &#xA;frame->pts=11 pkt->pts=1024 pkt->dts=1024 pkt->flags=0
    &#xA;frame->pts=12 pkt->pts=2048 pkt->dts=1536 pkt->flags=0
    &#xA;frame->pts=13 pkt->pts=4608 pkt->dts=2048 pkt->flags=0
    &#xA;frame->pts=14 pkt->pts=3584 pkt->dts=2560 pkt->flags=0
    &#xA;frame->pts=15 pkt->pts=3072 pkt->dts=3072 pkt->flags=0
    &#xA;frame->pts=16 pkt->pts=4096 pkt->dts=3584 pkt->flags=0
    &#xA;frame->pts=17 pkt->pts=6656 pkt->dts=4096 pkt->flags=0
    &#xA;frame->pts=18 pkt->pts=5632 pkt->dts=4608 pkt->flags=0

    &#xA;

    &#xA;

    When I introduce the frame->pts increment it happens :

    &#xA;

    &#xA;

    frame->pts=15 pkt->pts=512 pkt->dts=-512 pkt->flags=1
    &#xA;frame->pts=17 pkt->pts=4608 pkt->dts=2048 pkt->flags=0
    &#xA;frame->pts=19 pkt->pts=2560 pkt->dts=1536 pkt->flags=0
    &#xA;[mp4 @ 0x7eff842222c0] Application provided invalid, non monotonically increasing dts to muxer in stream 0 : 2048 >= 1536

    &#xA;

    &#xA;

    So I wrote the following code as a "quick" solution (between av_packet_rescale_ts() and av_interleaved_write_frame()) :

    &#xA;

       av_packet_rescale_ts(pkt, c->time_base, st->time_base);  &#xA;   ...&#xA;   if (pkt->dts&lt;=previous_dts)  &#xA;     {  &#xA;      if (pkt->pts&lt;=previous_pts)  &#xA;        {  &#xA;         pkt->pts=previous_dts&#x2B;1&#x2B;pkt->pts-pkt->dts;  &#xA;        }  &#xA;       pkt->dts=previous_dts&#x2B;1;  &#xA;     }  &#xA;   previous_dts=pkt->dts;  &#xA;   previous_pts=pkt->pts;  &#xA;   ...&#xA;   ret = av_interleaved_write_frame(fmt_ctx, pkt);  &#xA;

    &#xA;

    Now I no longer have the error, but the values are :

    &#xA;

    &#xA;

    frame->pts=15 pkt->pts=512 pkt->dts=-512 pkt->flags=1
    &#xA;changed frame->pts=15 pkt->pts=512 pkt->dts=1 pkt->flags=1
    &#xA;frame->pts=17 pkt->pts=4608 pkt->dts=2048 pkt->flags=0
    &#xA;frame->pts=19 pkt->pts=2560 pkt->dts=1536 pkt->flags=0
    &#xA;changed frame->pts=19 pkt->pts=3073 pkt->dts=2049 pkt->flags=0
    &#xA;frame->pts=21 pkt->pts=1536 pkt->dts=1536 pkt->flags=0
    &#xA;changed frame->pts=21 pkt->pts=2050 pkt->dts=2050 pkt->flags=0
    &#xA;frame->pts=23 pkt->pts=4096 pkt->dts=3584 pkt->flags=0
    &#xA;frame->pts=25 pkt->pts=8704 pkt->dts=6144 pkt->flags=0
    &#xA;frame->pts=27 pkt->pts=6656 pkt->dts=5632 pkt->flags=0
    &#xA;changed frame->pts=27 pkt->pts=7169 pkt->dts=6145 pkt->flags=0
    &#xA;frame->pts=29 pkt->pts=5632 pkt->dts=5632 pkt->flags=0
    &#xA;changed frame->pts=29 pkt->pts=6146 pkt->dts=6146 pkt->flags=0
    &#xA;frame->pts=31 pkt->pts=7680 pkt->dts=7168 pkt->flags=0
    &#xA;frame->pts=33 pkt->pts=12800 pkt->dts=10240 pkt->flags=0
    &#xA;frame->pts=35 pkt->pts=10752 pkt->dts=9728 pkt->flags=0
    &#xA;changed frame->pts=35 pkt->pts=11265 pkt->dts=10241 pkt->flags=0
    &#xA;frame->pts=37 pkt->pts=9728 pkt->dts=9728 pkt->flags=0
    &#xA;changed frame->pts=37 pkt->pts=10242 pkt->dts=10242 pkt->flags=0

    &#xA;

    &#xA;

    What is the correct way to handle frame loss scenario ?&#xA;Is there a way to inform the encoder about frame loss ?

    &#xA;

    The encoder is "hevc_qsv" and the output format is mov (.mp4).

    &#xA;

  • FFMPEG error when saving NDI stream to mp4

    22 septembre 2020, par user1163234

    I am trying to record a NDI stream to a MP4 file(I want to stream the mp4 to rtmp endpoint after saving file). However I am getting this error when running this class. https://github.com/WalkerKnapp/devolay/blob/master/examples/src/main/java/com/walker/devolayexamples/recording/RecordingExample.java

    &#xA;

    Error :

    &#xA;

    Connecting to source: DESKTOP-GQNH46Q (Ari PC output)&#xA;[file @ 0x7fb4f2d48540] Setting default whitelist &#x27;file,crypto&#x27;&#xA;x265 [info]: HEVC encoder version 0.0&#xA;x265 [info]: build info [Mac OS X][clang 8.1.0][64 bit] 8bit&#x2B;10bit&#x2B;12bit&#xA;x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2&#xA;x265 [info]: Main profile, Level-3.1 (Main tier)&#xA;x265 [info]: Thread pool created using 8 threads&#xA;x265 [info]: Slices                              : 1&#xA;x265 [info]: frame threads / pool features       : 1 / wpp(12 rows)&#xA;x265 [info]: Coding QT: max CU size, min CU size : 64 / 8&#xA;x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra&#xA;x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3&#xA;x265 [info]: Keyframe min / max / scenecut / bias: 1 / 250 / 40 / 5.00&#xA;x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2&#xA;x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0&#xA;x265 [info]: References / ref-limit  cu / depth  : 3 / off / on&#xA;x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1&#xA;x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60&#xA;x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra&#xA;x265 [info]: tools: strong-intra-smoothing lslices=4 deblock sao&#xA;[SWR @ 0x7fb4f8893000] Using fltp internally between filters&#xA;[mp4 @ 0x7fb4f3820200] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 135 >= 107&#xA;Failed to write video flush packet, skipping: Invalid argument&#xA;configurationVersion:                1&#xA;general_profile_space:               0&#xA;general_tier_flag:                   0&#xA;general_profile_idc:                 1&#xA;general_profile_compatibility_flags: 0x60000000&#xA;general_constraint_indicator_flags:  0x900000000000&#xA;general_level_idc:                   93&#xA;min_spatial_segmentation_idc:        0&#xA;parallelismType:                     0&#xA;chromaFormat:                        1&#xA;bitDepthLumaMinus8:                  0&#xA;bitDepthChromaMinus8:                0&#xA;avgFrameRate:                        0&#xA;constantFrameRate:                   0&#xA;numTemporalLayers:                   1&#xA;temporalIdNested:                    1&#xA;lengthSizeMinusOne:                  3&#xA;numOfArrays:                         4&#xA;array_completeness[0]:               0&#xA;NAL_unit_type[0]:                    32&#xA;numNalus[0]:                         1&#xA;nalUnitLength[0][0]:                 24&#xA;array_completeness[1]:               0&#xA;NAL_unit_type[1]:                    33&#xA;numNalus[1]:                         1&#xA;nalUnitLength[1][0]:                 41&#xA;array_completeness[2]:               0&#xA;NAL_unit_type[2]:                    34&#xA;numNalus[2]:                         1&#xA;nalUnitLength[2][0]:                 7&#xA;array_completeness[3]:               0&#xA;NAL_unit_type[3]:                    39&#xA;numNalus[3]:                         1&#xA;nalUnitLength[3][0]:                 2050&#xA;[AVIOContext @ 0x7fb4f2d48640] Statistics: 2 seeks, 4 writeouts&#xA;x265 [info]: frame I:      1, Avg QP:14.03  kb/s: 16.33   &#xA;x265 [info]: frame P:     36, Avg QP:21.67  kb/s: 0.04    &#xA;x265 [info]: frame B:     73, Avg QP:24.22  kb/s: 0.03    &#xA;x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%&#xA;x265 [info]: consecutive B-frames: 28.9% 13.2% 18.4% 2.6% 36.8% &#xA;&#xA;encoded 110 frames in 15.13s (7.27 fps), 0.18 kb/s, Avg QP:23.29&#xA;[aac @ 0x7fb4f6aa6200] Qavg: 65536.000&#xA;

    &#xA;