
Recherche avancée
Autres articles (85)
-
Gestion générale des documents
13 mai 2011, parMédiaSPIP ne modifie jamais le document original mis en ligne.
Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...) -
Use, discuss, criticize
13 avril 2011, parTalk 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. -
Le profil des utilisateurs
12 avril 2011, parChaque 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 (...)
Sur d’autres sites (10174)
-
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)



-
Can't initialize "h264_mediacodec" for hw accelerated decoding, FFMPEG, Android
27 mars 2024, par Ramil GalinI am trying to create hw accelerated decoding on Android through JNI and following this example but, unfortunately,
avcodec_get_hw_config
returns nullptr.

I have also tried using
avcodec_find_decoder_by_name("h264_mediacodec")
, also returns nullptr.

I built ffmpeg (version 4.4) using this script with the flags :


--enable-jni \
--enable-mediacodec \
--enable-decoder=h264_mediacodec \
--enable-hwaccel=h264_mediacodec \



When configuring build I saw in logs
WARNING: Option --enable-hwaccel=h264_mediacodec did not match anything
, which is actually strange. FFMPEG 4.4 should support hw accelerated decoding using mediacodec.

Edit : (providing minimal reproducible example)


In the JNI method I init input context of decoder and init decoder :


void Decoder::initInputContext(
 const std::string& source,
 AVDictionary* options
 ) { // open input, and allocate format context
 if (
 avformat_open_input(
 &m_inputFormatContext,
 source.c_str(),
 NULL,
 options ? &options : nullptr
 ) < 0
 ) {
 throw FFmpegException(
 fmt::format("Decoder: Could not open source {}", source)
 );
 }
 
 // retrieve stream information
 if (avformat_find_stream_info(m_inputFormatContext, NULL) < 0) {
 throw FFmpegException(
 "Decoder: Could not find stream information"
 );
 }

 // get audio and video streams
 for (size_t i = 0; i < m_inputFormatContext->nb_streams; i++) {
 AVStream* inStream = m_inputFormatContext->streams[i];
 AVCodecParameters* inCodecpar = inStream->codecpar;
 if (
 inCodecpar->codec_type != AVMEDIA_TYPE_AUDIO &&
 inCodecpar->codec_type != AVMEDIA_TYPE_VIDEO
 ) {
 continue;
 }

 if (inCodecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
 m_videoStreamIdx = i;
 m_videoStream = inStream;

 m_codecParams.videoCodecId = m_videoStream->codecpar->codec_id;
 m_codecParams.fps = static_cast<int>(av_q2d(m_videoStream->r_frame_rate) + 0.5);
 m_codecParams.clockrate = m_videoStream->time_base.den;

 spdlog::debug(
 "Decoder: fps: {}, clockrate: {}",
 m_codecParams.fps,
 m_codecParams.clockrate
 )
 ;
 }

 if (inCodecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
 m_audioStreamIdx = i;
 m_audioStream = inStream;

 m_codecParams.audioCodecId = m_audioStream->codecpar->codec_id;
 m_codecParams.audioSamplerate = m_audioStream->codecpar->sample_rate;
 m_codecParams.audioChannels = m_audioStream->codecpar->channels;
 m_codecParams.audioProfile = m_audioStream->codecpar->profile;

 spdlog::debug(
 "Decoder: audio samplerate: {}, audio channels: {}, x: {}",
 m_codecParams.audioSamplerate,
 m_codecParams.audioChannels,
 m_audioStream->codecpar->channels
 )
 ;
 }
 }
 }

 void Decoder::initDecoder() {
 AVCodecParameters* videoStreamCodecParams = m_videoStream->codecpar;

 m_swsContext = sws_getContext(
 videoStreamCodecParams->width, videoStreamCodecParams->height, m_pixFormat,
 videoStreamCodecParams->width, videoStreamCodecParams->height, m_targetPixFormat,
 SWS_BICUBIC, nullptr, nullptr, nullptr);

 // find best video stream info and decoder
 int ret = av_find_best_stream(m_inputFormatContext, AVMEDIA_TYPE_VIDEO, -1, -1, &m_decoder, 0);
 if (ret < 0) {
 throw FFmpegException(
 "Decoder: Cannot find a video stream in the input file"
 );
 }

 if (!m_decoder) {
 throw FFmpegException(
 "Decoder: Can't find decoder"
 );
 }

 // search for supported HW decoder configuration
 for (size_t i = 0;; i++) {
 const AVCodecHWConfig* config = avcodec_get_hw_config(m_decoder, i);
 if (!config) {
 spdlog::error(
 "Decoder {} does not support device type {}. "
 "Will use SW decoder...",
 m_decoder->name,
 av_hwdevice_get_type_name(m_deviceType)
 );
 break;
 }

 if (
 config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX &&
 config->device_type == m_deviceType
 ) {
 // set up pixel format for HW decoder
 g_hwPixFmt = config->pix_fmt;
 m_hwDecoderSupported = true;
 break;
 }
 }
 }
</int>


And I have
AVHWDeviceType m_deviceType{AV_HWDEVICE_TYPE_MEDIACODEC};


avcodec_get_hw_config
returns nullptr.

Any help is appreciated.


-
Availability of WebM (VP8) Video Hardware IP Designs
10 janvier 2011, par noreply@blogger.com (John Luther)Hello from the frigid city of Oulu, in the far north of Finland. Our WebM hardware development team, formerly part of On2 Technologies, is now up-to-speed and working hard on a number of video efforts for WebM.
- VP8 (the video codec used in WebM) hardware decoder IP is available from Google for semiconductor companies who want to support high-quality WebM playback in their chipsets.
- The Oulu team will release the first VP8 video hardware encoder IP in the first quarter of 2011. We have the IP running in an FPGA environment, and rigorous testing is underway. Once all features have been tested and implemented, the encoder will be launched as well.
WebM video hardware IPs are implemented and delivered as RTL (VHDL/Verilog) source code, which is a register-level hardware description language for creating digital circuit designs. The code is based on the Hantro brand video IP from On2, which has been successfully deployed by numerous chipset companies around the world. Our designs support VP8 up to 1080p resolution and can run 30 or 60fps, depending on the foundry process and hardware clock frequency.
The WebM/VP8 hardware decoder implementation has already been licensed to over twenty partners and is proven in silicon. We expect the first commercial chips to integrate our VP8 decoder IP to be available in the first quarter of 2011. For example, Chinese semiconductor maker Rockchip last week demonstrated full WebM hardware playback on their new RK29xx series processor at CES in Las Vegas (video below).
Note : To view the video in WebM format, ensure that you’ve enrolled in the YouTube HTML5 trial and are using a WebM-compatible browser. You can also view the video on YouTube.Hardware implementations of the VP8 encoder also bring exciting possibilities for WebM in portable devices. Not only can hardware-accelerated devices play high-quality WebM content, but hardware encoding also enables high-resolution, real-time video communications apps on the same devices. For example, when VP8 video encoding is fully off-loaded to a hardware accelerator, you can run 720p or even 1080p video conferencing at full framerate on a portable device with minimal battery use.
The WebM hardware video IP team will be focusing on further developing the VP8 hardware designs while also helping our semiconductor partners to implement WebM video compression in their chipsets. If you have any questions, please visit our Hardware page.
Happy New Year to the WebM community !
Jani Huoponen, Product Manager
Aki Kuusela, Engineering Manager