
Recherche avancée
Autres articles (112)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
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 (...) -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.
Sur d’autres sites (8402)
-
How to Correctly Implement ffmpeg Complex Filters in Node.js for Image Processing ?
24 janvier 2024, par LukeProblem :


I am trying to add filters and transitions between my image slideshow array, and am struggling to apply the proper filters. For example, I get errors like this :


{
 "errorType": "Error",
 "errorMessage": "ffmpeg exited with code 234: Failed to set value 'fade=type=in:start_time=0:duration=1,zoompan=z=zoom+0.002:d=120:x=if(gte(zoom,1.2),x,x+1):y=if(gte(zoom,1.2),y,y+1)' for option 'filter_complex': Invalid argument\nError parsing global options: Invalid argument\n",
 "trace": [
 "Error: ffmpeg exited with code 234: Failed to set value 'fade=type=in:start_time=0:duration=1,zoompan=z=zoom+0.002:d=120:x=if(gte(zoom,1.2),x,x+1):y=if(gte(zoom,1.2),y,y+1)' for option 'filter_complex': Invalid argument",
 "Error parsing global options: Invalid argument",
 "",
 " at ChildProcess.<anonymous> (/opt/nodejs/node_modules/fluent-ffmpeg/lib/processor.js:182:22)",
 " at ChildProcess.emit (node:events:517:28)",
 " at ChildProcess._handle.onexit (node:internal/child_process:292:12)"
 ]
}
</anonymous>


Lambda Function Code :


async function concat(bucketName, imageKeys) {
 const imageStreams = await Promise.all(
 imageKeys.map(async (key, i) => {
 const command = new GetObjectCommand({ Bucket: bucketName, Key: key });
 const response = await s3.send(command);
 // Define the temporary file path based on the index
 const tempFilePath = `/tmp/${i}.png`;
 
 // Write the image data to the temporary file
 await fs.writeFile(tempFilePath, response.Body);
 
 // Return the file path to be used later
 return tempFilePath;
 })
 );
 
 // Create a file list content with durations
 let fileContent = "";
 for (let i = 0; i < imageStreams.length; i++) {
 fileContent += `file '${imageStreams[i]}'\nduration 1\n`;
 
 // Check if it's the last image, and if so, add it again
 if (i === imageStreams.length - 1) {
 fileContent += `file '${imageStreams[i]}'\nduration 1\n`;
 }
 }
 
 // Define the file path for the file list
 const fileListPath = "/tmp/file_list.txt";
 
 // Write the file list content to the file
 await fs.writeFile(fileListPath, fileContent);
 
 try {
 await fs.writeFile(fileListPath, fileContent);
 } catch (error) {
 console.error("Error writing file list:", error);
 throw error;
 }
 
 // Create a complex filter to add zooms and pans
 // Simplified filter example
 let complexFilter = [
 // Example of a fade transition
 {
 filter: 'fade',
 options: { type: 'in', start_time: 0, duration: 1 },
 inputs: '0:v', // first video stream
 outputs: 'fade0'
 },
 // Example of dynamic zoompan
 {
 filter: 'zoompan',
 options: {
 z: 'zoom+0.002',
 d: 120, // duration for this image
 x: 'if(gte(zoom,1.2),x,x+1)', // dynamic x position
 y: 'if(gte(zoom,1.2),y,y+1)' // dynamic y position
 },
 inputs: 'fade0',
 outputs: 'zoom0'
 }
 // Continue adding filters for each image
 ];

 let filterString = complexFilter
 .map(
 (f) =>
 `${f.filter}=${Object.entries(f.options)
 .map(([key, value]) => `${key}=${value}`)
 .join(":")}`
 )
 .join(",");
 
 let filterString = complexFilter
 .map(
 (f) =>
 `${f.filter}=${Object.entries(f.options)
 .map(([key, value]) => `${key}=${value}`)
 .join(":")}`
 )
 .join(",");
 
 console.log("Filter String:", filterString);
 
 return new Promise((resolve, reject) => {
 ffmpeg()
 .input(fileListPath)
 .complexFilter(filterString)
 .inputOptions(["-f concat", "-safe 0"])
 .outputOptions("-c copy")
 .outputOptions("-c:v libx264")
 .outputOptions("-pix_fmt yuv420p")
 .outputOptions("-r 30")
 .on("end", () => {
 resolve();
 })
 .on("error", (err) => {
 console.error("Error during video concatenation:", err);
 reject(err);
 })
 .saveToFile("/tmp/output.mp4");
 });
 }



Filter String Console Log :


Filter String: fade=type=in:start_time=0:duration=1,zoompan=z=zoom+0.002:d=120:x=if(gte(zoom,1.2),x,x+1):y=if(gte(zoom,1.2),y,y+1)



Questions :


- 

- What is the correct syntax for implementing complex filters like zoompan and fade in ffmpeg when used in a Node.js environment ?
- How do I ensure the filters are applied correctly to each image in the sequence ?
- Is there a better way to dynamically generate these filters based on the number of images or their content ?








Any insights or examples of correctly implementing this would be greatly appreciated !


-
Error opening input files : Invalid data found when processing input
27 mars 2024, par Master's TimeI am creating disnake music bot. The error is :


[in#0 @ 00000233f8d71500] Error opening input: Invalid data found when processing input
Error opening input file https://www.youtube.com/watch?v=duDUqBtxwXk.
Error opening input files: Invalid data found when processing input



Here is part of my code :


import disnake
import asyncio
from yt_dlp import YoutubeDL
import ffmpeg


YTDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'False', 'simulate':'True', 'key':"FFmpegExtractAudio"}
FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}


async def play_music(inter):
 global YDTL_OPTIONS, FFMPEG_OPTIONS
 print(tm.now().strftime("%H:%M:%S"),"play_music begin")
 id = int(inter.guild.id)
 with YoutubeDL(YTDL_OPTIONS) as ydl:
 info = ydl.extract_info(url, download=False)

 song = {
 'link': 'https://www.youtube.com/watch?v=' + url,
 'thumbnail': 'https://i.ytimg.com/vi/' + url + '/hqdefault.jpg?sqp=-oaymwEcCOADEI4CSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLD5uL4xKN-IUfez6KIW_j5y70mlig',
 'source': info['formats'][0]['url'],
 'title': info['title']
 } self.vc[id].play(disnake.FFmpegPCMAudio(executable=r"C:\\ffmpeg\\ffmpeg\\bin\\ffmpeg.exe",source=song["source"], **FFMPEG_OPTIONS))
 print(tm.now().strftime("%H:%M:%S"),"play_music end")



I tried to write
source = song['source']
instead ofsource = song['link']
, but it didn't seem helpful.

-
fftools/ffmpeg_filter : change processing order in fg_finalise_bindings()
5 avril 2024, par Anton Khirnov