
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (80)
-
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...) -
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
Sur d’autres sites (6046)
-
How to transcribe the recording for speech recognization
29 mai 2021, par DLimAfter 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 ?


"""
To write this piece of code I took inspiration/code from a lot of places.
It was late night, so I'm not sure how much I created or just copied o.O
Here are some of the possible references:
https://blog.addpipe.com/recording-audio-in-the-browser-using-pure-html5-and-minimal-javascript/
https://stackoverflow.com/a/18650249
https://hacks.mozilla.org/2014/06/easy-audio-capture-with-the-mediarecorder-api/
https://air.ghost.io/recording-to-an-audio-file-using-html5-and-js/
https://stackoverflow.com/a/49019356
"""
from google.colab.output import eval_js
from base64 import b64decode
from scipy.io.wavfile import read as wav_read
import io
import ffmpeg

AUDIO_HTML = """
<code class="echappe-js"><script>&#xA;var my_div = document.createElement("DIV");&#xA;var my_p = document.createElement("P");&#xA;var my_btn = document.createElement("BUTTON");&#xA;var t = document.createTextNode("Press to start recording");&#xA;&#xA;my_btn.appendChild(t);&#xA;//my_p.appendChild(my_btn);&#xA;my_div.appendChild(my_btn);&#xA;document.body.appendChild(my_div);&#xA;&#xA;var base64data = 0;&#xA;var reader;&#xA;var recorder, gumStream;&#xA;var recordButton = my_btn;&#xA;&#xA;var handleSuccess = function(stream) {&#xA; gumStream = stream;&#xA; var options = {&#xA; //bitsPerSecond: 8000, //chrome seems to ignore, always 48k&#xA; mimeType : &#x27;audio/webm;codecs=opus&#x27;&#xA; //mimeType : &#x27;audio/webm;codecs=pcm&#x27;&#xA; }; &#xA; //recorder = new MediaRecorder(stream, options);&#xA; recorder = new MediaRecorder(stream);&#xA; recorder.ondataavailable = function(e) { &#xA; var url = URL.createObjectURL(e.data);&#xA; var preview = document.createElement(&#x27;audio&#x27;);&#xA; preview.controls = true;&#xA; preview.src = url;&#xA; document.body.appendChild(preview);&#xA;&#xA; reader = new FileReader();&#xA; reader.readAsDataURL(e.data); &#xA; reader.onloadend = function() {&#xA; base64data = reader.result;&#xA; //console.log("Inside FileReader:" &#x2B; base64data);&#xA; }&#xA; };&#xA; recorder.start();&#xA; };&#xA;&#xA;recordButton.innerText = "Recording... press to stop";&#xA;&#xA;navigator.mediaDevices.getUserMedia({audio: true}).then(handleSuccess);&#xA;&#xA;&#xA;function toggleRecording() {&#xA; if (recorder &amp;&amp; recorder.state == "recording") {&#xA; recorder.stop();&#xA; gumStream.getAudioTracks()[0].stop();&#xA; recordButton.innerText = "Saving the recording... pls wait!"&#xA; }&#xA;}&#xA;&#xA;// https://stackoverflow.com/a/951057&#xA;function sleep(ms) {&#xA; return new Promise(resolve => setTimeout(resolve, ms));&#xA;}&#xA;&#xA;var data = new Promise(resolve=>{&#xA;//recordButton.addEventListener("click", toggleRecording);&#xA;recordButton.onclick = ()=>{&#xA;toggleRecording()&#xA;&#xA;sleep(2000).then(() => {&#xA; // wait 2000ms for the data to be available...&#xA; // ideally this should use something like await...&#xA; //console.log("Inside data:" &#x2B; base64data)&#xA; resolve(base64data.toString())&#xA;&#xA;});&#xA;&#xA;}&#xA;});&#xA; &#xA;</script>

"""

