
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (62)
-
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 -
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 (...) -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
Sur d’autres sites (11271)
-
NodeJS SpeechRecorder pipe to child process ffmpeg encoder - dest.on is not a function
10 décembre 2022, par Matthew SwaringenTrying to make a utility to help me with recording words for something. Unfortunately getting stuck on the basics.


The error I get when I hit s key and talk enough to fill the buffer is


terminate called after throwing an instance of 'Napi::Error'
 what(): dest.on is not a function
[1] 2298218 IOT instruction (core dumped) node record.js



Code is below. I can write the wav file and then encode that but I'd rather not have to have an intermediate file unless there is no way around it, and I can't imagine that is the case.


const { spawn } = require('child_process');
const { writeFileSync } = require('fs');
const readline = require('readline');
const { SpeechRecorder } = require('speech-recorder');
const { WaveFile } = require('wavefile');

let paused = true;

const ffmpeg = spawn('ffmpeg', [
 // '-f', 's16', // input format
 //'-sample_rate', '16000',
 '-i', '-', // input source
 '-c:a', 'libvorbis', // audio codec 
 'output.ogg', // output file 
 '-y'
]);

let buffer = [];
const recorder = new SpeechRecorder({
 onAudio: ({ audio, speech }) => {
 //if(speech) {

 for (let i = 0; i < audio.length; i++) {
 buffer.push(audio[i]);
 }

 if(buffer.length >= 16000 * 5) { 
 console.log('piping to ffmpeg for output');
 let wav = new WaveFile()
 wav.fromScratch(1,16000,"16",buffer);
 //writeFileSync('output.wav',wav.toBuffer());
 ffmpeg.stdin.pipe(buffer, {end: false});
 }
 //}
 }
});

// listen for keypress events
readline.emitKeypressEvents(process.stdin);
process.stdin.setRawMode(true);

process.stdin.on('keypress', (str, key) => {
 if (key.name === 's') {
 // pause or resume recording
 paused = !paused;
 if(paused) { recorder.stop(); } else { recorder.start(); }

 
 } else if (key.ctrl && key.name === 'c') {
 // exit program
 ffmpeg.kill('SIGINT'); 
 process.exit();
 }
});



-
ffmpeg C API - creating queue of frames
25 mai 2016, par lupodI have created using the C API of ffmpeg a C++ application that reads frames from a file and writes them to a new file. Everything works fine, as long as I write immediately the frames to the output. In other words, the following structure of the program outputs the correct result (I put only the pseudocode for now, if needed I can also post some real snippets but the classes that I have created for handling the ffmpeg functionalities are quite large) :
AVFrame* frame = av_frame_alloc();
int got_frame;
// readFrame returns 0 if file is ended, got frame = 1 if
// a complete frame has been extracted
while(readFrame(inputfile,frame, &got_frame)) {
if (got_frame) {
// I actually do some processing here
writeFrame(outputfile,frame);
}
}
av_frame_free(&frame);The next step has been to parallelize the application and, as a consequence, frames are not written immediately after they are read (I do not want to go into the details of the parallelization). In this case problems arise : there is some flickering in the output, as if some frames get repeated randomly. However, the number of frames and the duration of the output video remains correct.
What I am trying to do now is to separate completely the reading from writing in the serial implementation in order to understand what is going on. I am creating a queue of pointers to frames :
std::queue queue;
int ret = 1, got_frame;
while (ret) {
AVFrame* frame = av_frame_alloc();
ret = readFrame(inputfile,frame,&got_frame);
if (got_frame)
queue.push(frame);
}To write frames to the output file I do :
while (!queue.empty()) {
frame = queue.front();
queue.pop();
writeFrame(outputFile,frame);
av_frame_free(&frame);
}The result in this case is an output video with the correct duration and number of frames that is only a repetition of the last 3 (I think) frames of the video.
My guess is that something might go wrong because of the fact that in the first case I use always the same memory location for reading frames, while in the second case I allocate many different frames.
Any suggestions on what could be the problem ?
-
Discord bot cannot play youtube video for more than 60sec
18 octobre 2020, par Antoine WeberA few weeks back I started a discord bot as a side project for fun.
Since yesterday i've been trying to allow my bot to search youtube videos and play them in voice channels (mostly for songs).


The bot correctly searches youtube with the query and finds the youtube video, starts playing it, but for some reason, after 60 sec (no matter of the video, always the same time), the bot suddenly provides no more audio, and then gets stuck somewhere (not a single error message, but the bots just stops responding).


Here are the code snippets :


# first two words are activation keywords for the bot, then its the youtube query
query = ' '.join(message.message.content.split()[2:])
youtube = build("youtube", "v3", developerKey=yt_token)
search_response = youtube.search().list(q=query, part="id,snippet", maxResults=5).execute()
video_id = search_response['items'][0]['id']['videoId']
video_url = "https://www.youtube.com/watch?v=" + video_id

with youtube_dl.YoutubeDL(ydl_opts) as ydl:
 ydl.download([video_url])
await play_audio(message, 'song.mp3')



(I delete the song.mp3 after playing)


my ydl options are


ydl_opts = {
 "postprocessors":[{
 "key": "FFmpegExtractAudio", # download audio only
 "preferredcodec": "mp3", # other acceptable types "wav" etc.
 "preferredquality": "192" # 192kbps audio
 }],
 "format": "bestaudio/best",
 "outtmpl": "song.mp3"
}



and also my play_audio function is


async def play_audio(message, audio_name):
 channel = message.message.author.voice.channel
 vc = await channel.connect()
 time.sleep(0.5)
 vc.play(discord.FFmpegPCMAudio(audio_name))
 while vc.is_playing():
 time.sleep(1)
 vc.stop()
 await vc.disconnect()



I know the time.sleep() call is blocking but I don't really core for now.


Any one had this issue ? For short videos (less than 60sec), everything works fine. Maybe an ffmpeg option ?