Recherche avancée

Médias (91)

Autres articles (43)

  • Déploiements possibles

    31 janvier 2010, par

    Deux types de déploiements sont envisageable dépendant de deux aspects : La méthode d’installation envisagée (en standalone ou en ferme) ; Le nombre d’encodages journaliers et la fréquentation envisagés ;
    L’encodage de vidéos est un processus lourd consommant énormément de ressources système (CPU et RAM), il est nécessaire de prendre tout cela en considération. Ce système n’est donc possible que sur un ou plusieurs serveurs dédiés.
    Version mono serveur
    La version mono serveur consiste à n’utiliser qu’une (...)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

Sur d’autres sites (6521)

  • Is there a way to improve video fetching speed when using FFmpeg for trimming ?

    14 janvier 2024, par Otis

    I have a React component that uses the @ffmpeg/ffmpeg library to trim videos. The trimming process involves fetching a video file from a URL and then using FFmpeg to perform the actual trim. I've noticed that when I execute the trimVideo function on a new URL for the first time, it takes a considerable amount of time to fetch the file. However, on subsequent executions with the same URL, it executes in less than 5 seconds.

    


    import { useEffect, useRef, useState } from &#x27;react&#x27;;&#xA;import { FFmpeg } from &#x27;@ffmpeg/ffmpeg&#x27;;&#xA;import { fetchFile, toBlobURL } from &#x27;@ffmpeg/util&#x27;;&#xA;&#xA;&#xA;export default function TrimVideo() {&#xA;    const [loaded, setLoaded] = useState(false);&#xA;    const [isLoading, setIsLoading] = useState(false);&#xA;    const [trimmedBlobUrl, setTrimmedBlobUrl] = useState(&#x27;&#x27;);&#xA;    const [progress, setProgress] = useState<any>(0);&#xA;    const ffmpegRef = useRef<any>(new FFmpeg());&#xA;    const videoRef = useRef<any>(null);&#xA;    const messageRef = useRef<any>(null);&#xA;&#xA;    const [exporting, setExporting] = useState(false);&#xA;&#xA;    const onlineVideoUrl =&#xA;        &#x27;http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4&#x27;;&#xA;&#xA;    const loadFFmpeg = async () => {&#xA;        setIsLoading(true);&#xA;&#xA;        const baseURL = &#x27;https://unpkg.com/@ffmpeg/core@0.12.2/dist/umd&#x27;;&#xA;        const ffmpeg = ffmpegRef.current;&#xA;&#xA;        ffmpeg.on(&#x27;log&#x27;, ({ message }: any) => {&#xA;            if (messageRef.current) messageRef.current.innerHTML = message;&#xA;        });&#xA;&#xA;        // Load FFmpeg core and wasm files&#xA;        await ffmpeg.load({&#xA;            coreURL: await toBlobURL(&#xA;                `${baseURL}/ffmpeg-core.js`,&#xA;                &#x27;text/javascript&#x27;,&#xA;            ),&#xA;            wasmURL: await toBlobURL(&#xA;                `${baseURL}/ffmpeg-core.wasm`,&#xA;                &#x27;application/wasm&#x27;,&#xA;            ),&#xA;        });&#xA;&#xA;        setLoaded(true);&#xA;        setIsLoading(false);&#xA;    };&#xA;&#xA;    useEffect(() => {&#xA;        loadFFmpeg();&#xA;    }, []);&#xA;&#xA;    const trimVideo = async () => {&#xA;        const ffmpeg = ffmpegRef.current;&#xA;        setExporting(true);&#xA;        setProgress(0);&#xA;&#xA;        const trimStart = 1;&#xA;        const trimEnd = 40;&#xA;        const trimmedVideo = trimEnd - trimStart;&#xA;&#xA;&#xA;        try {&#xA;            console.log(&#x27;Fetching Video...&#x27;);&#xA;            await ffmpeg.writeFile(&#xA;                &#x27;myFile.mp4&#x27;,&#xA;                await fetchFile(onlineVideoUrl),&#xA;            );&#xA;            console.log(&#x27;Executing FFMPEG...&#x27;);&#xA;            await ffmpeg.exec([&#xA;                &#x27;-ss&#x27;,&#xA;                `${trimStart}`,&#xA;                &#x27;-accurate_seek&#x27;,&#xA;                &#x27;-i&#x27;,&#xA;                &#x27;myFile.mp4&#x27;,&#xA;                &#x27;-to&#x27;,&#xA;                `${trimmedVideo}`,&#xA;                &#x27;-codec&#x27;,&#xA;                &#x27;copy&#x27;,&#xA;                &#x27;output.mp4&#x27;,&#xA;            ]);&#xA;&#xA;            const data: any = await ffmpeg?.readFile(&#x27;output.mp4&#x27;);&#xA;            const url = URL.createObjectURL(&#xA;                new Blob([data.buffer], { type: &#x27;video/mp4&#x27; }),&#xA;            );&#xA;            setTrimmedBlobUrl(url);&#xA;        } catch (error) {&#xA;            console.log(error);&#xA;        } finally {&#xA;            setProgress(0);&#xA;            setExporting(false);&#xA;        }&#xA;    };&#xA;&#xA;&#xA;    return loaded ? (&#xA;      <div>&#xA;        {trimmedBlobUrl &amp;&amp; (&#xA;          <video ref="{videoRef}" controls="controls" src="{trimmedBlobUrl}"></video>&#xA;        )}&#xA;        <br />&#xA;&#xA;        <button>> trimVideo()}>Trim Video</button>&#xA;        <h3>Progress: {progress}</h3>&#xA;        <p ref="{messageRef}"></p>&#xA;      </div>&#xA;    ) : (&#xA;      <p>Loading FFmpeg...</p>&#xA;    );&#xA;}&#xA;</any></any></any></any>

    &#xA;

    Is there a way to improve the fetching of the video to be consistently fast across all executions ?

    &#xA;

  • ffmpeg.exe not found inside project directory

    8 février 2019, par BayLife

    I´m currently working on my first electron / react app, which makes use of ffmpeg. I do have a problem to link the .exe file correctly.

    The prolem I´m facing is that I ffmpeg.exe is not found when trying to link it with a relative path inside my project directory. When using an absolute path it does work.

    The exe files are in the sub-folder of the current directroy.

    It does work when I´m using such path :

    'C:\\Users\\xxx\\Documents\\development\\ytDownloader\\app\\utils\\ffmpeg\\ffprobe.exe'

    But when trying it like this
    .setFfmpegPath('.\\ffmpeg\\ffmpeg.exe')

    or

    './ffmpeg/ffmpeg.exe'

    it does not working.

    Additionally I would really like to avoid using \\ in my project.

    Does someone have an Idea what I´m doing wrong here ?

    I get this error message :

    Error: spawn .\ffmpeg\ffmpeg.exe ENOENT
       at Process.ChildProcess._handle.onexit (internal/child_process.js:229)
       at onErrorNT (internal/child_process.js:406)
       at process._tickCallback (internal/process/next_tick.js:63)
  • Fluent-FFMPEG redirects to home page when recording is finished

    25 mai 2022, par Myles Jefferson

    I am using fluent-FFmpeg with my node.js and express server to record videos from an RTSP stream. The issue I am encountering is that once the command to record the video is finished, my React client-side always redirects to the home page of my application, even though this is not the behavior I want. I want the user to remain on the page with the RTSP stream and just receive a toast notification indicating that the recording is finished. With this issue, the page redirects before the notification has a chance to display. Is this an issue with my server-side or client-side code ?

    &#xA;

    Node.js

    &#xA;

    export const startRecording = async (req, res) => {&#xA;  const camera = req.params;&#xA;  if (camera.id in runningCommands) { return res.json({ "status": "failure", "error": "Recording already in progress" }) }&#xA;  const { recordTime, uid } = req.body;&#xA;  let conn = createConnection(config);&#xA;  conn.connect();&#xA;  let query = &#x27;SELECT * FROM cameras WHERE id = ?&#x27;;&#xA;  conn.query(query, [camera.id], (error, rows) => {&#xA;    if (error) { return res.json({ "status": "failure", "error": error }) }&#xA;    const camera = rows[0];&#xA;    const { ip, fname } = camera;&#xA;    const currentDate = new Date().toLocaleString().replace(/[:/\s]/g, &#x27;-&#x27;).replace(&#x27;,&#x27;, &#x27;&#x27;);&#xA;    const filename = `${fname}-${currentDate}`;&#xA;&#xA;    try {&#xA;      // FFmpeg command to start recording&#xA;      const command = ffmpeg(`rtsp://${ip}/axis-media/media.amp`)&#xA;        .videoCodec(&#x27;libx264&#x27;)&#xA;        .size(&#x27;1280x720&#x27;)&#xA;        .duration(recordTime)&#xA;        .on(&#x27;start&#x27;, commandLine => {&#xA;          runningCommands[camera.id] = command&#xA;          console.log(`Spawned Ffmpeg with command: ${commandLine}`)&#xA;        })&#xA;        .on(&#x27;error&#x27;, err => console.error(err))&#xA;        .on(&#x27;end&#x27;, () => {&#xA;          delete runningCommands[camera.id]&#xA;          console.log(&#x27;Recording Complete&#x27;)&#xA;          takeScreenshot(filename, `./public/recordings/mp4/${filename}.mp4`)&#xA;          conn.query(&#x27;INSERT INTO recordings (uid, cid, filename) VALUES (?, ?, ?)&#x27;, [uid, camera.id, filename], () => conn.end())&#xA;          res.json({ "status": "success", "message": "Recording ended" })&#xA;        })&#xA;        .save(`./public/recordings/mp4/${filename}.mp4`);&#xA;    } catch (error) { console.error(error)}&#xA;  })&#xA;}&#xA;

    &#xA;

    React :

    &#xA;

    const handleRecording = async () => {&#xA;    try {&#xA;      setIsRecording(true)&#xA;      const futureTime = new Date().getTime() &#x2B; recordTime * 1000&#xA;      const finishedTime = new Date(futureTime).toLocaleTimeString()&#xA;      setTimeRemaining(finishedTime)&#xA;      const { data } = await publicRequest.post(`record/startRecording/${id}`, { recordTime, uid: user.id })&#xA;      window.location.reload(false)&#xA;      if (data.status === &#x27;success&#x27;) {&#xA;        setIsRecording(false)&#xA;        toast(&#x27;Recording finished!&#x27;, { type: &#x27;success&#x27; })&#xA;      } else {&#xA;        setIsRecording(true)&#xA;        toast(&#x27;Recording already in progress!&#x27;, { type: &#x27;error&#x27; })&#xA;      }&#xA;    } catch (error) {&#xA;      console.error(error)&#xA;    }&#xA;  }&#xA;

    &#xA;