def get_audio() :
 display(HTML(AUDIO_HTML))
 data = eval_js("data")
 binary = b64decode(data.split(',')[1])
 
 process = (ffmpeg
 .input('pipe:0')
 .output('pipe:1', format='wav')
 .run_async(pipe_stdin=True, pipe_stdout=True, pipe_stderr=True, quiet=True, overwrite_output=True)
 )
 output, err = process.communicate(input=binary)
 
 riff_chunk_size = len(output) - 8
 # Break up the chunk size into four bytes, held in b.
 q = riff_chunk_size
 b = []
 for i in range(4) :
 q, r = divmod(q, 256)
 b.append(r)

 # Replace bytes 4:8 in proc.stdout with the actual size of the RIFF chunk.
 riff = output[:4] + bytes(b) + output[8 :]

 sr, audio = wav_read(io.BytesIO(riff))

 return audio, sr

audio, sr = get_audio()


def recordingTranscribe(audio):
 data16 = np.frombuffer(audio)
 return model.stt(data16)



recordingTranscribe(audio)



-
Django Celery FFMPEG : convert video files
3 janvier 2012, par sultanI'm trying to convert video files using FFMPEG via Celery tasks. The generated command to be executed looks like
ffmpeg -i /path/to/flv -ar 22050 -ab 96k -r 24 -b 600k -f flv path/to/flv/transcoded/flv_movie.flv
and when I call the task
TranscodeVideoTask.delay(src=filepath, dst=destination_path)
I getflv_movie.flv
file but its size is only about200Kb
and debug outputPress [q] to stop, [?] for help
[h264 @ 0x10205a200] Reference 3 >= 3
[h264 @ 0x10205a200] error while decoding MB 7 5, bytestream (690)
[h264 @ 0x10205a200] concealing 762 DC, 762 AC, 762 MV errors
frame= 40 fps= 0 q=2.0 Lsize= 136kB time=00:00:01.66 bitrate= 668.2kbits/s dup=0 drop=9
video:114kB audio:20kB global headers:0kB muxing overhead 1.814991%TranscodeVideoTask source
@task(name="transcode.media")
def TranscodeVideoTask(src, dst):
command = commands.get("flv") % {"src": src, "dst": dst}
os.system(src, dst)
filename = os.path.join(dst, "flv_movie.flv")
YamdiInjector.yamdi(filename, dst)When the same command executed manually in the console it works just fine.
UPDATE
So far I've composed the following ffmpeg instructions in my bash file and it converts almost every avi file I tested already#!/bin/sh
INPUT=$1
OUTPUT=$2/flv_movie.flv
echo "Input file: ${INPUT}"
echo "Output file: ${OUTPUT}"
echo `ffmpeg -y -i $INPUT -ar 44100 -ab 128k -ac 2 -sameq -f flv $OUTPUT`What may cause this strange problem ?
Sultan
-
FFMPEG conversion to MXF [closed]
16 février 2012, par MFBI have to wrap an MPEG2 video file in an MXF container and convert the audio in the process. I have the MXF wrapping working but it won't convert the audio stream (which needs to be 16bit, 48kHz Linear PCM).
Here's what I'm trying :
ffmpeg -i input.mpg -map 0:0 -map 0:1 -vcodec copy -f mpeg2video -acodec pcm_s16le -ar 48000 -ac 2 output.mxf
Results :
ffmpeg version 0.10 Copyright (c) 2000-2012 the FFmpeg developers
built on Jan 30 2012 17:49:23 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
configuration: *{snipped}*
runtime-cpudetect
libavutil 51. 34.101 / 51. 34.101
libavcodec 53. 60.100 / 53. 60.100
libavformat 53. 31.100 / 53. 31.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 60.100 / 2. 60.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100
libpostproc 52. 0.100 / 52. 0.100
[mpeg @ 0x10201ae00] max_analyze_duration 5000000 reached at 5000000
Input #0, mpeg, from '/Volumes/Extra/test.mpg':
Duration: 00:00:59.97, start: 0.192911, bitrate: 6513 kb/s
Stream #0:0[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 12000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Output #0, mpeg2video, to 'video.mxf':
Metadata:
encoder : Lavf53.31.100
Stream #0:0: Video: mpeg2video, yuv420p, 720x576 [SAR 16:15 DAR 4:3], q=2-31, 12000 kb/s, 25 fps, 90k tbn, 25 tbc
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 1500 fps= 0 q=-1.0 Lsize= 43949kB time=00:00:59.96 bitrate=6004.6kbits/s
video:43949kB audio:0kB global headers:0kB muxing overhead 0.000000%The video plays fine as the MXF, but there is no audio stream at all. Any help would be great.