in reply to Re: Windows Webcam access.
in thread Windows Webcam access.

Hi Corion,

I've had a look a VideoMixer, thanks for this. I'm using wxMediaCtrl to output. I've tried streaming FFMPEG to a file (which works) and then opening with wxMediaCtrl, (which doesn't, because the file is opened with an exclusive lock by FFMPEG). I need wxMediaCtrl to be able to work a bit like Youtube with a sliderbar to rewind and play parts of the video, I also want to take snaps and clips and stuff. This is all working if I play an .avi file. However, I've only made it work for a live source with a streaming Server like BraodCam, which degrades the quality as it assumes inet delivery.

Your plan uses standard output and FFMPEG, which seems like a good idea. I think I can make it work with FFMPEG, but what command do you use to stop it?

I've looked through VideoMixer, but I can't see where you stop the streaming process. I'm not familiar with GL, so maybe I just missed it.

Thanks for your help.

regards

Replies are listed 'Best First'.
Re^3: Windows Webcam access.
by Corion (Patriarch) on Sep 01, 2009 at 09:50 UTC

    I simply kill the process upon exit. That's not the most grateful thing but it works:

    package App::VideoMixer::External::FFmpeg; use strict; use vars qw($VERSION); $VERSION = '0.02'; use parent 'Class::Accessor'; __PACKAGE__->mk_accessors(qw(width height depth pid stream texture_id +file pixel_format ffmpeg)); sub spawn { my ($self,$cmd) = @_; my $pid = open my $stream, $cmd or die "Couldn't spawn '$cmd': $!/$?"; binmode $stream; return ($pid,$stream) }; sub DESTROY { if (my $pid = $_[0]->pid) { kill 9, $pid }; };

    This will kill the external process once the object gets destroyed. You can read the data from $stream and you have to set $self->pid to the returned $pid (and looking at this code, I'm not sure why ->spawn does it that way instead of setting $pid instead - I guess it's because I turned a subroutine into an object later).

    As a side note, App::VideoMixer v0.02 is in a sad state, as even the distribution is incomplete, so I'll have to release a fixed version soonish.