Thinkbox Software 製品
ブログ

動画のエンコーディングを変更

動画のエンコーディングを変更します。

 

記述例:

動画のエンコーディングをH264へ変更し保存します。
# -*- coding: UTF-8 -*-
import Draft   # DRAFTのAPIのインポート

image = Draft.Image.CreateImage( 1, 1 )   # 初期イメージ作成
decoder = Draft.VideoDecoder( ‘clip.mov’ )  # ビデオデコーダを初期化
hasFrames = decoder.DecodeNextFrame( image )  # 動画よりフレーム画像を抽出

if hasFrames:

encoder = Draft.VideoEncoder( ‘clip.mov’, codec=’H264′ )        # ビデオエンコーダを初期化

while hasFrames:

encoder.EncodeNextFrame( image )   # フレーム画像をエンコード
hasFrames = decoder.DecodeNextFrame( image ) # 動画よりフレーム画像を抽出

encoder.FinalizeEncoding()    # 動画のファイナライズ