create an avi from an image sequence

   11932   11   1
User Avatar
Member
1145 posts
Joined: July 2005
Offline
I want to create a digital asset that will allow me to convert an image sequence to an .avi movie.
I use Mencoder on the command line for the conversion.

Bringing in the image sequence is easy.

I'd like to attach a button to the Mencoder command, but how do I bring in the command line instructions and then attach the button to it?
“gravity is not a force, it is a boundary layer”
“everything is coincident”
“Love; the state of suspended anticipation.”
User Avatar
Member
398 posts
Joined: July 2005
Offline
icp from Houdini's bin directory as postrender script or as callback on the button. Look at the callback scripts in HDA properties.
f = conserve . diffuse . advect . add

fx td @ the mill
User Avatar
Member
1145 posts
Joined: July 2005
Offline
Yes, I was considering whether a callback would do.

ICP won't do though since it only converts still images.
“gravity is not a force, it is a boundary layer”
“everything is coincident”
“Love; the state of suspended anticipation.”
User Avatar
Member
398 posts
Joined: July 2005
Offline
I've used icp to create AVIs in Windows but I'm not sure about icp for Linux.
f = conserve . diffuse . advect . add

fx td @ the mill
User Avatar
Member
1145 posts
Joined: July 2005
Offline
Really? I'd better take a closer look.

Anyways, attempting the callback using a Button to run a unix command. However the callback is set to use csh commands and I'm using bash (ubuntu).

Now what?
“gravity is not a force, it is a boundary layer”
“everything is coincident”
“Love; the state of suspended anticipation.”
User Avatar
Member
1906 posts
Joined: Nov. 2006
Online
Hey Peter, log on Jabber. I might have an idea.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
387 posts
Joined: July 2005
Offline
probbins
Anyways, attempting the callback using a Button to run a unix command. However the callback is set to use csh commands and I'm using bash (ubuntu)
Hey Pete,

csh or bash shouldn't matter because either will run “mencoder” okay.

Start to build the command up, eg. first of all place a button type in your OTL with the callback being: unix date
Click on the button and you should see the date in the shell where you ran houdini. See that that works first.

adding in use of hscript's “message” is always helpful for callbacks too.

Change the callback now to: message `system(“date”)`

And now, how about this: set cmd=“date”; message `system($cmd)`

From there, it's a matter of changing ‘date’ to be ‘mencoder’ with all the
required mencoder command args, etc. Once it's working, you'd probably
want to change the message to something else, possibly with an option to
cancel/confirm the operation. yada yada. If you have the filenames in
another (invisible?) parm of the OTL you can refer to those via chs().
i hope that's not too cryptic.

