
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (100)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
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 ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (8870)
-
avfilter/af_surround : add focus option
15 novembre 2022, par Paul B Mahol -
FFmpeg zoompan filter always arcs when panning — how to get a straight‐line pan to a focus rectangle center ?
26 mai, par Mykyta ManuilenkoI’m trying to generate a 10s video from a single PNG image with FFmpeg’s
zoompan
filter, where the crop window zooms in from the image center and simultaneously pans in a perfectly straight line to the center of a predefined focus rectangle.

My input parameters :


"zoompan": {
 "timings": {
 "entry": 0.5, // show full frame
 "zoom": 1, // zoom-in/zoom-out timing
 "outro": 0.5 // show full frame in the end
 },
 "focusRect": {
 "x": 1086.36,
 "y": 641.87,
 "width": 612.44,
 "height": 344.86
 }
}



My input/output values :


- 

- fps : 25
- image input dimensions : 1920 × 1080
- output video dimensions : 1920 × 1080








My calculations :


// Width of the bounding box to zoom into
 const bboxWidth = focusRect.width;

 // Height of the bounding box to zoom into
 const bboxHeight = focusRect.height;

 // X coordinate (center of the bounding box)
 const bboxX = focusRect.x + focusRect.width / 2;

 // Y coordinate (center of the bounding box)
 const bboxY = focusRect.y + focusRect.height / 2;

 // Time (in seconds) to wait before starting the zoom-in
 const preWaitSec = timings.entry;

 // Duration (in seconds) of the zoom-in/out animation
 const zoomSec = timings.zoom;

 // Time (in seconds) to wait on the last frame after zoom-out
 const postWaitSec = timings.outro;

 // Frame counts
 const preWaitF = Math.round(preWaitSec * fps);
 const zoomInF = Math.round(zoomSec * fps);
 const zoomOutF = Math.round(zoomSec * fps);
 const postWaitF = Math.round(postWaitSec * fps);

 // Calculate total frames and holdF
 const totalF = Math.round(duration * fps);

 // Zoom target so that bbox fills the output
 const zoomTarget = Math.max(
 inputWidth / bboxWidth,
 inputHeight / bboxHeight,
 );

 // Calculate when zoom-out should start (totalF - zoomOutF - postWaitF)
 const zoomOutStartF = totalF - zoomOutF - postWaitF;

 // Zoom expression (simple linear in/out)
 const zoomExpr = [
 // Pre-wait (hold at 1)
 `if(lte(on,${preWaitF}),1,`,
 // Zoom in (linear)
 `if(lte(on,${preWaitF + zoomInF}),1+(${zoomTarget}-1)*((on-${preWaitF})/${zoomInF}),`,
 // Hold zoomed
 `if(lte(on,${zoomOutStartF}),${zoomTarget},`,
 // Zoom out (linear)
 `if(lte(on,${zoomOutStartF + zoomOutF}),${zoomTarget}-((${zoomTarget}-1)*((on-${zoomOutStartF})/${zoomOutF})),`,
 // End
 `1))))`,
 ].join('');

 // Center bbox for any zoom
 const xExpr = `${bboxX} - (${outputWidth}/zoom)/2`;
 const yExpr = `${bboxY} - (${outputHeight}/zoom)/2`;

 // Build the filter string
 const zoomPanFilter = [
 `zoompan=`,
 `s=${outputWidth}x${outputHeight}`,
 `:fps=${fps}`,
 `:d=${totalF}`,
 `:z='${zoomExpr}'`,
 `:x='${xExpr}'`,
 `:y='${yExpr}'`,
 `,gblur=sigma=0.5`,
 `,minterpolate=mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=${fps}`,
 ].join('');



So, my FFmpeg command looks like :


ffmpeg -t 10 -framerate 25 -loop 1 -i input.png -y -filter_complex "[0:v]zoompan=s=1920x1080:fps=25:d=250:z='if(lte(on,13),1,if(lte(on,38),1+(3.1350009796878058-1)*((on-13)/25),if(lte(on,212),3.1350009796878058,if(lte(on,237),3.1350009796878058-((3.1350009796878058-1)*((on-212)/25)),1))))':x='1392.58 - (1920/zoom)/2':y='814.3 - (1080/zoom)/2',gblur=sigma=0.5,minterpolate=mi_mode=mci:mc_mode=aobmc:vsbmc=1:fps=25,format=yuv420p,pad=ceil(iw/2)*2:ceil(ih/2)*2" -vcodec libx264 -f mp4 -t 10 -an -crf 23 -preset medium -copyts output.mp4



Actual behavior :


The pan starts at the image center, but follows a curved (arc-like) trajectory before it settles on the focus‐rect center (first it goes to the right bottom corner and then to the focus‐rect center).


Expected behavior :


The pan should move the crop window’s center in a perfectly straight line from (iw/2, ih/2) to (1392.58, 814.3) over the 25-frame zoom‐in (similar to pinch-zooming on a smartphone).


Questions :


- 

-
How can I express a truly linear interpolation of the crop window center inside zoompan so that the pan path is a straight line in source coordinates ?


-
Is there a better way (perhaps using different FFmpeg filters or scripting) to achieve this effect ?








-
Revision 33982 : oups, layout.html devient structure.html
27 décembre 2009, par cedric@… — Logoups, layout.html devient structure.html