Explanation of the Short-Form Video Auto-Generation Pipeline_2
Introduction
In Part 1, I broke down an episode of a drama into dialogue, one-minute plot summaries, and individual shots. However, two elements were still missing for it to be used as short-form content.
- The speakers in the dialogue are identified only by numbers, such as “Speaker 1” or “Speaker 5.” It’s unclear who is speaking.
- The cuts are fragments averaging just over 3 seconds each, making them too short to be effectively used in short-form content.
Part 2 covers the process of addressing these two issues and selecting clips based on specific criteria. The process can be summarized as follows:
- Assigning character names to speaker numbers
- Dividing episodes into event units (sequence draft)
- Add locations and characters to the cut assignments
- Reorganize sequences based on cut determinations (sequence refinement)
- Grouping cuts into scenes within a sequence
- Index the material and select clips based on queries (programming)

Step 1 is handled by the subtitling service; steps 2–5 by the video analysis service; and step 6 by the programming service. The language model is the same as in Part 1—Qwen3.8-27B—while the two newly introduced models are for facial recognition (insightface) and embedding (Qwen3-Embedding-4B).
1. Assigning Character Names to Speaker Numbers
Speaker separation during the transcription stage groups people based solely on their voices. As a result, if a name is unknown or voices sound similar, different people may be grouped under the same number. This stage involves looking at faces on screen to assign names to the numbers.
1-1. Face Clustering and Character Candidates
- Faces are detected across the entire frame at a rate of one frame per second, and faces belonging to the same person are grouped together (clustered). Face detection is performed by a worker on the GPU.
- Simultaneously, the language model reads the title, the list of characters identified in Episode 1, the plot summary, and the dialogue to select all potential characters who might appear in this episode. Titles such as “Dad” or “Boss” are treated as clues rather than names and are set aside separately.
- These two tasks do not wait for each other. Since the face detection and language model run on different servers, they are launched simultaneously.
1-2. Splitting Speaker Numbers by Face
To ask the model, “Who is the speaker in this cluster?” later on, each cluster must contain only one person. Therefore, we first split the speaker IDs into faces. These resulting clusters are called units.

- For each speaker ID, the face that appears most frequently on screen when that speaker is speaking is designated as the representative face.
- Clusters that closely resemble the representative face are considered to belong to the same person. This addresses situations where a single person’s face is split across multiple clusters due to angle or lighting.
- For each line of dialogue, the system checks whether a representative face is present in that segment. If not, the search is expanded to the entire scene to which that line belongs. If no representative face is found within the scene and only other faces are present, that line is separated and treated as a new unit.
- Segments where no faces are detected are left as is without further analysis. This applies to cases such as narration that does not appear on screen.
1-3. Character Database and Name Confirmation

- Character Bank: This is a repository of faces whose names have been confirmed up to the previous episode. Compare the cluster of faces from this episode with the Character Bank to identify which character in the bank they match.
- Confirmation via the Bank: If the representative face of a unit matches someone in the bank, and that face actually appears in more than half of the unit’s dialogue, the name is confirmed without asking the model.
- The model determines the remaining units. The model is given a list of character candidates, units, and all dialogue, and is asked to name a character for each unit. The basis for the answer must be one of the following: a response to being called by name, a self-introduction, or a relational title; inferences based solely on speech patterns or content are not allowed. If unsure, the model must answer “TBD.”
- The same question is asked three times. Asking only once resulted in runs where units were omitted or names changed. Only runs where a majority of the three attempts yielded the same name are accepted. Runs where the model failed to answer most of the units are considered malfunctions and excluded from the vote. Names provided by the model are also cross-checked against the bank and filtered once more.
- Retaining in the Bank: Only people the bank already knows and those who received the same name all three times in this round with high confidence are retained in the bank. As rounds progress, the number of faces the bank recognizes increases, allowing the next round to be confirmed without the model to that extent.
As a result, names are assigned to the dialogue, and information on “who is on screen” is recorded for every frame (every second). These face names are used as character information for subsequent cut judgments and scenes. If a name is uncertain, the field is left blank. The judgment is that a blank field is better than an incorrect name.
2. Dividing Takes by Event (Sequence Draft)
- If you try to immediately group around 1,200 cuts into scenes, it’s unclear where to draw the lines. Therefore, we first divide the episode into large event units. These units are called sequences.
- Do not look at the footage. Divide the episodes based solely on the episode outline, character list, and the one-minute plot summaries created in Part 1. One model call per episode.
- The boundaries are set in one-minute intervals. Since the summaries are organized in one-minute segments, use those boundaries as-is. Precise boundaries are established during the subsequent refinement and scene stages.
- Sequences are created before cut determinations. Since only the dialogue summaries are needed, there is no need to wait for cut determinations; rather, the sequences provide context for the cut determinations.
3. Adding Locations and Characters to Cut Determination
In Part 1, cut determination consisted of 1–3 frames, a one-line description based on dialogue, and the scene type. In Part 2, one element was added to both the “inputs” and “outputs.”
- Inputs: Include the title and summary of the sequence to which the cut belongs, a one-minute summary that overlaps with it, and the facial recognition results from Step 1. List the facial recognition results in the order of the frames, such as “Who is in the first frame, who is in the second frame.”
- Information to be included: In addition to the description and type, include location and characters. If a name is identified by facial recognition, use that name; for characters whose names cannot be identified, describe them by their appearance, such as clothing or hairstyle.
- Locations serve as the basis for dividing scenes later on. Points where the location changes are strong candidates for scene breaks.
4. Reorganizing Sequences Based on Cut Decisions (Sequence Adjustment)
Since the initial sequence draft was created based solely on a one-minute summary, the boundaries are rough. Once cut decisions are finalized, review the shot information and reorganize the sequences. This is done in two separate steps.
- Defining Segments (Once per episode): We provide the draft sequence and the cuts for the entire episode (shot descriptions, characters, and dialogue) and receive new segment divisions and titles. I adjust the draft boundaries by moving, merging, or splitting them.
- Detailed Refinement (Once per segment, simultaneously): For each segment, I provide the cuts within it and have the writer rewrite the title and summary. If a segment contains two or more events, I have them split those events within the segment.
5. Grouping Cuts into Scenes Within a Sequence
Once sequences are established, the answer to “How should we divide and analyze 1,200 cuts?” is determined. It becomes the unit of analysis for each sequence. Since the cut points correspond to event boundaries, the context remains intact for each segment.

