Rendering/codecExamples.py

Rendering/codecExamples.py
1 # Copyright 2009 Autodesk, Inc. All rights reserved.
2 # Use of this software is subject to the terms of the Autodesk license agreement
3 # provided at the time of installation or download, or which otherwise accompanies
4 # this software in either electronic or hard copy form.
5 #
6 # Script description:
7 # Shows how to specify codec and pop codec selection dialog.
8 #
9 # Topic: FBVideoCodecManager, FBVideoGrabber
10 #
11 from pyfbsdk import *
12 import sys
13 
14 try:
15  mgr = FBVideoCodecManager()
16  # By specifying Codec stored, the first time we render a scene, the codec dialog
17  # will ve available if user press con configure
18  # the second time a scene is rendered, the same settings will be used.
19  mgr.VideoCodecMode = FBVideoCodecMode.FBVideoCodecStored
20 
21  # Will print the list of all available codec id
22  print mgr.GetCodecIdList( "AVI" )
23 
24  # Get the current default codec id for AVI file
25  print mgr.GetDefaultCodec( "AVI" )
26 
27  lApp = FBApplication()
28  lOptions = FBVideoGrabber().GetOptions()
29  # render first time: user can specify rendering params
30  lOptions.OutputFileName = "c:/ouput_1.avi"
31  lApp.FileRender( lOptions )
32 
33  # render second time: the same params are used for rendering
34  lOptions.OutputFileName = "c:/ouput_2.avi"
35  lApp.FileRender( lOptions )
36 
37 except Exception, e:
38  # Unkown error encountered... Maybe from the 'listdir' call failing...
39  FBMessageBox( "ERROR", "Unknown error encountered. Aborting! " + str(e), "OK", None, None )