Hi Larry,
thank you for your advices. Since yesterday I've made AG Vic able to
send the same video stream at two different bit rates to two different
multicast group under Linux with any driver by duplicating the file
descriptor associated to the driver with the "dup" system call and by
associating it with a second grabber.
Unfortunately this is a unix system call and I don't know how to do the
same with windows. Maybe an OpenMash member know how to duplicate a file
descriptor under windows?
Aurélien
Lawrence A. Rowe wrote:
> Aurelien Amacker wrote:
>
>>Hi,
>>
>>does anyone knows if it's possible to hack OM Vic or AG Vic in a way
>>that it can send the same video streams at two different bit rates (one
>>low and one high) to two multicast groups?
>>
>>I've modified AG Vic in order to do that but the problem is that there
>>is two open() on the same video driver, and the X11 driver is the only
>>one to allow that.
>>
>>Thanks for any idea
>>
>>Aurélien
>
> ---
>
> yes, it will take some effort but you should be able to do it. you will
> need to modify the VideoAgent and the VideoPipe classes written in otcl
> and the video-device*.cc abstractions written in c++ to support a
> command to split a captured stream and call more than one encoder
> class. if you look in a specific video grabber (e.g., video-v4l.cc:834)
> you will see that the grab method copies the image to a YuvFrame and
> then calls the encoder using code like:
> target_->recv (&f);
> where target_ points at the encoder object and recv is the method called
> when an object wants to pass along data to another object. in the
> current code, the encoder is setup by the VideoPipe class when vic does
> a transmit operation.
>
> what you need to do is modify the target_ slot to be a list of encoders
> to which the captured image should be passed. and, you will likely need
> to replicate the YuvFrame being passed. just clone the existing
> instance.
>
> you will need to setup some protocol/code to allocate a second encoder
> and link it into the VideoCapture device abstraction. I suspect this
> should be done in VideoAgent but I know it will take changes to
> VideoPipeline as that is where the encoder object is created. you can
> configure that encoder with whatever parameters you want (e.g.,
> different format, quality, bitrate, etc.). if you want a different
> frame size or a different frame rate, you will need to implement that in
> the grab routine.
>
> lastly, you will need to setup a different network session to which the
> encoder should send the encoded packets. i am pretty sure the network
> code can support multiple open multicast sessions (right andrew?), but i
> don't know what the abstractions are for openning sessions and binding
> them to the encoder. although, the binding is done using the same
> mechanism as the binding between capture objects and encoders. if you
> look at the h261 encoder (i.e., encoder-h261.cc:675) you will see code
> like:
> target = target_list_->first_;
> while (target != NULL) {
> pb->attach();
> target->recv(pb);
> target = target->next();
> }
> pb->release();
> this sends the packet (pb) to several sessions -- see the call on
> target->recv which is similar to the call above.
>
> so, this is do-able, but it will take some work. and, you should try to
> generalize it so it is possible to support this function with many
> different capture devices.
> Larry