
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 (51)
-
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 -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...) -
De l’upload à la vidéo finale [version standalone]
31 janvier 2010, parLe chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
Upload et récupération d’informations de la vidéo source
Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)
Sur d’autres sites (8336)
-
Sinon stub within ffmpeg error event listener
22 juin 2022, par Pedro Eliasconst {writeStream, upload} = S3Service.uploadStream({ Bucket: process.env.BUCKET, Key: s3Path});

 ffmpeg(stream)
 .outputOptions('-copyts')
 .audioCodec("libopus")
 .toFormat("matroska")
 .on('error', (err, stdout, stderr) => {
 if (err) {
 console.log(err.message);
 upload.abort();
 return reject("Error FFMPEG");
 }
 })
 .on('start', (p) => console.log(p))
 .on(`end`, () => console.log("end ffmpeg"))
 .pipe(writeStream);

 upload.promise()
 .then(() => resolve("Successful audio converted transfer"))
 .catch((err) => console.error(err));



I have the code above and I'm writing a unit test for it as follow :


let uploadStreamStub = {
 writeStream: sandbox.stub().returnsThis(),
 upload: {
 promise: sandbox.stub(),
 abort: sandbox.stub()
 }
}

sandbox.stub(s3Service, "uploadStream").returns(uploadStreamStub);



I'd like to stub upload.abort() :


let onStub = sandbox.stub(ffmpeg.prototype, "on").returnsThis();
onStub.withArgs("error").yieldsAsync(new Error("test"));
sandbox.assert.calledOnce(uploadStreamStub.upload.abort);



However, the stub is not working :
AssertError : expected stub to be called once but was called 0 times


When I remove the "yieldsAsync" line and try to stub the promise it works :


// onStub.withArgs("error").yieldsAsync(new Error("test"));
sandbox.assert.calledOnce(uploadStreamStub.upload.promise);



So the stub only doesn't work on('error'...


What I'm doing wrong ?


How can I stub and check if abort has been called ?


-
ffmpeg : create a video of 10 seconds before and 10 seconds after the occurrence of a certain event [closed]
28 août 2023, par pozzugnoFrom a video stream (RTSP) transmitted from an IPCam, I'd like to generate a short video starting from 10 seconds before an event and total duration 20 seconds, so the event is in the middle of the video.


The event is an alarm triggered by an external device. I'd like to see what happened immediately before and after this alarm.


Because I need the video before the event (and I don't know when the event will occur), I am forced to receive the stream continuously. The idea is to use segment mux, so I'm testing the following command :


ffmpeg -hide_banner -rtsp_transport tcp -stimeout 10000000 -i rtsp://... -f segment -segment_time 2 -reset_timestamps 1 -segment_wrap 12 -ccopy -map 0:v /var/ramdisk/C1/%d.mp4



In the output folder I will have 12 files : 0.mp4, 1.mp4,... 11.mp4. Each file is a video of duration 2 seconds.


When my Linux service (always running) detects the alarm from the external device, it waits for 10 seconds and launch a new ffmpeg command that concatenate the short video files in one bigger video file. However I'm in trouble with the right command line to do what I need.


-
FFmpeg doesn't produce a 'progress' event when converting to videos of certain file types
10 décembre 2023, par AlteriaI am writing an app in electron, and one of the functionalities is that you can create a copy of the currently selected file with a different type. I do this by having a dropdown in the html that allows you to select the type. I then use a function in preload.js that calls an ffmpeg function in main.js


Preload :


const { contextBridge, ipcRenderer } = require('electron')

contextBridge.exposeInMainWorld('changeFiles', {
 //This is the function that is called
 convert: (filePath, newFormat) => ipcRenderer.send('change:file:convert-format', filePath, newFormat)
})



Main :


//electron
const { app, BrowserWindow, ipcMain} = require('electron')

//node
const path = require('path')


//ffmpeg setup
const ffmpegStatic = require('ffmpeg-static')
const ffmpeg = require('fluent-ffmpeg')
ffmpeg.setFfmpegPath(ffmpegStatic)

//imports an array that has video formats ['.mp4', '.webm', '.avi'] and so on
const { videoFormat } = require('./file formats.js')

//Preload sends to this
ipcMain.on('change:file:convert-format', (_event, filePath, newFormat) => {
 //There is an if statement to another function because I want to be able to convert images in the future
 if(videoFormats.includes(newFormat)) {
 videoConvert(filePath, newFormat, _event)
 return
 }
})

const videoConvert = (file, newFormat, _event) => {
 //file is the filepath for the file you want to change

 ffmpeg()
 .input(file)
 .saveToFile(`${path.resolve(path.dirname(file), path.parse(file).name + newFormat)}`)
 .on('progress', (progress) => {
 console.log(progress)
 })
 .on('error', (error) => {
 console.log(error)
 })
}




For some reason, when the format for the video is '.mp4', the .on('progress') fires, but if the format is '.webm' or '.avi' then it is not fired. There are also some issues I have noticed, where if these formats are chosen, then the files may partially be copied over to the new file.


I don't know if this is because of how I am handling this, a mistake I have made in the .saveToFile(), or something else. No part of this code produces any errors anywhere, the only errors being that the progress doesn't fire and that the files are not always copied over correctly into the new format.


What should I do ?