On 02/12/2014 at 01:48, xxxxxxxx wrote:
Hi,
I want to generate preview of my .c4d file in any video format like .avi , .mp4 etc using python for my plugin. How can i do that?
Thanks
Nishant
On 02/12/2014 at 01:48, xxxxxxxx wrote:
Hi,
I want to generate preview of my .c4d file in any video format like .avi , .mp4 etc using python for my plugin. How can i do that?
Thanks
Nishant
On 02/12/2014 at 02:59, xxxxxxxx wrote:
Hello,
you can use RenderDocument() to render single frames or a whole frame sequence of a given document. You can save the images or videos in the formats supported by your system. See this list of available formats.
# get render data
doc = documents.GetActiveDocument()
rd = doc.GetActiveRenderData().GetData()
# prepare bitmap
xres = int(rd[c4d.RDATA_XRES])
yres = int(rd[c4d.RDATA_YRES])
bmp = bitmaps.BaseBitmap()
bmp.Init(x=xres, y=yres, depth=24)
# set render data
rd[c4d.RDATA_MULTIPASS_ENABLE] = False
rd[c4d.RDATA_PROJECTFILE] = False
# sava as...
rd[c4d.RDATA_GLOBALSAVE] = True
rd[c4d.RDATA_SAVEIMAGE] = True
rd[c4d.RDATA_FORMAT] = c4d.FILTER_MOVIE # save as Quicktime movie
# preview range
rd[c4d.RDATA_FRAMESEQUENCE] = c4d.RDATA_FRAMESEQUENCE_MANUAL
rd[c4d.RDATA_FRAMEFROM] = c4d.BaseTime(0)
rd[c4d.RDATA_FRAMETO] = c4d.BaseTime(1)
# get target path
path = c4d.storage.SaveDialog(title="Save preview")
rd.SetFilename(c4d.RDATA_PATH,path)
# render
res = documents.RenderDocument(doc, rd, bmp, c4d.RENDERFLAGS_EXTERNAL | c4d.RENDERFLAGS_NODOCUMENTCLONE)
Best wishes,
Sebastian
On 12/12/2014 at 07:02, xxxxxxxx wrote:
Hello Nishant,
was your question answered?
best wishes,
Sebastian
On 16/12/2014 at 03:27, xxxxxxxx wrote:
Hi Sebastian,
I was trying the above code but the result is always a 0 byte file. I am looking into it.
Thanks
Nishant
On 17/12/2014 at 04:54, xxxxxxxx wrote:
Hello,
be aware that you must have Quicktime installed on your system to save Quicktime movies.
Best wishes,
Sebastian
On 29/12/2014 at 02:55, xxxxxxxx wrote:
Hi,
I am able to generate preview in .avi format using above code but the size of the file being generated after rendering process is very large.
We can compromise the quality of the preview. Is there any way to decrease the time of rendering and more importantly the size of the final preview.
Thanks
Nishant
On 29/12/2014 at 09:32, xxxxxxxx wrote:
Hello,
the size of the file depends on the used codec and other file settings. In case of AVI you must set the
corresponding AVI parameters. You find some example how to get these parameters in this thread.
The video settings must be saved in the RenderData's RDATA_SAVEOPTIONS subcontainer.
Best wishes,
Sebastian