sunx.ai

sunx.ai

Save 600,000 yuan a year by creating your own server-side audio, video, and image template pages.

Introduction#

Please refer to the official website for more information.

GitHub

Requirements#

If we want to implement a template for images and videos, and batch upload images, videos, and text in the future, and reuse special effects stickers, etc., but the templates in KineMaster can only be used in KineMaster. So, let's implement our own KineMaster. However, we can only manually use its templates in KineMaster, which is like a dream. There are hundreds of people working on KineMaster, and it takes several workers to create a transition effect.

But what if we want to make it a server-side service and automate the process? Someone has already done this, and that is TikTok. Below is TikTok's intelligent creation cloud, which includes image templates and video templates. The most expensive price is 600,000 yuan per year. Since it's too expensive, let's do it ourselves.

image
image

Solution#

We can put all the required effects into After Effects and create a special file format. Then, we can use placeholders for text, images, and videos, while keeping the effects and transitions unchanged. This way, we can create a template. If we need to replace images or videos for medical beauty, hotels, restaurants, or the same Dragon Boat Festival event, we can simply upload them and get the finished product immediately.

Linux Installation#

System Version#

PyTorch 2.1.0
Cuda 12.1
Python 3.10 (Ubuntu 22.04)
CMake version 3.25.0
GCC version 11.4.0

Install Necessary Environment for the Project#

# Install the latest version of Node.js
# Installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm -v  # 0.39.7

nvm install 22
node -v # v22.2.0
npm -v  # 10.7.0

# Change to Aliyun mirror
npm config set registry https://registry.npmmirror.com
npm config set strict-ssl false
npm install -g depsync
depsync --version			# Version 1.4.0

sudo apt-get install git-lfs
sudo apt-get install ninja-build -y
sudo apt-get install libx11-dev -y
# Optional
sudo apt-get install ffmpeg libavcodec-dev libavformat-dev libavutil-dev

Installation#

# Version 4.3.57
git clone  https://github.com/Tencent/libpag.git   
cd libpag
depsync

# Switch to the directory containing CMakeLists.txt
cd libpag/linux

./build_pag.sh 

# Create a new directory to store the build files
mkdir build
cd build

# Use CMake to generate Makefile
cmake ..

# Use the make command to compile your program
make

# Run your program
./pag-linux

Successful Installation and Execution#

Finally, run ./pag-linux. It will automatically replace the images and text in ../../assets/test2.pag, and the first step of the Long March has been successfully completed. Then, merge the n images output by ./pag-linux, from 0.bmp to xx.bmp, to get an output.mp4.

ffmpeg -framerate 25 -i %d.bmp -c:v libx264 -pix_fmt yuv420p output.mp4

At this point, you have completed the first process. Now, you can use After Effects to create a pag file, use ./pag-linux on the server to replace the text and images inside it, and then merge the images into a video. With this, you can earn 600,000 yuan in a year.

The official Linux version does not provide video placeholders, so you need to develop them yourself or buy the commercial version, which costs about 800,000 to 3 million yuan per year. However, I have implemented video placeholders based on open source code after working hard for a few months. If you are interested, please leave a comment.

Advanced Features of PAG

img img img

This article is synchronized updated to xLog by Mix Space
The original link is https://sunx.ai/posts/video/pag


Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.