
Recherche avancée
Médias (1)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
Autres articles (112)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains 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, parMediaSPIP 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, parAfin 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 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 ?


-
vcpkg error : BUILD_FAILED when "Getting CMake variables for x64-windows"
24 août 2024, par Rok BenkoI'm trying to install ffmpeg via vcpkg on Windows by running the following command :


vcpkg.exe install ffmpeg


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


-- Getting CMake variables for x64-windows
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:127 (message):
 Command failed: "C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" -v
 Working Directory: C:/Users/xxxxx/vcpkg/buildtrees/pkgconf/x64-windows-rel/vcpkg-parallel-configure
 Error code: 1
 See logs for more information:
 C:\Users\xxxxx\vcpkg\buildtrees\pkgconf\cmake-get-vars-x64-windows-dbg-CMakeCache.txt.log
 C:\Users\xxxxx\vcpkg\buildtrees\pkgconf\cmake-get-vars-x64-windows-rel-CMakeCache.txt.log
 C:\Users\xxxxx\vcpkg\buildtrees\pkgconf\cmake-get-vars-x64-windows-dbg-CMakeConfigureLog.yaml.log
 C:\Users\xxxxx\vcpkg\buildtrees\pkgconf\cmake-get-vars-x64-windows-rel-CMakeConfigureLog.yaml.log
 C:\Users\xxxxx\vcpkg\buildtrees\pkgconf\cmake-get-vars-x64-windows-out.log

Call Stack (most recent call first):
 installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_configure.cmake:269 (vcpkg_execute_required_process)
 installed/x64-windows/share/vcpkg-cmake-get-vars/vcpkg_cmake_get_vars.cmake:15 (vcpkg_cmake_configure)
 installed/x64-windows/share/vcpkg-tool-meson/vcpkg_configure_meson.cmake:323 (vcpkg_cmake_get_vars)
 installed/x64-windows/share/vcpkg-tool-meson/vcpkg_configure_meson.cmake:458 (vcpkg_generate_meson_cmd_args)
 ports/pkgconf/portfile.cmake:9 (vcpkg_configure_meson)
 scripts/ports.cmake:192 (include)


error: building pkgconf:x64-windows failed with: BUILD_FAILED
See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
Elapsed time to handle pkgconf:x64-windows: 1.9 s
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
 https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+pkgconf
You can submit a new issue at:
 https://github.com/microsoft/vcpkg/issues/new?title=xxxxx



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

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


-
FFmpeg drawtext filter error : "Cannot find a valid font for the family Sans"
7 septembre 2024, par fatdrogenI'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 :


error : Cannot load default config file


ERROR : Cannot find a valid font for the family Sans


ERROR : Error initializing filter 'drawtext'


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


Here's the relevant part of my FFmpeg command :


Copydrawtext=text='write some thing '


Questions :


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


Environment :


Platform : iOS
FFmpeg : Using MobileFFmpeg library
Swift


Any help or guidance would be greatly appreciated !


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