
Recherche avancée
Médias (39)
-
Stereo master soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
ED-ME-5 1-DVD
11 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
1,000,000
27 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Demon Seed
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Four of Us are Dying
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Corona Radiata
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (78)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
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 (...) -
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)
Sur d’autres sites (8907)
-
I have use the ffmpeg in my react konva project but it not import correclty ?
5 septembre 2024, par Humayoun SaeedI use ffmpeg in my react konva project to record video and download it, but when i import it give me error, when i give to to gpt or google it giveme another way of export when i do this one it same give me error of import from ffpmg


Error :


ERROR in ./src/components/Preview.jsx 29:25-37
export 'createFFmpeg' (imported as 'createFFmpeg') was not found in '@ffmpeg/ffmpeg' (possible exports : FFmpeg)
ERROR in ./src/components/Preview.jsx 123:34-43
export 'fetchFile' (imported as 'fetchFile') was not found in '@ffmpeg/ffmpeg' (possible exports : FFmpeg)


Preview.jsx :


import React, { useEffect, useState, useRef } from "react";
// import { createFFmpeg } from "@ffmpeg/ffmpeg";
// import { createFFmpeg, fetchFile } from "@ffmpeg/ffmpeg/dist/ffmpeg.min.js";
// import { FFmpeg } from "@ffmpeg/ffmpeg";
// import { fetchFile } from "@ffmpeg/util";
import { createFFmpeg, fetchFile } from "@ffmpeg/ffmpeg";



const Preview = ({ layout, onClose }) => {
 const [currentContent, setCurrentContent] = useState([]);
 const [progress, setProgress] = useState(0);
 const totalDuration = useRef(0);
 const elapsedDuration = useRef(0); // Track total elapsed duration
 const progressInterval = useRef(null);
 const ffmpeg = useRef(null); // Use useRef to store ffmpeg instance
 const [ffmpegReady, setFfmpegReady] = useState(false);

 // Initialize FFmpeg instance
 useEffect(() => {
 const loadFFmpeg = async () => {
 if (!ffmpeg.current) {
 ffmpeg.current = createFFmpeg({ log: true });
 await ffmpeg.current.load();
 setFfmpegReady(true);
 }
 };
 loadFFmpeg();
 }, []);




const handleDownload = async () => {
 try {
 if (!ffmpegReady) {
 alert("FFmpeg is still loading, please wait...");
 return;
 }

 // Fetch all media files from the layout
 const inputFiles = [];

 // Process each division of the layout
 for (const division of layout.divisions) {
 for (let i = 0; i < division.imageSrcs.length; i++) {
 const src = division.imageSrcs[i];

 // Fetch and store media data
 const mediaData = await fetchFile(src);
 const fileName = `input${inputFiles.length + 1}${
 src.endsWith(".mp4") ? ".mp4" : ".png"
 }`;

 // Write file to ffmpeg virtual filesystem
 ffmpeg.current.FS("writeFile", fileName, mediaData);
 inputFiles.push(fileName);
 }
 }

 // Create a list of inputs for ffmpeg
 let concatList = "";
 inputFiles.forEach((fileName) => {
 concatList += `file '${fileName}'\n`;
 });

 // Write the concat list file to FFmpeg FS
 ffmpeg.current.FS(
 "writeFile",
 "concatList.txt",
 new TextEncoder().encode(concatList)
 );

 // Run the ffmpeg command to concatenate all files into one video
 await ffmpeg.current.run(
 "-f",
 "concat",
 "-safe",
 "0",
 "-i",
 "concatList.txt",
 "-c",
 "copy",
 "output.mp4"
 );

 // Read the result video
 const data = ffmpeg.current.FS("readFile", "output.mp4");

 // Create a Blob from the data and download it
 const videoBlob = new Blob([data.buffer], { type: "video/mp4" });
 const url = URL.createObjectURL(videoBlob);
 const link = document.createElement("a");
 link.href = url;
 link.download = `${layout.name || "layout_video"}.mp4`;
 document.body.appendChild(link);
 link.click();
 document.body.removeChild(link);

 alert("Video download completed.");
 } catch (error) {
 console.error("Error during video creation:", error);
 }
 };


 



return (
 
 
 
 Close
 
 
 {/* Download button */}
 > (e.target.style.backgroundColor = "#218838")}
 onMouseOut={(e) => (e.target.style.backgroundColor = "#28a745")}
 >
 Download Video
 
 
 
 );
};

export default Preview;




Ignore all other main issue in just ffmpeg , import, declaration and in it usage in download function, if anyone solution or ability to resolve it, then check it.


I try to use ffmpeg in my project for video downloading but it not importing and not use , i want to download video i made using ffmpeg.


-
Is there risk of shell/command injection when using FFmpeg or when there's no user input ?
10 mai 2021, par TrisI am new when it comes to thinking about the security of my web applications. I have done research on shell injections and most of the time they say to just avoid using shell/command calls in the web applications. However, my alternative seems to limit which browsers clients can use. So I would prefer executing a shell command in my nodejs server. I am using FFmpeg and calling it through system command in nodejs child processes.


I have a FFmpeg bash script like so :


VIDSOURCE="rtsp:cameraurl"
AUDIO_OPTS="-c:a aac -b:a 160000 -ac 2"
VIDEO_OPTS="-s 854x480 -c:v libx264 -b:v 800000"
OUTPUT_HLS="-hls_time 10 -hls_list_size 10 -start_number 1 -hls_wrap 10"
ffmpeg -i "$VIDSOURCE" -y $AUDIO_OPTS $VIDEO_OPTS $OUTPUT_HLS mystream.m3u8



I am wondering if I should worry about shell injection risk and if I should try another approach. I don't think there is any user input in this besides my own hard coded inputs. Therefore, I think it should be safe to use this script in a web browser... I just want to be safe and be sure. Thank you !


-
Write and read from memory using : avio_alloc_context
26 juillet 2020, par Pol.HMy overall goal is to capture the desktop screen and encapsulate in a webm container with encoding such as VP8 or VP9. I can save it as a file, but my intention is to stream the video to a webbrowser and using mediasource extension to view the content.


Now am stuck att writing/reading the data of memory using avio_alloc_context .


avio_alloc_context(ioBuffer, IOBUFSIZE, 1, nullptr, readFromBuffer, writeToBuffer, nullptr) ;


Does anyone have code snippets for both read and write functions ?


From this question i found the write function :


std::vector outputData;

int mediaMuxCallback(void *opaque, uint8_t *buf, int bufSize)
{
 outputData.insert(outputData.end(), buf, buf + bufSize);
 return bufSize;
}



- 

- How should the read function be implemented any idea ?
- Is a vector the best alternative or how about an IStream which one is easier ?