Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP

Autres articles (112)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • 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 (...)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

Sur d’autres sites (9931)

  • 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;

  • vcpkg error : BUILD_FAILED when "Getting CMake variables for x64-windows"

    24 août 2024, par Rok Benko

    I'm trying to install ffmpeg via vcpkg on Windows by running the following command :

    &#xA;

    vcpkg.exe install ffmpeg

    &#xA;

    The installation throws an error when getting CMake variables for x64-windows.

    &#xA;

    -- Getting CMake variables for x64-windows&#xA;CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):&#xA;    Command failed: "C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" -v&#xA;    Working Directory: C:/Users/xxxxx/vcpkg/buildtrees/pkgconf/x64-windows-rel/vcpkg-parallel-configure&#xA;    Error code: 1&#xA;    See logs for more information:&#xA;      C:\Users\xxxxx\vcpkg\buildtrees\pkgconf\cmake-get-vars-x64-windows-dbg-CMakeCache.txt.log&#xA;      C:\Users\xxxxx\vcpkg\buildtrees\pkgconf\cmake-get-vars-x64-windows-rel-CMakeCache.txt.log&#xA;      C:\Users\xxxxx\vcpkg\buildtrees\pkgconf\cmake-get-vars-x64-windows-dbg-CMakeConfigureLog.yaml.log&#xA;      C:\Users\xxxxx\vcpkg\buildtrees\pkgconf\cmake-get-vars-x64-windows-rel-CMakeConfigureLog.yaml.log&#xA;      C:\Users\xxxxx\vcpkg\buildtrees\pkgconf\cmake-get-vars-x64-windows-out.log&#xA;&#xA;Call Stack (most recent call first):&#xA;  installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_configure.cmake:269 (vcpkg_execute_required_process)&#xA;  installed/x64-windows/share/vcpkg-cmake-get-vars/vcpkg_cmake_get_vars.cmake:15 (vcpkg_cmake_configure)&#xA;  installed/x64-windows/share/vcpkg-tool-meson/vcpkg_configure_meson.cmake:323 (vcpkg_cmake_get_vars)&#xA;  installed/x64-windows/share/vcpkg-tool-meson/vcpkg_configure_meson.cmake:458 (vcpkg_generate_meson_cmd_args)&#xA;  ports/pkgconf/portfile.cmake:9 (vcpkg_configure_meson)&#xA;  scripts/ports.cmake:192 (include)&#xA;&#xA;&#xA;error: building pkgconf:x64-windows failed with: BUILD_FAILED&#xA;See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.&#xA;Elapsed time to handle pkgconf:x64-windows: 1.9 s&#xA;Please ensure you&#x27;re using the latest port files with `git pull` and `vcpkg update`.&#xA;Then check for known issues at:&#xA;  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue&#x2B;is%3Aopen&#x2B;in%3Atitle&#x2B;pkgconf&#xA;You can submit a new issue at:&#xA;  https://github.com/microsoft/vcpkg/issues/new?title=xxxxx&#xA;

    &#xA;

    What does this error mean ? The suggested git pull and vcpkg update didn't solve the error. The directory is up to date.

    &#xA;

    PS : I opened logs, but I have no idea how to solve the error. I don't understand them.

    &#xA;

  • FFmpeg drawtext filter error : "Cannot find a valid font for the family Sans"

    7 septembre 2024, par fatdrogen

    I'm trying to add text overlay to a video using FFmpeg's drawtext filter in my iOS app, but I'm encountering the following error :

    &#xA;

    error : Cannot load default config file

    &#xA;

    ERROR : Cannot find a valid font for the family Sans

    &#xA;

    ERROR : Error initializing filter 'drawtext'

    &#xA;

    ERROR : with args 'text=write some thing :'

    &#xA;

    Here's the relevant part of my FFmpeg command :

    &#xA;

    Copydrawtext=text='write some thing '

    &#xA;

    Questions :

    &#xA;

    What's causing this error, and how can I resolve it ?&#xA;Is there a way to specify a font that's guaranteed to be available on iOS devices ?&#xA;Are there any alternative approaches to adding text overlay in FFmpeg that might avoid this issue ?

    &#xA;

    Environment :

    &#xA;

    Platform : iOS&#xA;FFmpeg : Using MobileFFmpeg library&#xA;Swift

    &#xA;

    Any help or guidance would be greatly appreciated !

    &#xA;

    func makeGIFData(asset: AVAsset,  startTime: Double, endTime: Double, rotation: Double, overlayText: String) async throws -> Data {&#xA;    let fileName = "\(ProcessInfo.processInfo.globallyUniqueString)_input.mp4"&#xA;    let fileURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(fileName)&#xA;    &#xA;    // Export the asset to a temporary file&#xA;    guard let exporter = try? await AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetHighestQuality) else {&#xA;        throw NSError(domain: "GIFConversionError", code: -1, userInfo: [NSLocalizedDescriptionKey: "Failed to create AVAssetExportSession"])&#xA;    }&#xA;    &#xA;    exporter.outputURL = fileURL&#xA;    exporter.outputFileType = .mp4&#xA;    exporter.timeRange = CMTimeRange(start: CMTime(seconds: startTime, preferredTimescale: 600), end: CMTime(seconds: endTime, preferredTimescale: 600))&#xA;    &#xA;    do {&#xA;        try await exporter.export()&#xA;    } catch {&#xA;        throw NSError(domain: "GIFConversionError", code: -2, userInfo: [NSLocalizedDescriptionKey: "Failed to export video: \(error.localizedDescription)"])&#xA;    }&#xA;    &#xA;    let outfileName = "\(ProcessInfo.processInfo.globallyUniqueString)_outfile.gif"&#xA;    let outfileURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(outfileName)&#xA;    &#xA;    // Get video dimensions&#xA;    guard let track = try? await asset.loadTracks(withMediaType: .video).first,&#xA;          let videoSize = try? await track.load(.naturalSize) else {&#xA;        throw NSError(domain: "GIFConversionError", code: -4, userInfo: [NSLocalizedDescriptionKey: "Failed to get video dimensions"])&#xA;    }&#xA;    &#xA;    // Prepare FFmpeg command&#xA;    var command = "-i \(fileURL.path) -vf "&#xA;    &#xA;    &#xA;    // Add text overlay&#xA;    let escapedText = overlayText.replacingOccurrences(of: ":", with: "\\:").replacingOccurrences(of: "&#x27;", with: "\\&#x27;")&#xA;    let fontColor = textColor.toHexString()&#xA;    &#xA;    // Use a more universally available font, or provide multiple options&#xA;    filters &#x2B;= ",drawtext=text=&#x27;write some thing &#x27;:"&#xA;    &#xA;    // Add palette generation and application&#xA;    filters &#x2B;= ",split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse"&#xA;    &#xA;    // Add filters to command&#xA;    command &#x2B;= "\"\(filters)\""&#xA;    &#xA;    // Finalize command&#xA;    command &#x2B;= " -loop 0 \(outfileURL.path)"&#xA;    &#xA;    print("FFmpeg command: \(command)")&#xA;    &#xA;    let startTime = CFAbsoluteTimeGetCurrent()&#xA;    &#xA;    let result = MobileFFmpeg.execute(command)&#xA;    &#xA;    if result != RETURN_CODE_SUCCESS {&#xA;        throw NSError(domain: "GIFConversionError", code: Int(result), userInfo: [NSLocalizedDescriptionKey: "FFmpeg conversion failed"])&#xA;    }&#xA;    &#xA;    let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime&#xA;    print("Time elapsed: \(timeElapsed) s.")&#xA;    &#xA;    // Read the generated GIF file&#xA;    guard let gifData = try? Data(contentsOf: outfileURL) else {&#xA;        throw NSError(domain: "GIFConversionError", code: -3, userInfo: [NSLocalizedDescriptionKey: "Failed to read generated GIF file"])&#xA;    }&#xA;    &#xA;    print("Animated GIF data created successfully. Size: \(gifData.count) bytes")&#xA;    &#xA;    // Clean up temporary files&#xA;    try? FileManager.default.removeItem(at: fileURL)&#xA;    try? FileManager.default.removeItem(at: outfileURL)&#xA;    &#xA;    return gifData&#xA;}&#xA;&#x27;&#x27;&#x27;&#xA;

    &#xA;