- Dividing into Scenes (Once per sequence, simultaneously): You provide the sequence summary and the cuts and dialogue within it, and receive the scene’s duration, type, and location. The beginning and end of a scene align with cut boundaries. While sequences are roughly divided into 1-minute units, scenes are aligned with cuts in 0.1-second increments.
- Stitching: Gather the scenes for each sequence in chronological order and assign numbers to the entire episode. Scenes are not merged at sequence boundaries.
- Scene Description (Once per sequence, simultaneously): Write a summary for each scene. The model does not list the characters in the scene; instead, fill in the names using the facial recognition results from Step 1.
There are five types of scenes: main story, recap, preview of the next episode, credits, and commercials. Flashback scenes are not separated but included in the main story. Scenes are divided only where the location or event changes. The four types other than the main story are not mixed but are separated by segment.
Based on the 10 episodes of the drama stored in the development database, 12,540 cuts are organized into 299 sequences and 721 scenes. Each episode contains approximately 1,250 cuts, divided into about 30 sequences and 70 scenes. Of the 2,928 lines of dialogue, 1,808 (about 62%) have names attached to them, with the percentage varying by episode from 31% to 86%.
6. Indexing and Selecting Clips via Queries
This concludes the preparation of the source material. We will use this material to create short-form content.
- Indexing: We vectorize all four units—sequences, scenes, cuts, and lines of dialogue—using Qwen3-Embedding-4B and store them in a single vector repository. For each item, we also store the start and end timestamps, location, and characters.
- Editing: Given a single line of text as a query and a desired duration, the system selects the appropriate scene, cuts out the relevant segments within that scene, and creates a list of clip segments that match the ranking and duration requirements. Instead of using the entire scene, it cuts out only the parts that match the query.
- After reviewing the resulting list on screen and requesting compositing, an MP4 file is generated.
The structure of the index and editing processes is covered in detail in “Building the RAG Pipeline,” while the design of the editing graph is discussed in “Designing a Langgraph-Based Broadcast Workflow.”
Conclusion
Here’s how we addressed the two remaining issues from Part 1.
- Who said it: After segmenting the speaker ID by face, we first confirm the identity using faces from the previous episode, and the model determines the remaining units through three rounds of voting. This face name is linked to character information for cuts and scenes.
- Where to cut: First, episodes are divided into event units; after determining cuts, these units are redefined, and within them, cuts are grouped into scenes based on changes in location.
Since names are currently assigned only when they are certain, the frequency with which names appear in dialogue varies by episode. The system is designed so that the number of faces recognized by the character database increases as more episodes are produced.
Reference Links)
This article presents research results conducted with support from the Ministry of Science and ICT and the National IT Industry Promotion Agency’s “2026 Open-Source AI and Software Development and Utilization Support Project.”