: Ensures the video file is properly closed and playable.
import Draft from Draft import VideoEncoder, VideoDecoder # 1. Define Input and Output Paths # Assuming the file is named RTS0064.mp4 inFilePath = "C:/path/to/RTS0064.mp4" outFilePath = "C:/path/to/RTS0064_Burned.mp4" # 2. Open the input video decoder = VideoDecoder(inFilePath) # 3. Create the encoder with the same codec settings # Using h.264 for high compatibility encoder = VideoEncoder(outFilePath, decoder.width, decoder.height, decoder.fps) # 4. Iterate through frames, burn in timecode, and write to new file for frame in range(decoder.frameCount): frameImg = decoder.GetFrame(frame) # Optional: Draw Timecode # Draft.Image.DrawTimecode(frameImg) # Write the frame to the new video encoder.EncodeFrame(frameImg) # 5. Finalize the video encoder.Finalize() print(f"Processed video saved to: {outFilePath}") Use code with caution. Copied to clipboard Key Components : Reads the input .mp4 file ( RTS0064.mp4 ).
If you can tell me what specifically you want to do with the .mp4 (e.g., add a slate, burn in a specific timecode, or combine it with other files), I can customize this script for you. RTS0064 mp4
: Creates the output video file, preserving original resolution and FPS.
: Allows for annotations such as timecode burn-ins (TC). : Ensures the video file is properly closed and playable
This write-up describes the use of the Draft Python API to process an .mp4 video file (e.g., RTS0064.mp4 ). Draft is commonly used in VFX pipelines for creating quicktimes, burning in timecodes, and slate generation from rendered frames. Draft Script Write-up: RTS0064_Process.py
This script takes an existing RTS0064.mp4 video, burns in the timecode, and saves it with a new filename. Open the input video decoder = VideoDecoder(inFilePath) # 3
NOOB question - simple h.264 encoding - Draft - Thinkbox Forums