Drama Finishing Upscaler (Final Assembly and 1080p Upscaling)
Operation Positioning: Final delivery and quality enhancement step for short dramas. No Generic Fluff: This document does not explain what super-resolution is. It only records multi-segment lossless concatenation syntax, RealESRGAN VRAM batch processing acceleration, and final video physical inspection criteria.
1. Runtime Contract and Input/Output
- Input:
- 8 cleaned segments output from Stage 4:
cleaned_segments/seg01.mp4~seg08.mp4; - Or the final episode with completed side-chain ducked music:
[episode_name]_final_ducked.mp4.
- 8 cleaned segments output from Stage 4:
- Output:
[episode_name]_original_commercial.mp4(832×480 native HD delivery master);[episode_name]_1080p.mp4(1920×1080 cinema-grade super-resolution final);delivery_report.json: Physical parameter validation ledger.
2. Core SOP: Shot-Lossless Concatenation (Zero-Loss Concat)
Hard Rule: Absolutely no re-encoding when concatenating segments! Re-encoding destroys original sharpness and causes additional audio degradation.
2.1 FFmpeg Concat Zero-Loss Seamless Stitch
Generate a temporary concatenation index list and perform stream copy:
# 1. Automatically generate ordered index list
file 'cleaned_segments/seg01.mp4'
file 'cleaned_segments/seg02.mp4'
...
file 'cleaned_segments/seg08.mp4'
# 2. Execute zero-overhead stream copy concatenation
ffmpeg -y -f concat -safe 0 -i concat_list.txt -c copy concat_raw.mp4
- Duration: Stitching all 8 segments takes only 0.2 seconds, preserving every frame's original pixels and audio-video sync losslessly.
3. Core SOP: RealESRGAN 1080p Exclusive Upscaling Acceleration
VRAM Isolation Rule: Before performing 1080p upscaling, GPU VRAM occupied by ComfyUI must be released first, allowing RealESRGAN exclusive access to 16GB VRAM for maximum throughput.
3.1 Industrial Upscaling Inference and Audio Muxing
Invoke scripts/upscale_video.py:
- Model:
RealESRGAN_x2plus.pth; - Precision & Device:
CUDA+FP16half precision; - Batch Size:
batch_size = 4(on RTX 4080 exclusive mode, frame rate stable at ~4.8 frame/s, entire episode of 1400 frames takes about 4.5 minutes); - Audio Protection Mechanism:
Before upscaling, use ffmpeg to losslessly extract the original video's audio track (
audio.m4a). After frame inference, mux it back usinglibx264 -crf 18 -c:a copy, 100% preserving the 90s side-chain intelligent ducked background music and clean dialogue.
Command:
python scripts/upscale_video.py --input raw_video.mp4 --output final_1080p.mp4 --model RealESRGAN_x2plus.pth --width 1920 --height 1080
4. Core SOP: Final Video Dual Physical Inspection
After the final file is written, automated acceptance testing must be performed using ffprobe:
- Resolution strictly met: Width 1920, Height 1080 (fails if not 1080p);
- Frame rate strictly aligned: 24.0 fps standard cinema frame rate;
- Duration strictly aligned: 8 segments × 175 frames = 58.33s ~ 58.35s;
- Audio stream complete: Contains independent stereo audio stream (AAC, sample rate 44.1kHz/48kHz).
5. Dedicated Tool Scripts
- Single-episode 1080p upscale:
python scripts/upscale_video.py --input in.mp4 --output out.mp4 - Batch upscale scheduling for full set:
python scripts/run_episodes_1_to_8_upscale.py