
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (32)
-
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...) -
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)
Sur d’autres sites (5020)
-
FFMPEG : Cannot read properties of undefined (reading 'format')
1er avril 2023, par DonnybI am currently to convert a video file to produce a thumbnail through ffmpeg, react-dropzone, and express. However I keep getting a error of "Cannot read properties of undefined (reading 'format')" in my console. For some reason it can not read the "metadata.format.duration" in my program, I have checked if ffmpeg is properly installed by running the ffmpeg —version in my console, and I get all the details, along with ffprobe —version as well.


Here is my code :
upload.js


router.post("/thumbnail", (req, res) => {
 let thumbsFilePath ="";
 let fileDuration ="";

 // req.body.filepath
 ffmpeg.ffprobe(req.body.filepath, function(err, metadata){
 console.dir(metadata);
 console.log(metadata.format.duration);

 fileDuration = metadata.format.duration;
 })

 ffmpeg(req.body.filepath) //req.body.filepath
 .on('filenames', function (filenames) {
 console.log('Will generate ' + filenames.join(', '))
 console.log(filenames);
 thumbsFilePath = "./uploads/thumbnails/" + filenames[0];
 
 })
 .on('end', function () {
 console.log('Screenshots taken');
 return res.json({ success: true, thumbsFilePath: thumbsFilePath, fileDuration: fileDuration})
 })
 .screenshots({
 // Will take screens at 20%, 40%, 60% and 80% of the video
 count: 3,
 folder: './uploads/thumbnails',
 size:'320x240',
 // %b input basename ( filename w/o extension )
 filename:'thumbnail-%b.png'
 });
})



FrontEnd drop code :
AddVideo.js


const onDrop = (files) => {

 let formData = new FormData();
 const config = {
 header: { 'content-type': 'multipart/form-data' }
 }
 console.log(files)
 formData.append("file", files[0])

 axios.post('http://localhost:5000/api/upload/uploadfiles', formData, config)
 .then(response => {
 if (response.data.success) {

 let variable = {
 filePath: response.data.filePath,
 fileName: response.data.fileName
 }
 setFilePath(response.data.filePath)

 //gerenate thumbnail with this filepath ! 

 axios.post('http://localhost:5000/api/upload/thumbnail', variable)
 .then(response => {
 if (response.data.success) {
 setDuration(response.data.fileDuration)
 setThumbnail(response.data.thumbsFilePath)
 } else {
 alert('Failed to make the thumbnails');
 }
 })


 } else {
 alert('failed to save the video in server')
 }
 })

 }

 return (
 <div style="{{">
 <div style="{{">
 {/* */}
 </div>

 <formcontrol>
 <div style="{{">
 
 {({ getRootProps, getInputProps }) => (
 <div style="{{" solid="solid">
 <input />
 <icon type="plus" style="{{"></icon>

 </div>
 )}
 
 </div>
 </formcontrol>
 </div>
 )
}



The video I am trying to upload is a mp4 file. I am using fluent-ffmpeg as a dependency.


-
Saving Video From URL as MP3 in Firebase Storage
4 janvier 2024, par Christopher FrydryckI am working on a problem I have been stumped on the past couple days. I am using Node.js with Express (v4.18.2) to eventually create a Firebase deployment that can take in a video URL and output an audio mp3 to the Firebase Firestore. I have made some progress, but am still unsuccessful in some areas.


I cannot save the file locally using fs, but for this example I have shown that it works with FS. I am successfully saving a local .mp3 file.


First a few functions I have :


async function downloadVideo(videoUrl) {
 try {
 const response = await axios.get(videoUrl, {
 responseType: 'stream',
 });
 
 if (response.status === 200) {
 return response.data;
 } else {
 throw new Error('Failed to fetch the video');
 }
 } catch (error) {
 throw new Error('Error fetching the video: ' + error.message);
 }
 }



async function extractAudioFromVideo(videoUrl) {
 try {
 const videoStream = await downloadVideo(videoUrl);
 
 // Create a PassThrough stream to pipe the video data
 const passThrough = new PassThrough();
 videoStream.pipe(passThrough);

 const outputFile = 'output.mp3';
 const outputStream = fs.createWriteStream(outputFile);
 
 return new Promise((resolve, reject) => {
 const audioBuffers = [];

 passThrough.on('data', chunk => {
 audioBuffers.push(chunk)
 outputStream.write(chunk); // Write chunks to a local file
 });
 
 passThrough.on('error', err => {
 reject(err);
 });
 

 ffmpeg()
 .input(passThrough)
 .output('/dev/null') // Null output as a placeholder
 .outputOptions('-vn') // Extract audio only
 .noVideo()
 .audioQuality(0)
 .audioCodec('libmp3lame') // Set audio codec
 .format('mp3')
 .on('end', () => {
 const audioBuffer = Buffer.concat(audioBuffers)
 if (audioBuffer.length > 0) {
 resolve(audioBuffer);
 } else {
 reject(new Error('Empty audio buffer'));
 }
 })
 .on('error', err => reject(err))
 .run();
 })
 } catch (error) {
 throw new Error('Error extracting audio: ' + error.message);
 }
 }



async function saveAudioToFirebase(audioBuffer, fileName) {
 try {
 let storage = admin.storage()
 let storageRef = storage.bucket(serviceAccount.storage_bucket_content)
 const file = storageRef.file(fileName) // Specify the desired file name here

 const renamedFileName = fileName.replace(/\.[^/.]+$/, '.mp3'); // Change the file extension to .mp3
 
 await file.save(audioBuffer, {
 metadata: {
 contentType: 'audio/mpeg', // Adjust the content type as needed
 },
 });

 await file.setMetadata({
 contentType: 'audio/mpeg'
 })

 await file.move(renamedFileName); // Rename the file with the .mp3 extension
 
 console.log('Audio saved to Firebase Storage.');
 } catch (error) {
 console.error('Error saving audio to Firebase Storage:', error);
 }
 }




What works :


- 

- Downloading the video via Axios
- Saving to Firebase storage (no intializing or pointer issues to Firebase)
- Outputting a local .mp3 file called "output.mp3"
- I am able to log the result of
extractAudioFromVideo
and get a buffer logged in my terminal










What doesn't work :


- 

- Saving a file to Firebase Storage that is an .mp3. It says ".mp3" in the url and it has a content type of 'audio/mpeg' but it is in fact an .mp4. Still has video and plays video in the browser window.




I am willing to use other libraries like tmp if suggested and the solution works.


-
Revision 37406 : Le cron toute les minutes Amélioration de pleins de petites choses ...
18 avril 2010, par kent1@… — LogLe cron toute les minutes
Amélioration de pleins de petites choses
Incrément mineur de la version