Yes, I agree that this should work (pending the typo). Daniel's code should
work in both 1.8 and 2.0.
But just for the sake of explanation, the addition with 2.0 is that --
optionally -- it also supports the following slightly nicer syntax:
# 1.x or 2.x
src_buf.reset(sourcefile, subimage=frame)
out_buf = oiio.ImageBuf()
oiio.ImageBufAlgo.colorconvert(out_buf, src_buf, 'INSPACE', 'OUTSPACE')
# 2.x only
src_buf.reset(sourcefile, subimage=frame)
out_buf = oiio.ImageBufAlgo.colorconvert(src_buf, 'INSPACE', 'OUTSPACE')
There's no longer a need to initialize an empty ImageBuf and then pass it as a
destination to colorconvert; a second version of colorconvert exists that just
directly returns the constructed and converted buffer.
Now then, I think Mate Birkas was right in his initial assessment that oiiotool
was trying to load all frames of the animation in memory at once. I think you
may still be able to use oiiotool for this job, with a slightly different
formulation of the problem, though:
# Find out how many frames there are:
oiiotool --info test.mov
# For the sake of argument, let's say it reports 12000 subimages (frames)
oiiotool --frames 0-12000 test.mov --subimage "{FRAME_NUMBER"}
-colorconvert inspace outspace -o "test.#.exr"
to be clear, inspace and outspace should be the names of your from/to color
spaces that OCIO knows about.
Any time you see {}, it is something that oiiotool will substitute by
evaluating the contents between the braces. And it knows the special variable
FRAME_NUMBER.
I think this does what you originally wanted, but by looping one frame at a
time over the whole read/convert/write loop, rather than trying to read all the
frames into memory at once.
> On Apr 2, 2019, at 5:40 AM, Daniel Flehner Heen <[email protected]>
> wrote:
>
> Hi, Mate!
>
> In python and OIIO 1.8.x you could do something like this:
> ####
> import OpenImageIO as oiio
>
> sourcefile = 'your_prores.mov'
> src_buf = oiio.ImageBuf(sourcefile)
>
> for frame in range(src_buf.nsubimages):
> src_buf.reset(sourcefile, subimage=frame)
> out_buf = oiio.ImageBuf()
> oiio.ImageBufAlgo.colorconvert(out_buf, 'INSPACE', 'OUTSPACE')
> out_buf.write('/some/path/filename.{0:04d}.exr'.format(frame))
> ####
>
> Just replace INSPACE and OUTSPACE with something useful.
> I think the syntax has changed a bit in oiio2.x but you should be able to
> port I guess.
>
> On Tue, Apr 2, 2019 at 1:47 PM Mate Birkas <[email protected]
> <mailto:[email protected]>> wrote:
> Dear OIIO Devs,
>
> since this is my first post here, I would like to thank you for this superb
> tool!
>
> I'm building a VFX pipeline and I need to convert ProRes 4444 files to exr
> sequences. FFmpeg does the job, but color management is not very well
> documented, OpenColorIO is not supported and I could not even get a
> intermediate TIF sequence that I can convert to EXR with a color output that
> I can control with consistently. So I tried to use oiiotool for the job, but
> when I run
>
> `oiiotool test.mov -sisplit -o:all=1 test.%d.exr`
>
> oiiotool hangs. It loads all the CPUs to 100% (mostly waiting for io) and
> starts to fill the RAM, rather slowly. My uneducated guess is that oiio
> uncompresses all the subimages to RAM before it writes them out to disk. Even
> if my assumption is right it is prohibitively slow, so slow in fact that I
> didn't even have the time yet to test my theory. (My 516 frames long 2K test
> file is running for 35 minutes now)
>
> My question is that is this the intended behavior (for now of course) or I'm
> doing something wrong? Could it be a problem with my build (oiio 2.0.7, gcc
> 8.2.1, ffmpeg 4.1.1, Arch Linux)? If oiiotool is not production ready in this
> sense, then maybe you have some information on integrating ffmpeg into an
> ocio pipeline, and you can point me to the right direction, which I would
> really appreciate.
>
> Tanks a lot,
> Mate Birkas
> _______________________________________________
> Oiio-dev mailing list
> [email protected] <mailto:[email protected]>
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
> <http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org>
>
>
> --
> -Daniel
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
--
Larry Gritz
[email protected]
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org