Operations 18 min read

Technical Overview of Baijiahao Video Rendering and Composition Using After Effects

Baijiahao’s text‑to‑video pipeline now relies on After Effects for rendering and composition, using standardized templates, JavaScript‑based AE scripts, and aerender command‑line features such as reuse, multi‑frame and network rendering to achieve rich visual effects with lower R&D cost, though browser preview and cross‑platform deployment remain limited.

Baidu Geek Talk
Baidu Geek Talk
Baidu Geek Talk
Technical Overview of Baijiahao Video Rendering and Composition Using After Effects

Baijiahao, Baidu's content creation platform, has been exploring the automatic conversion of text and images into short videos by leveraging Baidu's AI capabilities (vision, speech, NLP). Video rendering and composition are the final steps that determine video quality and timeliness.

Background : Short‑video consumption in China exceeds 9.34 billion users (90.5% of internet users). Efficient, intelligent video synthesis is a major challenge for creators. Baijiahao initially used VidPress (based on five steps similar to manual video editing) to automate text‑to‑video conversion.

The platform now focuses on optimizing the rendering stage, which includes template standardization, script development, content orchestration, and video rendering.

Why After Effects (AE) : AE provides powerful rendering, a rich plugin ecosystem, and strong scripting capabilities. Compared with low‑level libraries such as FFmpeg, OpenGL, or custom engines, AE enables rapid development of rich visual effects with lower R&D cost.

Key Technologies Discussed :

FFmpeg – command‑line tool for video concatenation, format conversion and transition effects. Example command: ffmpeg -loop 1 -t 5 -i img01.png -loop 1 -t 5 -i img02.png -filter_complex "[0][1]xfade=transition=fade:duration=1:offset=4,format=yuv420p" output.mp4

OpenGL – cross‑platform graphics library for custom transition effects (see https://gl-transitions.com/).

AE scripting – JavaScript (ECMA‑262) based scripts that manipulate project, composition, layers and render queue. Sample script for background replacement: var newBackgroundPath = '...'; var item = findCompByName('Background'); replaceAVLayerSource(item.layer(1), newBackgroundPath); function findCompByName(name) { var project = app.project; var numItems = project.numItems; for (var i = 1; i <= numItems; i++) { var item = project.item(i); if (item instanceof CompItem && item.name === name) { return item; } } } function replaceAVLayerSource(curLayer, newFilePath) { var importOptions = new ImportOptions(); importOptions.file = new File(newFilePath); var newItem = app.project.importFile(importOptions); curLayer.replaceSource(newItem, false); }

AE command‑line rendering (aerender). Simple render command: aerender -project C:\projects\project_1.aep -comp "Composition_1" -output C:\output\project_1\project_1.avi and multi‑frame/network rendering examples are provided.

Python script for handling unexpected AE pop‑up windows during headless rendering: # AE main window title and class mainClass = "AE_CApplication_22.2" # window title to look for targetTitle = "After Effects" hWndList = [] win32gui.EnumWindows(lambda hWnd, param: param.append(hWnd), hWndList) for hd in hWndList: title = win32gui.GetWindowText(hd) clsname = win32gui.GetClassName(hd) if -1 != str(title).find(targetTitle) and mainClass != clsname: win32gui.PostMessage(hd, win32con.WM_CLOSE, 0, 0)

Template Standardization : Layers are named with prefixes (Text1, Photo1, Background, Foreground, Effect) to allow scripts to modify them without opening AE. Templates are exported to JSON (using tools like https://github.com/Jam3/ae-to-json) for validation.

Automation Workflow :

Standardize templates (consistent layer naming, single background/foreground/effect layers).

Develop AE scripts (AES) to replace media, animate properties, and trigger rendering.

Use aerender with -reuse to reuse a running AE instance, -s / -e for frame ranges, and multi‑machine templates for distributed rendering.

Performance Optimizations :

Window reuse ( -reuse ) reduces AE startup overhead.

Multi‑frame rendering (After Effects 2022) utilizes all CPU cores.

Network rendering distributes work across multiple machines.

Limitations :

AE templates cannot be rendered in browsers, preventing real‑time preview on the client side.

AE runs only on Windows and macOS, requiring dedicated rendering farms and limiting integration with some internal infrastructure.

Overall, the article presents a comprehensive technical solution for Baijiahao's text‑to‑video pipeline based on After Effects, highlighting its strengths in visual richness and scriptability, while also acknowledging the challenges of scalability and real‑time preview.

AutomationscriptingFFmpegOpenGLPipelinevideo renderingAfter Effects
Baidu Geek Talk
Written by

Baidu Geek Talk

Follow us to discover more Baidu tech insights.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.