Compress the output stream..

Hello every body..

I have aproject that use the java applet to transmit a vedio and audio over the internet network to do a video conference application with other applet at another computer at the network..

I want to support the application so that the user that enter the conference can select the bandwidth of the internet he/she use and then accordin to choice i control the quality of the stream transmitted..

So i want any one can help me with any way can be used to reduce the quality( or resolution) of the output stream so the user can be comfortable with the output..

please any one can help me reply to me as fast as can..

I there is no method can be used also reply and say this..

Thanks...

[752 byte] By [shadya] at [2007-10-3 10:39:03]
# 1

Hi,

For audio use GSM codec. It just takes 12kbps of your bandwidth.

For video, if you need "ok" quality with low bandwidth, use H.263 codec and for good quality, but higher bandwidth use JPEG codec. below are complete functions on how to reduce qualities for both codecs (or at least try to). But before you have to create a video Processor (see AVTransmit3.java and AVReceive3.java examples on the net).

private void setReducedJPEGQuality(Processor videoProcessor) {

Control cs[] = videoProcessor.getControls();

QualityControl qc = null;

VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG);

// Loop through the controls to find the Quality control for

// the JPEG encoder.

for (int i = 0; i < cs.length; i++) {

if (cs[i] instanceof QualityControl && cs[i] instanceof Owned) {

Object owner = ((Owned)cs[i]).getOwner();

// Check to see if the owner is a Codec.

// Then check for the output format.

if (owner instanceof Codec) {

Format fmts[] = ((Codec)owner).getSupportedOutputFormats(null);

for (int j = 0; j < fmts.length; j++) {

if (fmts[j].matches(jpegFmt)) {

qc = (QualityControl)cs[i];

qc.setQuality(0.5f);

break;

}

}

}

if (qc != null) {

break;

}

}

}

}

This will reduce your JPEG bandwith to an average of 150kbps, with still a good quality.

private void setReducedH263Quality(Processor videoProcessor) {

Control cs[] = videoProcessor.getControls();

QualityControl qc = null;

BitRateControl brc = null;

FrameRateControl frc = null;

boolean done = false;

//try with bit rate first

for (int i = 0; i < cs.length; i++) {

if(cs[i] instanceof Owned) {

if(cs[i] instanceof BitRateControl) {

brc = (BitRateControl)cs[i];

if(brc.getBitRate()>0) {

brc.setBitRate(30000); done = true;

}

brc = null;

}

}

}

if(done) {

return ;

}

//then look for quality control

for (int i = 0; i < cs.length; i++) {

if(cs[i] instanceof Owned) {

if(cs[i] instanceof QualityControl) {

qc = (QualityControl)cs[i];

if(qc.getQuality()>0.0f) {

qc.setQuality(0.5f);

done = true;

}

qc = null;

}

}

}

if(done) {

return ;

}

//if that did not work, try setting frame rate

for (int i = 0; i < cs.length; i++) {

if(cs[i] instanceof Owned) {

if(cs[i] instanceof FrameRateControl) {

frc = (FrameRateControl)cs[i];

frc.setFrameRate(6.0f);

frc = null;

}

}

}

}

This will reduce your H.263 codec's bit rate to 80kbps. You cannot set less than that. I tried with many webcams and that's the least I could go.

Good luck.

andreyvka at 2007-7-15 6:03:07 > top of Java-index,Security,Cryptography...
# 2
Thanks andy for ur reply i will try use the code u post and then disscuss it with u..But whre i can found the examples u say AVTransmit3.java andAVReceive3.java ?Please give me the urls for them..Thanks again..
shadya at 2007-7-15 6:03:07 > top of Java-index,Security,Cryptography...
# 3
Hi,Im not andy, im andrey :) You can find AVReceive3 and AVTransmit3 in any search engine, like google of yahoo. Just type these names in and click search.
andreyvka at 2007-7-15 6:03:07 > top of Java-index,Security,Cryptography...
# 4
Thanks dor reply andrey ..Sorry, i knew u are andrey but when i write ur name but when wgen i write it on the thread some error heppen so may i delete some of ur name...again sorry....I will search about the files on the internet..
shadya at 2007-7-15 6:03:07 > top of Java-index,Security,Cryptography...
# 5
no problem shady :) I think you already found the links. In case you didnthere's the link http://java.sun.com/products/java-media/jmf/2.1.1/solutions/RTPConnector.html
andreyvka at 2007-7-15 6:03:07 > top of Java-index,Security,Cryptography...