Problem with Video Capture Example

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm

Problem with Video Capture Example

Post by townsend » Tue May 29, 2012 6:47 pm

I'm very interested in the Capture Video sample that comes with LiveCode.
It can be found in ..\RunRev\LiveCode\Resources\Sample Projects\Capture Video.rev

I'm currently using version 4.6.2 on Windows 7.
The problem occurs here, when I try to switch to Windows.
894 capture settings.JPG
894 capture settings.JPG (5 KiB) Viewed 7252 times
Here's the code from the radio button.

Code: Select all

on mouseUp
     hide button "quicktime"
     show group "video for windows"
     set the height of group "preferences" to the formattedHeight of group "preferences" + 25
     closeStack  
     openStack  -- This line Doesn't work
end mouseUp
It get as far as the closeStack line-- which works fine. But that next openStack line never happens.
I've tried a few things, but so far, I can't get this example stack to work in Windows.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Problem with Video Capture Example

Post by Mark » Tue May 29, 2012 11:11 pm

Hi,

What do closeStack and openStack do?

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm

Re: Problem with Video Capture Example

Post by townsend » Wed May 30, 2012 12:22 am

Sorry-- I left out the comments in that code:

Code: Select all

on mouseUp
  -- hide the options that relate only to QuickTime
  hide button "quicktime"
  -- show the video for window settings buttons
  show group "video for windows"
  -- set the height of the group that contains the settings to the amount of space 
  -- the objects in it actually take up plus a margin of 25 pixels
  set the height of group "preferences" to the formattedHeight of group "preferences" + 25
  -- send the closeStack command to this stack to shut down the video grabber
  closeStack
  -- send the openStack command to this stack, which will restart the video grabber
  -- using the new setting - i.e. Video for Windows
  openStack
end mouseUp
It seems in an earlier version of LiveCode the openStack command, immediately after the closeStack, would re-open the stack and reinitialize the video grabber, but for Windows. I've tried to switch the defaults in the preOpenStack but that didn't do anything. And then I did a stack search for "Win32" and there's only that one platform check in the preOpenStack.

So where does the Rev Video Grabber get initialized?

Has anybody been able to get the Video Capture Example to run on Windows 7?

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm

Re: Problem with Video Capture Example

Post by townsend » Thu May 31, 2012 5:30 am

I found one thread with some revealing revVideoGrabber info.
I use revvideograbber in a desktop application and am planning to move it to the web eventually.
There are some peculiarities with revvideograbber that need some attention.

It's a big bummer for our project that QT doesn't work all that well on Windows. It's going to be a lot more complicated to handle the different file types.
And here's another one of those unanswered threads, where the user had to give up on revVideoGrabber.

At this point I can only conclude that it is NOT a viable component, and probably should be removed from the Sample Projects folder and the Dictionary. I hope I'm wrong here. If so-- someone-- tell me you've got the revVideo Grabber working on a Windows machine.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Problem with Video Capture Example

Post by sturgis » Thu May 31, 2012 3:50 pm

Just got it working. First, as someone mentioned, set QT to not load when rev starts. 2nd, edit the stack script and look for where ti sets the hilite of the radio buttons. Set the video for windows to true. Might even disable the other one entirely as I haven't succeeded in getting the qt setup to work.

Save the stack. Close rev, re-open rev. Hit start preview. If it still doesn't work restart windows. Yes really. After restart try again and see if it works. It appears that something is left hanging when the video grabber decides to stop working and the only way i've found to fix it (on those times when its REALLY broken) is to restart windows. However, since removing any chance of QT being involved its been pretty solid for me.

Also I've hard coded the size of the image that is grabbed to match my laptop camera (640x480) Left the preview alone but stretched the window and re-arranged things so that I the image that grabs are sent to is also 640x480. The way it was before the grab was ugly (despite the preview being nice and clear) This way I get what the camera is actually seeing and its clear as a bell.

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm

Re: Problem with Video Capture Example

Post by townsend » Thu May 31, 2012 10:13 pm

Sturgis-- thanks for looking into this-- AND posting detailed instructions on how you revScreenGrabber working.
It appears that something is left hanging when the video grabber decides to stop working and the only way i've found to fix it (on those times when its REALLY broken) is to restart windows. However, since removing any chance of QT being involved its been pretty solid for me.
Removing the qt statmement, revInitializeVideoGrabber short name of this stack,"qt",tRect made a big difference. And like you said, after a re-boot, I got a good preview. But once the Preview is started, the Stop Preview doesn't work. That's just a revStopPreviewingVideo command.

