Jump to content
Bill Gilbert

MOV to AVI or intensity array?

Recommended Posts

For years now in the student labs we've used firewire video cams and the IMAQ 1394 driver to create AVI files which then get read and converted to intensity arrays for motion analysis in a Labview app. The cheap cams are going extinct, and they want to use I-pads to create the videos which are MOV Quicktime format. So far it looks like the I-pad app they want to use can't be made to spit out an uncompressed AVI. So now I need to find out if I can either:

1) automate conversion of an MOV to uncompressed AVI and continue to use our LV analysis app as-is, or

2) find a way to parse a compressed MOV video to a frame-by-frame intensity array, and build that into our LV analysis app.

I am starting to search, but is anybody aware of an existing library or methods so I don't reinvent the wheel?

Thanks,

BG

Edited by Bill Gilbert

Share this post


Link to post
Share on other sites
12 hours ago, Bill Gilbert said:

For years now in the student labs we've used firewire video cams and the IMAQ 1394 driver to create AVI files which then get read and converted to intensity arrays for motion analysis in a Labview app. The cheap cams are going extinct, and they want to use I-pads to create the videos which are MOV Quicktime format. So far it looks like the I-pad app they want to use can't be made to spit out an uncompressed AVI. So now I need to find out if I can either:

1) automate conversion of an MOV to uncompressed AVI and continue to use our LV analysis app as-is, or

2) find a way to parse a compressed MOV video to a frame-by-frame intensity array, and build that into our LV analysis app.

I am starting to search, but is anybody aware of an existing library or methods so I don't reinvent the wheel?

Thanks,

BG

Quite a few NAS boxes do this nowadays automatically with smart folders. As I prescribe to the "if it aint broke, don't fix it" school of laziness I would probably tell IT to get one or make them offer me the service and leave my software alone :D

Share this post


Link to post
Share on other sites

No experience with this, but I have good experience with manually converting video formats using the conversion tools from Pazera. I don't know if they have a command line option, but you could probably also automate it through AutoHotKey for a real hodge-podge of stuff.

Share this post


Link to post
Share on other sites

Will investigate these suggestions, thanks very much! Found a couple of trialware converters yesterday, but neither of them can be called from a command line. Tried one from iSkysoft, and while it did a conversion, it may have also be trying to install some sort of spyware, getting execution notifications now. Maybe they just want it to phone home to indicate who is using it, or...........

Share this post


Link to post
Share on other sites

On linux, avconv is powerful, command line, and options rich. I have used it routinely to create .mov from .wmv, for instance.

For automatic conversion, I imagine one could set up a script which checks for new files in a given folder and initiates conversion after they have stopped growing since longer than N seconds, or something the like. It never occurred to me to stream contents through some pipe for conversion on the fly, but that might be possible too.

If windows is required, short of seeing if something can be run in MinGW/Cygwin, I see that libav provides windows builds, but I haven't looked into operation.

Share this post


Link to post
Share on other sites
4 hours ago, ensegre said:

For automatic conversion, I imagine one could set up a script which checks for new files in a given folder and initiates conversion after they have stopped growing since longer than N seconds, or something the like. It never occurred to me to stream contents through some pipe for conversion on the fly, but that might be possible too.

If windows is required, short of seeing if something can be run in MinGW/Cygwin, I see that libav provides windows builds, but I haven't looked into operation.

The link I posted does exactly this on Windows (though with ffmpeg) and streams the video through a pipe into LabVIEW as YUV binary data, which is then converted on the fly into RGB images.

Share this post


Link to post
Share on other sites

Thanks again all. Following links, I found this thread:

http://forums.ni.com/t5/LabVIEW/Convert-MPEG-to-multiple-JPEGs/td-p/1199703

... where Andrey Dimitriev suggested using Mencoder

https://en.wikipedia.org/wiki/MEncoder 

which apparently uses FFmpeg. I managed to get it to work from the command line in System Exec. It creates an AVI that I can view with various media players, but so far, IMAQ Open AVI.vi chokes on this creation, suggesting that I need a Directx upgrade. I'm in Win7 at Directx v11, so I don't imagine that will do much good.  Now I need to do some more work to find a format that mencoder will create that I can read with labview.

System Exec command line is:

C:\mencoder.exe File-in.mov -ovc raw -nosound  -vf format=yv12 -o File-out.avi

Share this post


Link to post
Share on other sites

Thanks Jordan, but scanning the Handbrake webpage, I see nothing about any command line interface, this needs to be automated without having to use a separate GUI.

Experimenting yesterday, I found Labview will open and read an AVI processed through mencoder using "-ovc labv" instead of "-ovc raw -vf format=yv12". Now the IMAQ Image to Array function chokes on the "invalid image type". I found Get Codec example yesterday, and will put more work into this today. Part of the problem is just my low position on the learning curve, and deciphering the alphabet soup of acronyms. I suspect there is a filter -vf that can force the pixel format into a greyscale format that Image to Array will like, but maybe not.

It may not be necessary, since I think the historical reason that Image to Array and an Intensity Graph was used in our application have become moot. I took over this project about ten years ago, and left it alone, since it worked. Might be time to change that to an IMAQ Image control which displays the images just fine, and in color. Might end up being the easiest path right now.

Share this post


Link to post
Share on other sites

Found the solution, convert in System Exec with Mencoder using "-ovc lavc", then use IMAQ Cast Image after reading an AVI frame in our app. Any of the greyscale options work with Image to Array.

Bingo.

Thanks all!

BG

Share this post


Link to post
Share on other sites

The mencoder lavc codec was compressing the output nicely, but reducing quality visibly. Fiddled around some more, spotted the IYUV string in the Get Codec Names vi, now using "-ovc raw -vf format=IYUV", which produces an uncompressed AVI that Labview can read. The IYUV codec is not show in the list that comes up in "mencoder -ovc help", but works. With the Cast Image in our app, I'm where I need to be.

BG

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.