
Recherche avancée
Autres articles (53)
-
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
Mise à disposition des fichiers
14 avril 2011, parPar défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...) -
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)
Sur d’autres sites (6668)
-
Live video streaming with Node js ,HTML5, MPEG-DASH, FFMPEG and IP camera/Raspberry Pi
12 mai 2016, par sparksI am a programmer but i am very new in live video streaming concepts.I need help
What i want to accomplish
I want to develop an online live video streaming system.The scenario is i would have a device or number of devices(raspberry pi & camera only OR ip camera only ...not sure yet) to capture the video and stream the video live in real time remotely to my web app.Multiple clients can connect to the web app and watch the video live.The key things to note here, is that these devices should be wireless(able to connect to internet and live stream the content) and also i want to eliminate the idea of manually configuring the ip adrress to local WIFI router.So simply i turn on the device and it start streaming right away to the web app.
Infrastructure, Platforms,Browsers, Streaming methods and formats
In the beginning i just want to stream though chrome web browser(that’s all i care about).But in the future i would build android and IOS mobile apps.So long term i would expect to be Chrome and mobile(Android & IOS platforms)
So based on my research i learned that the client should be HTML5, streaming method MPEG-DASH(In the future add HLS), the web app will be in Node Js.I also came across Dash.js for Html5.My understanding of streaming based on my research
I also came across things like FFMPEG,Dash encoder and wowza which i am not clear about.Now correct me if i am wrong, my understanding is that FFMPEG get hold of the device/camera and the content(i am not sure the format of the content at this point)and format it(i am not sure what this means in simple english) and then Dash encoder picks up and re-format the content to MPEG-DASH format, which produces MPD and then Dash.js client uses MPD to display the video to the browser.
QUESTIONS
-
First correct me if i am wrong based on my understanding above or
clarify for me.Also I am not sure of where the wowza streaming
engine come into play. Do i even need it ? -
I am not sure of the devices to use between Raspberry pi with camera
module/ Or IP Wifi camera by itself.I know with raspberry pi
connected to internet you can set up all the necessary programs and
stream the video to web app directly(not sure about quality and
performance) but I am not sure about Wifi camera.Is it possible to
connect to the wifi camera remotely from the web app programatically
without opening the wifi router portal manually or i should stick
with Raspbery Pi ? -
For raspberry Pi would i be able to connect it with high quality
picture IP camera/web cam ? (The point here to get the best picture
through raspbery Pi)My expectations
Better performance and quality would be great.But i know live streaming is not easy so i am willing to compromise performance to a point but not quality.
Thank you in advance, Anything will be appreciated.I know this is a lot so take your time :)
-
-
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.