
Recherche avancée
Autres articles (90)
-
Contribute to a better visual interface
13 avril 2011MediaSPIP 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. -
Selection of projects using MediaSPIP
2 mai 2011, parThe examples below are representative elements of MediaSPIP specific uses for specific projects.
MediaSPIP farm @ Infini
The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...) -
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 (...)
Sur d’autres sites (6699)
-
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
}
'''



-
How to merge video file with audio file and maintain creation time ?
19 janvier 2021, par madprogramerI was finicking around with youtube-dl and ended up downloading a video that youtube-dl wasn't able to merge the generated audio and video. After some investigation, I found that there was an issue in my ffmpeg config.


Normally, if you actually run youtube-dl a second time after fixing ffmpeg, it will automatically merge the files for you. But as fate would have it, the online video has since been deleted so youtube-dl freaks out.


Fortunately ffmpeg itself can also merge audio and video files, but loses a very nice feature youtube-dl's implementation has, keeping the creation time of the files (i.e. creation rather than download or publication time).


Is there any way to merge an audio and video file and keep the creation/last modified date ?


-
dshow : allow selecting devices by an alternative name (workaround for devices with...
23 janvier 2015, par rogerdpack