Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
a6123d1
1
Parent(s):
cde398b
trying to improve
Browse files
src/bug-in-bun/aitube_ffmpeg/overlay/imageToVideoBase64.ts
CHANGED
@@ -104,10 +104,21 @@ export async function imageToVideoBase64({
|
|
104 |
const startZoom = 1;
|
105 |
const endZoom = 1 + zoomInRatePerSecond * durationInSeconds;
|
106 |
|
|
|
|
|
|
|
|
|
107 |
const videoFilters = [
|
108 |
`crop=${cropWidth}:${cropHeight}:${(originalWidth - cropWidth) / 2}:${(originalHeight - cropHeight) / 2}`,
|
109 |
`zoompan=z='if(lte(zoom,${endZoom}),zoom+${(endZoom - startZoom) / framesTotal},zoom)':x='${xCenter}':y='${yCenter}':d=${framesTotal/fps}`,
|
110 |
].join(',');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
console.log("imageToVideoBase64:", {
|
113 |
originalWidth,
|
|
|
104 |
const startZoom = 1;
|
105 |
const endZoom = 1 + zoomInRatePerSecond * durationInSeconds;
|
106 |
|
107 |
+
/**
|
108 |
+
this version has an issue, the ken burns effect is too fast, and is repeated multiple times,
|
109 |
+
which is uncomfortable to watch
|
110 |
+
|
111 |
const videoFilters = [
|
112 |
`crop=${cropWidth}:${cropHeight}:${(originalWidth - cropWidth) / 2}:${(originalHeight - cropHeight) / 2}`,
|
113 |
`zoompan=z='if(lte(zoom,${endZoom}),zoom+${(endZoom - startZoom) / framesTotal},zoom)':x='${xCenter}':y='${yCenter}':d=${framesTotal/fps}`,
|
114 |
].join(',');
|
115 |
+
*/
|
116 |
+
|
117 |
+
// hopefully this versionw orks betetr
|
118 |
+
const videoFilters = [
|
119 |
+
`crop=${cropWidth}:${cropHeight}:${(originalWidth-cropWidth)/2}:${(originalHeight-cropHeight)/2}`,
|
120 |
+
`zoompan=z='min(zoom+${(endZoom - startZoom) / framesTotal}, ${endZoom})':x='${xCenter}':y='${yCenter}':d=${fps}`,
|
121 |
+
].join(',');
|
122 |
|
123 |
console.log("imageToVideoBase64:", {
|
124 |
originalWidth,
|