
Recherche avancée
Médias (29)
-
#7 Ambience
16 octobre 2011, par
Mis à jour : Juin 2015
Langue : English
Type : Audio
-
#6 Teaser Music
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#5 End Title
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
Autres articles (101)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Modifier la date de publication
21 juin 2013, parComment changer la date de publication d’un média ?
Il faut au préalable rajouter un champ "Date de publication" dans le masque de formulaire adéquat :
Administrer > Configuration des masques de formulaires > Sélectionner "Un média"
Dans la rubrique "Champs à ajouter, cocher "Date de publication "
Cliquer en bas de la page sur Enregistrer -
Publier sur MédiaSpip
13 juin 2013Puis-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
Sur d’autres sites (9418)
-
JavaScript MediaSource && ffmpeg chunks
17 mai 2023, par OmriHalifaI have written the following code for a player that can receive chunks sent by ffmpeg through stdout and display them using mediaSource :


index.js (server of this request)


const express = require('express')
const app = express()
const port = 4545
const cp = require('child_process')
const cors = require('cors')
const { Readable } = require('stream');



app.use(cors())

app.get('/startRecording', (req, res) => {
 const ffmpeg = cp.spawn('ffmpeg', ['-f', 'dshow', '-i', 'video=HP Wide Vision HD Camera', '-profile:v', 'high', '-pix_fmt', 'yuvj420p', '-level:v', '4.1', '-preset', 'ultrafast', '-tune', 'zerolatency', '-vcodec', 'libx264', '-r', '10', '-b:v', '512k', '-s', '640x360', '-acodec', 'aac', '-ac', '2', '-ab', '32k', '-ar', '44100', '-f', 'mpegts', '-flush_packets', '0', '-' /*'udp://235.235.235.235:12345?pkt_size=1316'*/ ]);
 
 ffmpeg.stdout.on('data', (data) => {
 //console.log(`stdout: ${data}`);
 res.write(data)
 });

 ffmpeg.stderr.on('data', (data) => {
 const byteData = Buffer.from(data, 'utf8'); // Replace with your actual byte data
 const byteStream = new Readable();
 byteStream.push(byteData);
 byteStream.push(null);
 const encoding = 'utf8';
 let text = '';
 byteStream.on('data', (chunk) => {
 text += chunk.toString(encoding);
 });

 byteStream.on('end', () => {
 console.log(text); // Output the converted text
 });


 //console.log({data})
 //res.write(data)
 });

 ffmpeg.on('close', (code) => {
 console.log(`child process exited with code ${code}`);
 });
})

app.listen(port, () => {
 console.log(`Video's Server listening on port ${port}`); 
});



App.js (In react, the side of the player) :


import { useEffect } from 'react';

function App() {
 async function transcode() {
 const mediaSource = new MediaSource();
 const videoElement = document.getElementById('videoElement');
 videoElement.src = URL.createObjectURL(mediaSource);
 
 
 mediaSource.addEventListener('sourceopen', async () => {
 console.log('MediaSource open');
 const sourceBuffer = mediaSource.addSourceBuffer('video/mp4; codecs="avc1.42c01e"');
 try {
 const response = await fetch('http://localhost:4545/startRecording');
 const reader = response.body.getReader();
 
 reader.read().then(async function processText({ done, value }) {
 if (done) {
 console.log('Stream complete');
 return;
 }

 console.log("B4 append", videoElement)
 await sourceBuffer.appendBuffer(value);
 console.log("after append",value);
 // Display the contents of the sourceBuffer
 sourceBuffer.addEventListener('updateend', function(e) { if (!sourceBuffer.updating && mediaSource.readyState === 'open') { mediaSource.endOfStream(); } });
 
 // Call next read and repeat the process
 return reader.read().then(processText);
 });
 } catch (error) {
 console.error(error);
 }
 });

 console.log("B4 play")
 await videoElement.play();
 console.log("after play")

 }
 
 
 useEffect(() => {}, []);

 return (
 <div classname="App">
 <div>
 <video></video>
 </div>
 <button>start streaming</button>
 </div>
 );
}

export default App;




this what i get :
what i get


the chunks are being received and passed to the Uint8Array correctly, but the video is not being displayed. why can be the result of this and how to correct it ?


-
Create a 44-byte header with ffmpeg
13 juillet 2015, par Joe AllenI made a program using ffmpeg libraries that converts an audio file to a wav file. Except the only problem is that it doesn’t create a 44-byte header. When input the file into Kaldi Speech Recognition, it produces the error :
ERROR (online2-wav-nnet2-latgen-faster:Read4ByteTag():wave-reader.cc:74) WaveData: expected 4-byte chunk-name, got read errror
I ran the file thru shntool and it reports a 78-byte header. Is there anyway I can get the standard 44-byte header using ffmpeg libraries ?
-
How to save python compatible audio file from JavaScript blob
16 septembre 2020, par Talha AnwarI am trying to save an audio blob to the backend.
Here is an audio blob


const blob = new Blob(chunks, { 'type' : 'audio/wav; codecs=0' });



Here is the upload function


function uploadAudio( blob ) {
 var reader = new FileReader();
 reader.onload = function(event){
 var fd = {};
 fd["data"] = event.target.result;
 $.ajax({
 // contentType:"application/x-www-form-urlencoded; charset=UTF-8",
 type: 'POST',
 url: 'testing/',
 data: fd,
 dataType: 'text'
 }).done(function(data) {
 console.log(data);
 document.getElementById("response").innerHTML=data;
 // alert(data);
 });
 };



Here is the function to save the file.


def upload_audio(request):
 print('upload_audio')
 if request.is_ajax():
 
 req=request.POST.get('data')
 d=req.split(",")[1]
 print("Yes, AJAX!")
 #print(request.body)
 f = open('./file.wav', 'wb')
 
 f.write(base64.b64decode(d))
 #f.write(request.body)
 f.close()
 return HttpResponse('audio received')



When I try to read it in python for converting to text. I got following error


ValueError: Audio file could not be read as PCM WAV, AIFF/AIFF-C, or Native FLAC; check if file is corrupted or in another format



I tried to convert the file


import ffmpeg
stream = ffmpeg.input('file.wav')
stream = ffmpeg.output(stream, 'filen.wav')
ffmpeg.run(stream)



I got following error


Traceback (most recent call last):
 File "script.py", line 8, in <module>
 ffmpeg.run(stream)
 File "C:\Anaconda3\envs\VA\lib\site-packages\ffmpeg\_run.py", line 320, in run
 overwrite_output=overwrite_output,
 File "C:\Anaconda3\envs\VA\lib\site-packages\ffmpeg\_run.py", line 285, in run_async
 args, stdin=stdin_stream, stdout=stdout_stream, stderr=stderr_stream
 File "C:\Anaconda3\envs\VA\lib\subprocess.py", line 729, in __init__
 restore_signals, start_new_session)
 File "C:\Anaconda3\envs\VA\lib\subprocess.py", line 1017, in _execute_child
 startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
</module>