Recherche avancée

Médias (91)

Autres articles (99)

  • Soumettre bugs et patchs

    10 avril 2011

    Un logiciel n’est malheureusement jamais parfait...
    Si vous pensez avoir mis la main sur un bug, reportez le dans notre système de tickets en prenant bien soin de nous remonter certaines informations pertinentes : le type de navigateur et sa version exacte avec lequel vous avez l’anomalie ; une explication la plus précise possible du problème rencontré ; si possibles les étapes pour reproduire le problème ; un lien vers le site / la page en question ;
    Si vous pensez avoir résolu vous même le bug (...)

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

Sur d’autres sites (13828)

  • imgconvert : print color type too

    21 novembre 2012, par Michael Niedermayer

    imgconvert : print color type too

  • Error with FFmpeg and FS in React : "ErrnoError : FS error"

    23 juillet 2024, par namwan

    I'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";&#xA;import { FFmpeg } from "@ffmpeg/ffmpeg";&#xA;&#xA;const ffmpeg = new FFmpeg();&#xA;&#xA;const fetchFile = async (filePath) => {&#xA;    const file = await ffmpeg.readFile(filePath);&#xA;    alert("hello");&#xA;    return new Uint8Array(file).buffer;&#xA;};&#xA;&#xA;&#xA;const Main = () => {&#xA;    const [file, setFile] = useState(null);&#xA;    const [compressedFile, setCompressedFile] = useState("");&#xA;&#xA;    const loadFFmpeg = async () => {&#xA;        if (!ffmpeg.isLoaded) {&#xA;          await ffmpeg.load();&#xA;        }&#xA;      };      &#xA;&#xA;    const getFile = (event) => {&#xA;        const selectedFile = event.target.files[0];&#xA;        &#xA;        if (selectedFile) {&#xA;            setFile(selectedFile);&#xA;        }&#xA;    };&#xA;&#xA;    const compressImage = (selectedFile) => {&#xA;        const img = new Image();&#xA;        img.src = URL.createObjectURL(selectedFile);&#xA;        img.onload = () => {&#xA;            const canvas = document.createElement(&#x27;canvas&#x27;);&#xA;            const MAX_WIDTH = 300;&#xA;            const MAX_HEIGHT = 300;&#xA;            let width = img.width;&#xA;            let height = img.height;&#xA;&#xA;            if (width > height) {&#xA;                if (width > MAX_WIDTH) {&#xA;                    height *= MAX_WIDTH / width;&#xA;                    width = MAX_WIDTH;&#xA;                }&#xA;            } else {&#xA;                if (height > MAX_HEIGHT) {&#xA;                    width *= MAX_HEIGHT / height;&#xA;                    height = MAX_HEIGHT;&#xA;                }&#xA;            }&#xA;&#xA;            canvas.width = width;&#xA;            canvas.height = height;&#xA;            const ctx = canvas.getContext(&#x27;2d&#x27;);&#xA;            ctx.drawImage(img, 0, 0, width, height);&#xA;            const dataUrl = canvas.toDataURL(&#x27;image/jpeg&#x27;, 1.0);&#xA;            setCompressedFile(dataUrl);&#xA;        };&#xA;    };&#xA;&#xA;    const compressVideo = async (selectedFile) => {&#xA;        try {&#xA;            await loadFFmpeg();&#xA;    &#xA;            const arrayBuffer = await selectedFile.arrayBuffer();&#xA;            const fileName = selectedFile.name;&#xA;    &#xA;            await ffmpeg.writeFile(fileName, new Uint8Array(arrayBuffer));&#xA;    &#xA;            await ffmpeg.exec(&#xA;                &#x27;-i&#x27;,&#xA;                fileName,&#xA;                &#x27;-vf&#x27;,&#xA;                &#x27;scale=640:-1&#x27;,&#xA;                &#x27;-c:a&#x27;,&#xA;                &#x27;aac&#x27;,&#xA;                &#x27;-strict&#x27;,&#xA;                &#x27;-2&#x27;,&#xA;                &#x27;output.mp4&#x27;&#xA;            );&#xA;    &#xA;            const data = await fetchFile(&#x27;output.mp4&#x27;);&#xA;            const compressedVideoBlob = new Blob([data], { type: &#x27;video/mp4&#x27; });&#xA;            const compressedVideoUrl = URL.createObjectURL(compressedVideoBlob);&#xA;            setCompressedFile(compressedVideoUrl);&#xA;    &#xA;            await ffmpeg.unlink(fileName);&#xA;            await ffmpeg.unlink(&#x27;output.mp4&#x27;);&#xA;    &#xA;            alert(&#x27;Compression successful&#x27;);&#xA;        } catch (error) {&#xA;            console.error(&#x27;Error:&#x27;, error);&#xA;            alert(&#x27;Compression failed. Please check the console for more details.&#x27;);&#xA;        }&#xA;    };&#xA;        &#xA;&#xA;    const handleSubmit = async (e) => {&#xA;        e.preventDefault();&#xA;&#xA;        if (file) {&#xA;            const fileType = file.name.split(&#x27;.&#x27;).pop().toLowerCase();&#xA;&#xA;            if (fileType === &#x27;png&#x27; || fileType === &#x27;jpg&#x27; || fileType === &#x27;jpeg&#x27;) {&#xA;                compressImage(file);&#xA;            } else if (fileType === &#x27;mp4&#x27; || fileType === &#x27;h264&#x27;) {&#xA;                compressVideo(file);&#xA;            } else {&#xA;                alert(&#x27;Please select a valid file type (png, jpg, jpeg for images or mp4, h264 for videos).&#x27;);&#xA;            }&#xA;        }&#xA;    };&#xA;&#xA;    const handleDownload = () => {&#xA;        if (file) {&#xA;            const downloadLink = document.createElement(&#x27;a&#x27;);&#xA;            downloadLink.href = compressedFile;&#xA;&#xA;            const fileExtension = file.name.split(&#x27;.&#x27;).pop().toLowerCase();&#xA;&#xA;            downloadLink.download = `compressed_file.${fileExtension}`;&#xA;    &#xA;            document.body.appendChild(downloadLink);&#xA;            downloadLink.click();&#xA;            document.body.removeChild(downloadLink);&#xA;        }&#xA;    };&#xA;&#xA;    return (&#xA;        &lt;>&#xA;            <h1>Main Page</h1>&#xA;            <form>&#xA;                <label>Upload</label>&#xA;                <input type="&#x27;file&#x27;" />&#xA;                <br /><br />&#xA;                <input type="submit" value="Compress" />&#xA;            </form>&#xA;            {compressedFile &amp;&amp; (&#xA;                &lt;>&#xA;                    <h2>Compressed File Preview</h2>&#xA;                    {file &amp;&amp; file.name &amp;&amp; ( &#xA;                        file.name.split(&#x27;.&#x27;).pop().toLowerCase() === &#x27;mp4&#x27; || file.name.split(&#x27;.&#x27;).pop().toLowerCase() === &#x27;h264&#x27; ? (&#xA;                            <video width="300" controls="controls">&#xA;                                <source src="{compressedFile}" type="video/mp4"></source>&#xA;                                Your browser does not support the video tag.&#xA;                            </video>&#xA;                        ) : (&#xA;                            <img src="http://stackoverflow.com/feeds/tag/{compressedFile}" alt="Compressed file preview" style='max-width: 300px; max-height: 300px' />&#xA;                        )&#xA;                    )}&#xA;                    <br /><br />&#xA;                    <button>Download Compressed File</button>&#xA;                >&#xA;            )}&#xA;        >&#xA;    );&#xA;};&#xA;&#xA;export default Main;&#xA;

    &#xA;

    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.

    &#xA;

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

    &#xA;

  • C# Process in loop reading error output, causes "No async read operation is in progress on the stream" error

    29 mai 2023, par TSLee

    I am trying to read the format of multiple video files using ffmpeg in an asynchronous operation of Process and facing an error, "No async read operation is in progress on the stream". According to https://social.msdn.microsoft.com/Forums/vstudio/en-US/c961f461-7afb-4a92-b0ae-f78c2003b5de/help-an-asynchronous-read-operation-is-already-in-progress-on-the-standardoutput-stream?forum=csharpgeneral, I think I have to use CancelErrorRead(), as BeginErrorReadLine() can't be launched more than once. I also wonder if I use this function in the wrong place, because the read operation has ended in process1.exited() ? But the operation can't proceed to the second index with this error.

    &#xA;

    How could I use CancelErrorRead()/CancelOutputRead() properly and where should I place them on the code ? I also did an experiment in that I commented these two CancelRead(), and a different error "async read operation has been started on the stream" will appear.

    &#xA;

                Process process1 = new Process();&#xA;            process1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;&#xA;            process1.StartInfo.CreateNoWindow = true;&#xA;            process1.StartInfo.UseShellExecute = false;&#xA;            process1.StartInfo.FileName = ".\\ffmpeg.exe";&#xA;            process1.StartInfo.WorkingDirectory = ".\\";&#xA;            process1.EnableRaisingEvents = true;&#xA;            process1.StartInfo.RedirectStandardOutput = true; //if this is true, UseShellExecute must be false. true if output should be written to StandardOutput&#xA;            process1.StartInfo.RedirectStandardError = true;&#xA;            //indicates that the associated Process has written a line that&#x27;s terminated with a newline&#xA;            process1.ErrorDataReceived &#x2B;= new DataReceivedEventHandler(inputHandler);&#xA;            process1.Exited &#x2B;= (ending, p) =>&#xA;            {&#xA;                flag = true;&#xA;                process1.CancelOutputRead();&#xA;                process1.CancelErrorRead();//&#xA;            };&#xA;            foreach (String file in inputList)&#xA;            {&#xA;                if (flag == true)&#xA;                {&#xA;                    flag = false;&#xA;                    process1.StartInfo.Arguments = "-i " &#x2B; " \"" &#x2B; file &#x2B; "\"";&#xA;                    Console.WriteLine(process1.StartInfo.Arguments);&#xA;                    process1.Start();&#xA;                    process1.BeginOutputReadLine();//&#xA;                    process1.BeginErrorReadLine();&#xA;                    process1.WaitForExit(); //for asynchronous output&#xA;                }&#xA;&#xA;&#xA;            }&#xA;        }&#xA;        private void inputHandler(object sender, DataReceivedEventArgs l)&#xA;        {&#xA;             cba.Append(l.Data &#x2B; "\n");&#xA;             videoInput = l.Data;&#xA;             //Console.WriteLine(cba);&#xA;             //Process p = sender as Process;&#xA;             Console.WriteLine(videoInput);&#xA;&#xA;             this.BeginInvoke(new MethodInvoker(() =>&#xA;             {&#xA;&#xA;              if (!String.IsNullOrEmpty(videoInput))&#xA;              {&#xA;                    if (videoInput.Contains("Stream #0:0"))&#xA;                    {&#xA;                        String subvideoInput1 = &#xA;                        videoInput.Substring(videoInput.IndexOf("Stream #0:0"));&#xA;                        String video_inputType = subvideoInput1;&#xA;                        textBox1.Text &#x2B;= video_inputType &#x2B; System.Environment.NewLine;&#xA;                        Console.WriteLine(video_inputType);&#xA;                     }&#xA;                     if (videoInput.Contains("Stream #0:1"))&#xA;                     {&#xA;                         String subvideoInput2 = &#xA;                         videoInput.Substring(videoInput.IndexOf("Stream #0:1"));&#xA;                         Console.WriteLine(subvideoInput2.IndexOf("\n"));&#xA;                         Console.WriteLine(subvideoInput2);&#xA;                         String audio_inputType = subvideoInput2;&#xA;                         textBox1.AppendText(audio_inputType &#x2B; System.Environment.NewLine);&#xA;                         Console.WriteLine(audio_inputType);&#xA;                     }&#xA;                     if (videoInput.Contains("Duration:"))&#xA;                     {&#xA;                         String videoinputDuration = &#xA;                         videoInput.Substring(videoInput.IndexOf("Duration:"));&#xA;                         String subvideo_inputDuration = videoinputDuration.Substring(9);&#xA;                         String inputvideoDuration = &#xA;                     subvideo_inputDuration.Remove(subvideo_inputDuration.IndexOf("."));&#xA;                         Console.WriteLine(inputvideoDuration);&#xA;                         double totalseconds = &#xA;                         TimeSpan.Parse(inputvideoDuration).TotalSeconds;&#xA;                    &#xA;                    &#xA;&#xA;                }&#xA;            }&#xA;&#xA;        }));&#xA;&#xA;&#xA;    }&#xA;

    &#xA;