Start & Stop Recording work, but no video is recorded to the AVI file.
It only records audio. Were you able to record video?
893 video capture1.JPG
893 video capture1.JPG (16.67 KiB) Viewed 7176 times
Of the setup buttons the only one that works is the Video Source button.
And like you impled, you can't close the stack and reopen it. It won't work.
You have to close LiveCode completely then reload the stack.

About my previouls statment that the Video Capture example should be removed from the LiveCode installation.
Given the current state of this stack, at best it should be split into multiple examples, one for each OS.
That is if it can be updated to work reliably. Maybe it was written for Windows XP and hasn't been updated since.

Just curious, have any Mac people got this stack working correctly?

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Problem with Video Capture Example

Post by sturgis » Thu May 31, 2012 11:01 pm

Working on a cleaned up version and have things set so that a restart to fix isn't necessary. For some reason the revclosevideograbber that should fire on close stack doesn't. If you execute it from the msg box, poof preview gone.

I'm cleaning things up, removing all the qt stuff and will post a stack here, but it might not be until tomorrow.

As you're looking through the code note that revvideograbsettings when used with vfw apparently does nothing, so settings aren't stored in the property. I have the buttons working now (except for "display") abnd will look at what that one is supposed to do when I get a chance. Either way, lots of stuff can be excised so if/when I get a solid stack working i'll let you know.

Wish I had a mac so I could try things there.

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm

Re: Problem with Video Capture Example

Post by townsend » Fri Jun 01, 2012 4:52 pm

For some reason the revclosevideograbber that should fire on close stack doesn't.
I had a button that didn't work, where I couldn't even change the name, even after re-opening the stack. And-- I've had the whole IDE crash many times. It looks like the Video Grabber easily corrupts something.

I've been trying to isolate Video Grabber operations into individual buttons, with very mixed and intermittent results. It's very frustrating. I'm sure there is a bug in the Video Grabber library somewhere. Sounds like you've made better progress than me. Hopefully you've found a good work around. I'm looking forward to seeing your stack.

Thanks for looking into this. Don't waste to much time on this. I think there is only so much that can be done. We may need to just wait for an update on this library.

PS: I've been using LiveCode for a year now and the IDE has always worked flawlessly,
and continues to do so, as long as I don't use this one library.

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Problem with Video Capture Example

Post by sturgis » Fri Jun 01, 2012 7:18 pm

Got sidetracked with some stuff haven't had a chance to look at it today but will do so this evening when things slow down. And yep, its flawless for me too (for quite a while now through different versions of lc/runrev) except for the video capture stuff.

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Problem with Video Capture Example

Post by Klaus » Sat Jun 02, 2012 12:50 pm

Hi friends,

for a big commercial project we gave up trying to make videograbbing work on Windows WITHOUT QuickTime. :?
And also WITH QuickTime, since we could not make this work either on Windows. :?

Still not sure if this is LiveCode's or Windows fault...


Best

Klaus

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Problem with Video Capture Example

Post by sturgis » Sat Jun 02, 2012 2:10 pm

Yeah, I think I give up on this. Every time it looks like things are working it will suddenly blow chunks and I have to hit it with a hammer to get it working again.

So, who's writing a an external to replace this?

nishkabob
Posts: 1
Joined: Sun Jun 03, 2012 5:12 am

Re: Problem with Video Capture Example

Post by nishkabob » Sun Jun 03, 2012 5:31 am

Hi all-

I'm a total LiveCode newbie, coming from BASIC, HyperCard, FileMaker Pro and VBA a million years ago, and have been using LC a grand total of 2 days.
I'm using a Mac (running Lion, OS X 10.7.4), and I not only was able to get the Video Grabber stack to run, but was also able to modify it a little without killing it! Ultimately, my goal is to deploy on a Windows XP machine, an app that will let me view a preview of the video output from a microscope, click the mouse repeatedly to grab a number of frames, then be able to review those frames, select some and save them as jpg's or even a multi-page pdf. Your discussion of the problems with VFW will be very helpful when I get to the point of trying to shoehorn this thing onto my XP machine. Hope I can help you guys as well…

FWIW, I wanted the preview window to be larger, so I made the stack resizable and enlarged the preview window to 640x480. But when I then tried to grab frames, they looked completely garbled. I had to resize the image window to 320x240 and change line 10 of the Grab Image button to:

Code: Select all

  revVideoFrameImage (width of image 1)/2, (height of image 1)/2,"videoimagedata"
Problem is, now it saves at 320x240 when I want it to save full-sized. Oh well, back to the drawing board…

Marty

Post Reply