So if you follow along in the video, I refer to this blog post for you to either code code at certain points of show commands or reference files and features to downlaod, so below is everything you will need!
The video I used in the tutorial of the falling fruit is here !
The code used in the html widget under the video:
Second option with PRE-Loading
PART 2 : Sprite Sheet
The Sprite Image I used for the tutorial
The code referenced to put into a HTML Widget in the Elementor page builder:
The code referenced to put into the Custom CSS of the HTML widget in the Elementor page builder:
.container {
height: 300vh; /* Ensure enough height to enable scrolling */
position: relative;
}
.video-sprite {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-size: cover; /* Ensure the background covers the element */
background-position: center; /* Center the background image */
background-image: none;
}
@media (max-width: 768px) { /* Adjust the max-width as needed for your design */
.video-sprite {
/* Additional styles for mobile */
background-position: center center; /* Center the image on smaller screens */
}
}
The code referenced to put into a Custom Code Template in Elementor:
PART 3 : Video Encoding Using FFMPEG
To Download the FFMPEG library to use on your PC click the button below to go directly to the download page of the official FFMPEG Page
The FFMPEG Command I used in the Command Prompt to encode the video used into the format needed:
ffmpeg -i videobackground.mov -vf "fps=30,scale=-1:1080" -c:v libx265 -preset slower -pix_fmt yuv420p -an -t 7 output3020.mov
PART 4 : Creating a sprite sheet using FFMEPG
To create a sprite sheet of a video, we first have to create an array of images cut from the video, the FFMPRG Command is :
(Change the scale and FPS as needed, this is just the example I used in the tutorial, not the best for real world deployment.)
ffmpeg -i input.mov -vf "fps=30,scale=1920:1080" frame_%04d.jpg
To create a sprite sheet of a video FROM the generated image array, the command to use is:
(30 is how many columns and N is automatic for how many rows, not the best for the real world but fine in the tutorial to show how to do it.)
This file will be big, buddy, hence using the plugin shown in the tutorial on how to bypass the scaling issue in WordPress
ffmpeg -i frame_%04d.jpg -filter_complex "tile=10x10" sprite_sheet.png