Another way to approach this is to write a simple shell script which does
much of what you need to call mencoder - that way you can cut down the
number of args to be passed out from Houdini, and do all the string munging
of filenames etc in the shell script (or a python script!) which in turn calls
mencoder. That reduces the complexity inside your OTL, and eases
future maintenance (because you'll most likely only need to update the shell script).

cheers,
ben.
''You're always doing this: reducing it to science. Why can't it be real?'' – Jackie Tyler
User Avatar
Member
1145 posts
Joined: July 2005
Offline
Thanks Ben,

Good suggestions and I will try them. I had thought about the shell script idea and will probably try it however I wanted to have the functionality embedded in the asset. Can I embed a shell script like you can geometry?

Anyways, GrahamT got excited by the idea and proposed helping me with a python script for this with a follow on task of making a tool shelf asset that includes a bunch of options. So now I have my hooks into him and won't let go, poor boy :twisted:
“gravity is not a force, it is a boundary layer”
“everything is coincident”
“Love; the state of suspended anticipation.”
User Avatar
Member
1390 posts
Joined: July 2005
Offline
ok, it took me two hours. Here is first attempt. I'm putting it here more to hear your comments and suggestions so me or someone else could push it further…

OTL named hpeg which uses ffmpeg and python to do simple job which most of us do normally in post render scripts…

You need ffmpeg from here: http://ffmpeg.mplayerhq.hu [ffmpeg.mplayerhq.hu] in your PATH. Plus Python. Tested only on Win. (Often paths issues appears when switched to Linux…)

Some help in… Help.

hope you'll like it!
cheers,
sy.

PS I realized that it's not so easy to get precomplied ffmpeg. You can get it here:
http://ffdshow.faireal.net/mirror/ffmpeg [ffdshow.faireal.net] for Windows. I think I should let a user make a choice which encoder to use. My choice was just my habit .

Attachments:
Hpeg.v01.otl (7.0 KB)

User Avatar
Member
1145 posts
Joined: July 2005
Offline
Hey, this is great. Hadn't considered making it a Rop.

I was thinking of it as a Cop node, so to convert and input rather than converting an output.

It didn't work for me though.

Since you have an input I had expected it to pick up the Mantra node that I plugged in, but it didn't seem to.

More importantly, ffmpeg and mencoder use a different variable to designate a frame sequence, so I don't think $F will be recognized.

I couldn't see your python code so don't know how you are calling in ffmpeg.

A general concern and limitation that I have been mulling over is that I don't believe either mencoder or ffmpeg recognize the .pic format. The would really put a big dent in the usefulness of a tool like this.

Still, an interesting exercise to explore just how flexible digital assets can be.

thanks for the contribution.
“gravity is not a force, it is a boundary layer”
“everything is coincident”
“Love; the state of suspended anticipation.”
User Avatar
Member
1145 posts
Joined: July 2005
Offline
Doh! never mind:roll:
Csh wasn't installed.
ubuntu 6.10 had it automatically so I never checked. 7.04 didn't have it.


ben simons
probbins
Anyways, attempting the callback using a Button to run a unix command. However the callback is set to use csh commands and I'm using bash (ubuntu)
Hey Pete,

csh or bash shouldn't matter because either will run “mencoder” okay.


Morning Ben,

Actually it does matter. Since the callback is set to send to a csh and I'm using bash I get this error.

Spawn Error: : No such file or directory
Error running csh
Argument list:
0: csh
1: -f
2: -c
3: date
“gravity is not a force, it is a boundary layer”
“everything is coincident”
“Love; the state of suspended anticipation.”
User Avatar
Member
1390 posts
Joined: July 2005
Offline
probbins
Hey, this is great. Hadn't considered making it a Rop.

I was thinking of it as a Cop node, so to convert and input rather than converting an output.


That's clearly good idea, I can add Cop node also, but still you can do it with rop (creating rop for cop network)

It didn't work for me though.
Since you have an input I had expected it to pick up the Mantra node that I plugged in, but it didn't seem to.
What happening? Can you say more on this? Mantra ROP field just takes mantra output (picture) and pipe it in to ffmpeg via expression in FileIn field which can be replaced by any filename on disk. you don't have to use Mantra ROP field. This is my habit to not repeat settings from original ROP but just use it in custom tools. This could be extented to resolution and other setting.

More importantly, ffmpeg and mencoder use a different variable to designate a frame sequence, so I don't think $F will be recognized.

That's why I use python script which generate proper padding format for ffmpeg or mencoder. myfile.$F4.tiff –> myfile.%04d.tiff

I couldn't see your python code so don't know how you are calling in ffmpeg.

Just go to Operator Type Manager and RMB-> Edit content, than select hpeg.py and read code. You should also see the file in your $HIP directory


A general concern and limitation that I have been mulling over is that I don't believe either mencoder or ffmpeg recognize the .pic format. The would really put a big dent in the usefulness of a tool like this.

That's is true. Literally no external application reads pic format… al least available in public domain. That's why most people uses different format whenever they touch houdini renders outside houdini system. Of cource you could (using cop rop) make an option for converting pic to readable format on the fly and than send it to encoder and delete after work. Easilly can be done.

Still, an interesting exercise to explore just how flexible digital assets can be.

yep, as I have such option in render manager (make mpeg and send it via email after render finished for example), this was more an example then anything more.
  • Quick Links