LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

avi compressor names

Hi,

 

So run the avi codec compression vi. to see what codecs I could use to compress my .avi file. My understanding is to use s string of the codec name to the codec name on the create .avi function. However, when I do that for any of the codecs shown below, I get an error saying unknown codec, anyone know how to fix this? 

Download All
0 Kudos
Message 1 of 8
(2,346 Views)

That avi codec compression vi does it show raw names?

Try to use Imaq avi get codec names (http://www.ni.com/tutorial/14466/en/) and index element. 

Open that example, check how they are doing, if there are differencies. It should work - example is writing to avi. 

0 Kudos
Message 2 of 8
(2,319 Views)

Hey Alexander, 

 

So I run the Get AVI Codec Names and still ended up with the same names as before save 2. I tried them but still unknown error with unknown codec name.

0 Kudos
Message 3 of 8
(2,305 Views)

I always use "Motion JPEG (NI VISION)", and it always works for me.  What version of LabVIEW do you have?  What version of the Vision Development Module and the Vision Acquisition Software do you have?  Are they activated?  [Oops, if you can get the list of Codecs, then you must be using Vision Software ...[

 

Bob Schor

0 Kudos
Message 4 of 8
(2,271 Views)

Hey there Bob,

 

When you say you use "Motion JPEG (NI VISION)", you mean you literally connect that as a string to the Compression Filter terminal  of the .avi create function like attached, correct? I have 2019 version of LabVIEW, and I am pretty sure I have the latest version of the Development module (not sure how to check for that). I tried the Motion JPEG (NI VISION) but didn't work either BTW; it threw me an unknown codec error like the one I showed before.

0 Kudos
Message 5 of 8
(2,246 Views)

You have provide only limited pictures (there's so much more information available to us to help you if you attach your VI or the entire Project, zipped up by compressing the folder containing all the VIs) of your code, plus no information about the camera nor a screen shot of MAX showing (a) the Devices and Interfaces, and (b) the Software (including IMAQdx and related Vision software).

 

Well, this "picture" is from code that works very well with an AXIS camera (certified to work with IMAQdx).Opening an AVIOpening an AVI

Your code doesn't work.  It is either "hardware", "software", or you forgot to plug it in.  If you cannot provide more information to help us understand why it doesn't work for you, then I'd advise you to hire a LabVIEW expert with experience in NI Vision to come to your site and provide the help you need.

 

Bob Schor

0 Kudos
Message 6 of 8
(2,230 Views)

Hey Bob,

 

I attached the VI I am currently working on, as of now I am using my Microsoft surface's camera, I will use a different camera later as the project nears completion. I am fairly new to posting on these forums and using the Vision Development module so please forgive my shortcomings. I believe I using the 2019 version of the Vision Software. Please let me know if you have any other questions to clarify things up. Thanks!

0 Kudos
Message 7 of 8
(2,222 Views)

Thank you for attaching your VI.  It has a whole lot of errors that make it not work.  I am pasting a Snippet of working code in LabVIEW 2018, as well at attaching the LabVIEW 2018 version.  I've been trying for many months to get LabVIEW 2019 installed (without killing my earlier versions), and only have it working on my home laptop (I'm currently at work -- I'll have to test at home this evening), but there's a possibility that IMAQdx doesn't work in LabVIEW 2019.

 

Here's the Code That Works.  I'll go through the numerous changes I made.BS Image and StorageBS Image and Storage

  • The Wires were straightened, especially the Error Line, and the functions "straightened up".
  • You (correctly) got the names of the AVI Codecs, which are strings.  You failed to copy the String name, hence kept getting the "Invalid Codec" message.  You could have used Index Array with index 4 to get the right Codec, "Motion JPEG (NI Vision)", and then done a "Is Equal?" comparison with your String (and found a False), but you didn't.
  • You had an unnecessary "Wait (ms)" function with a 10 msec Wait inside the While Loop.  The IMAQdx Grab will "clock" the loop for you at a rate close to 30 FPS = 33 msec.
  • The logic for Stopping the loop was convoluted.  You might not know (it's been a feature for at least the last 5-6 years) that the Error Line can be wired directly into a Boolean function without needing to break out Status.  A much more direct way to stop a While loop is "Stop on Error OR Stop button", much more logical than "Continue on (Error NOR Stop Button)". 
  • After making all of these changes, I was still getting the "Incorrect Codec" error.  I'd previously tested that the code without the AVI functions worked fine (I could Grab and see images that looked very reasonable, so I took a closer look at the functions you were using.
  • Where did you get the code you posted?  I'm guessing that you didn't write it, but copied it from somewhere, maybe a very old example from the LabVIEW Forums, from the Web, or possibly from LabVIEW Examples.  I believe the AVI2 functions (and Codecs) were introduced in LabVIEW 2013, and are the functions you need to use -- I don't know that NI is supporting the (now obsolete?) AVI functions, which are what you are using.  The functions shown here are IMAQ AVI2 Create, IMAQ AVI2 Write Frame, and IMAQ AVI2 Close.
  • This VI created an AVI from the Webcam at about 25 fps.  I suspect if I moved the Image Display and AVI Write out of the loop and adopted a Producer/Consumer Pattern, I might have gotten 30 fps.

I believe this "solves" your posted question, and maybe provides some useful "Style" tips for writing LabVIEW code.  It is also extremely important when dealing with Strings to get the spelling, the spacing, and the capitalization exactly right.  [Why NI doesn't provide Enums for the Codecs, I don't quite understand ...].

 

Bob Schor 

 

0 Kudos
Message 8 of 8
(2,193 Views)