
Recherche avancée
Médias (1)
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (111)
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
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 (...) -
Sélection de projets utilisant MediaSPIP
29 avril 2011, parLes exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
Ferme MediaSPIP @ Infini
L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)
Sur d’autres sites (4981)
-
Error with FFmpeg and FS in React : "ErrnoError : FS error"
23 juillet 2024, par namwanI'm working on a React application where I'm using the @ffmpeg/ffmpeg library to compress images and videos. I'm facing an issue with the virtual file system (FS) when trying to read and write files using FFmpeg. I'm getting the following error :


ErrnoError: FS error



Here's the relevant part of my code :


import React, { useState } from "react";
import { FFmpeg } from "@ffmpeg/ffmpeg";

const ffmpeg = new FFmpeg();

const fetchFile = async (filePath) => {
 const file = await ffmpeg.readFile(filePath);
 alert("hello");
 return new Uint8Array(file).buffer;
};


const Main = () => {
 const [file, setFile] = useState(null);
 const [compressedFile, setCompressedFile] = useState("");

 const loadFFmpeg = async () => {
 if (!ffmpeg.isLoaded) {
 await ffmpeg.load();
 }
 }; 

 const getFile = (event) => {
 const selectedFile = event.target.files[0];
 
 if (selectedFile) {
 setFile(selectedFile);
 }
 };

 const compressImage = (selectedFile) => {
 const img = new Image();
 img.src = URL.createObjectURL(selectedFile);
 img.onload = () => {
 const canvas = document.createElement('canvas');
 const MAX_WIDTH = 300;
 const MAX_HEIGHT = 300;
 let width = img.width;
 let height = img.height;

 if (width > height) {
 if (width > MAX_WIDTH) {
 height *= MAX_WIDTH / width;
 width = MAX_WIDTH;
 }
 } else {
 if (height > MAX_HEIGHT) {
 width *= MAX_HEIGHT / height;
 height = MAX_HEIGHT;
 }
 }

 canvas.width = width;
 canvas.height = height;
 const ctx = canvas.getContext('2d');
 ctx.drawImage(img, 0, 0, width, height);
 const dataUrl = canvas.toDataURL('image/jpeg', 1.0);
 setCompressedFile(dataUrl);
 };
 };

 const compressVideo = async (selectedFile) => {
 try {
 await loadFFmpeg();
 
 const arrayBuffer = await selectedFile.arrayBuffer();
 const fileName = selectedFile.name;
 
 await ffmpeg.writeFile(fileName, new Uint8Array(arrayBuffer));
 
 await ffmpeg.exec(
 '-i',
 fileName,
 '-vf',
 'scale=640:-1',
 '-c:a',
 'aac',
 '-strict',
 '-2',
 'output.mp4'
 );
 
 const data = await fetchFile('output.mp4');
 const compressedVideoBlob = new Blob([data], { type: 'video/mp4' });
 const compressedVideoUrl = URL.createObjectURL(compressedVideoBlob);
 setCompressedFile(compressedVideoUrl);
 
 await ffmpeg.unlink(fileName);
 await ffmpeg.unlink('output.mp4');
 
 alert('Compression successful');
 } catch (error) {
 console.error('Error:', error);
 alert('Compression failed. Please check the console for more details.');
 }
 };
 

 const handleSubmit = async (e) => {
 e.preventDefault();

 if (file) {
 const fileType = file.name.split('.').pop().toLowerCase();

 if (fileType === 'png' || fileType === 'jpg' || fileType === 'jpeg') {
 compressImage(file);
 } else if (fileType === 'mp4' || fileType === 'h264') {
 compressVideo(file);
 } else {
 alert('Please select a valid file type (png, jpg, jpeg for images or mp4, h264 for videos).');
 }
 }
 };

 const handleDownload = () => {
 if (file) {
 const downloadLink = document.createElement('a');
 downloadLink.href = compressedFile;

 const fileExtension = file.name.split('.').pop().toLowerCase();

 downloadLink.download = `compressed_file.${fileExtension}`;
 
 document.body.appendChild(downloadLink);
 downloadLink.click();
 document.body.removeChild(downloadLink);
 }
 };

 return (
 <>
 <h1>Main Page</h1>
 <form>
 <label>Upload</label>
 <input type="'file'" />
 <br /><br />
 <input type="submit" value="Compress" />
 </form>
 {compressedFile && (
 <>
 <h2>Compressed File Preview</h2>
 {file && file.name && ( 
 file.name.split('.').pop().toLowerCase() === 'mp4' || file.name.split('.').pop().toLowerCase() === 'h264' ? (
 <video width="300" controls="controls">
 <source src="{compressedFile}" type="video/mp4"></source>
 Your browser does not support the video tag.
 </video>
 ) : (
 <img src="http://stackoverflow.com/feeds/tag/{compressedFile}" alt="Compressed file preview" style='max-width: 300px; max-height: 300px' />
 )
 )}
 <br /><br />
 <button>Download Compressed File</button>
 >
 )}
 >
 );
};

export default Main;



I'm using ffmpeg.readFile and ffmpeg.writeFile to read and write files to FFmpeg's virtual file system. I've also tried using ffmpeg.read and ffmpeg.write but still encounter the same issue.


Could someone please help me understand what might be causing this FS error and how to resolve it ?


-
FFmpeg4 android Applying Overlay (watermark) taking too long
13 janvier 2019, par Web DeveloperI’m using ffmpeg4 on android (Java) to apply overlay/watermark on the bottom left corner of the recorded video that is saved in the SD CARD.
The video recording has maximum duration of 59 seconds. The problem that I’m facing is that I’m applying water through this command of ffmpeg4
String[] complexCommand1 = new String[]"ffmpeg", "-y", "-i",
"input.mp4", "-strict", "experimental", "-c:v", "libx264", "-preset",
"ultrafast", "-vf", "movie=/water.png [watermark] ; [in][watermark] overlay=main_w-overlay_w-", "10:10", " [out]", "-s", "320x480", "-aspect",
"2:3", "-r", "30", "-b:v", "500k",
"output.mp4" ;I’ve reduced the video resolution to 320x480 after the conversion and 480p to recorded video that is provided as input to this command but still the processing time is around 40 seconds.
Can someone provide me workaround this to reduce this processing time.
or what should I do to reduce this processing time. I’ve researched a lot on this and found some GitHub issues link and tried their solutions but none of them seemed to work for me.
-
GStreamer H264 stream to HTML5 webpage
28 septembre 2020, par LostInTheEchoI have a Linux board with a camera connected to it that is recording whatever goes on to a mp4 file(s) on the SD card of the board. I'm using gstreamer which connects to the /dev/video1 source and uses H264 encoding. I run it with a command similar to this one :


gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-h264,width=640,height=480,framerate=30/1 ! h264parse ! rtph264pay ! udpsink host={host} port={port}



The upper part works fine and records everything locally, but I'd also like to stream this video to a HTML5 webpage, which is meant to change camera options and have a live preview.


I tried using HTTP via tcpsink and HLS via hlssink, but both resulted in a 8-10 second delay, which is basically unusable. The only thing that has no delay is the UDP sink. As far as I know the only way to catch the UDP stream is by having a tool like FFMPEG in the middle, that can convert the UDP stream to MJPEG for instance and serve it to the webpage.


That would probably work, but the board doesn't have a very good CPU and is already at 50% utilization. Converting stream via FFMPEG would probably push it to 100%.


Is there any other way to stream to a webpage without delay ?