Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Video Codec Proporties

I am stream video from a s-video CCD camera, overlaying time and other acquired data onto the image (video mixing), and then recording it, and this is all done in real-time. I am really looking for an answer on how I can record compressed video that is very good quality and not enormous (<1GB/hr of video). My current solution is using the DiVX codec to compress the video during recording. The problem is that I need the video with higher quality than the default codec settings (780 kbps) and at 100% quality (according the IMAQ AVI Write.vi). Is there any vi that allows me to go in and access the codec properties? In every other video editing package I have every run across, from the lowest of the low to the best of the best, this is an option for adjusting the quality of video (freeware example: VirtualDub). I find it hard to believe there is nothing like that available in IMAQ or that someone has ever created before. If anyone have any information, PLEASE, PLEASE post it. This question has been eating me for over a year as I've searched 50+ video codecs and tried a multitude of other solutions.
Any help would be greatly appreciated,
 
Josh Meisner
0 Kudos
Message 1 of 12
(5,519 Views)
Josh,

The way NI Vision compresses video is by using the codecs already installed on your system (DivX, Invideo, Microsoft encoders, etc.).  The settings for the codecs will be specific to each one.  Here is a link from our website that talks about how to write compressed video files using our Vision software.  Let me know if it helps.

Writing a Compressed AVI File with IMAQ Vision
http://digital.ni.com/public.nsf/websearch/0A4D5BF47FD3FF0186256E9A004FD671?OpenDocument

Regards,
S. Arves S.
National Instruments
Applications Engineer
Message 2 of 12
(5,507 Views)
Thank you for your response. I've played around with that vi a lot, but the codec settings that are called up by Vision are the default codec settings. Many codecs have a huge range of settings that you can manipulate if the proper encoder properties utility is called up. The defaults for DiVX, Indeo, Microsoft, etc....and 50+ others I have looked cannot provide the compression speed and quality that I really need, unless I can change the encoder properties from the default setting. Please let me know if you have any more thoughts/ideas.
 
Josh Meisner
Texas A&M University
0 Kudos
Message 3 of 12
(5,505 Views)
Hi John,

If you haven't already done so, you might try using the "quality" input on the IMAQ AVI Create.vi to adjust the setting for the compression to something other than the default.  The quality setting is the relative quality of the compression filter (0 to 1000) which defaults to a setting (-1) specifying that the default compression for that codec be used .  One thing to be aware of though is that not all codecs support using different qualities, but it sounds like you have experimented with a lot of different codecs so you should have access to one that does.  Did adjusting this setting give you access to the compression settings you need?

S. Arves S.
National Instruments
Applications Engineer
0 Kudos
Message 4 of 12
(5,494 Views)

S_a_s,

I've tried that before, but there isn't any noticable improvement. By default, I set the quality rating to 1000 for all the codecs I tested. Thanks for your thoughts, please let me know if you have any other thoughts/ideas,

Josh Meisner

0 Kudos
Message 5 of 12
(5,485 Views)
Are you able to get the compression and quality you need if you compress the file outside of LabVIEW?  Setting the quality 1000 should give you the best image quality for that particular codec.
S. Arves S.
National Instruments
Applications Engineer
0 Kudos
Message 6 of 12
(5,471 Views)
The problem is that we have to record for long periods of time (on the scale of hours), so we need to have some form of compression during recording. The optimal quality settings that can still compress on the fly of 25 fps that I've found, i.e. uncompressed or even DV video, record at the 100 MB/min level or higher. After an hour, we just don't have that kind of space. What the filter names.vi does is pull up the default setting. The uncompressed video and DV video, by default, record at VERY high kbps rates. For the other codecs I've played with that meet a minimum standard of compression, their defaults are around 780 kbps (i.e. DiVX). I believe the 1000 quality is a percentage of the default encoding settings (i.e. 780*1000/1000 for a quality of 1000), so even at 1000 the codecs are only saving video at the default 780 kbps setting. What I really need is to be able to open up the codec properties and adjust the saving quality to ~1600 kbps. Nearly all the video editing software programs I have come across have this function (i.e. the open source editor, VirtualDub--see attachment). I've tried calling the different codec creators to see if there's a way to change the default setting in the codec DLL file, but I'd had no luck. So I was wondering if anyone had ever explored the question before and perhaps made a subvi that can call up the codec properties menu. I really appreciate your help and interest. Please let me know if you have anymore thoughts/ideas. Also, please let me know if I can clarify my question any more,
 
Josh Meisner
Biomedical Engineering
Texas A&M University 
0 Kudos
Message 7 of 12
(5,459 Views)
Josh,

If you need more control over the encoder than is provided by the IMAQ AVI functions, I would recommend finding an encoder that supports ActiveX.  LabVIEW can make calls to ActiveX controls and through that you can have much more control over the video encoding features.

Arves

Message Edited by s_a_s on 02-20-2006 09:05 AM

S. Arves S.
National Instruments
Applications Engineer
0 Kudos
Message 8 of 12
(5,435 Views)

S. Avres S,

That is an interesting thought, and I am checking into that with some codecs. Here's a different thought then. Is there a way to output a video stream from IMAQ to another device/software on the computer? I.e. could I send the video stream out an S-video port to be acquired by another computer or could I call up a video capture software to save video from an IMAQ video stream?

0 Kudos
Message 9 of 12
(5,418 Views)
Josh,

That would probably be POSSIBLE, but it would not be easy to route through the S-Video and it's not really in my area of expertise.  Outputting the image information to another software can be a bit tricky and will require you to use the Get Pixel Pointer VI to pass the pointer to the pixel array for each image.  The processing time should be minimal, but if you are working with high frame rates and processing the image data, there might be some latency included in the process.

Arves
S. Arves S.
National Instruments
Applications Engineer
0 Kudos
Message 10 of 12
(5,407 Views)