This discussion is archived
0 Replies Latest reply: Sep 11, 2012 11:26 AM by 961456 RSS

Frame Rate Control

961456 Newbie
Currently Being Moderated
Hello everybody, I'm trying to set the frame rate to stream video from my camera, but I couldn't. I try creating a realized Processor and then getting the controls and setting the Frame Rate, no success, example 1:

Example 1

ProcessorModel model = new ProcessorModel( camara , fmts , new ContentDescriptor( ContentDescriptor.RAW_RTP ) );      
     processor = Manager.createRealizedProcessor( model );
     Control[] controls = processor.getControls();
     for( int i = 0 ; i < controls.length ; i++ ){
          if( controls[i] instanceof FrameRateControl ){
               FrameRateControl frc = (FrameRateControl)controls;
               //System.out.println( frc.getFrameRate());
               System.out.println("Output frame rate: "+ frc.setFrameRate(1));
          }
          
          
     }

And then trying to set the Frame Rate before calling realize method, example 2:

TrackControl[] tracks = processor.getTrackControls();
     for( int i = 0 ; i < tracks.length ; i++ ){
          if( tracks[i].getFormat() instanceof VideoFormat ){
          
               tracks[i].setEnabled( true );
               Codec codecs[] = new Codec[1];
               Vector secondcodecs = PlugInManager.getPlugInList( tracks[i].getFormat() , new VideoFormat( fmt ) , PlugInManager.CODEC );
               
               String cname2 = secondcodecs.elementAt(0).toString();
               Class<?> c2 = Class.forName( cname2 );
               codecs[0] = (Codec)c2.newInstance();
               
               tracks[i].setCodecChain(codecs);
          
          }
     }
     Control controls[] = processor.getControls();
     for( int i = 0 ; i < controls.length ; i++ ){
          if( controls[i] instanceof FrameRateControl ){
               FrameRateControl frc = (FrameRateControl)controls[i];
               System.out.println( frc.getFrameRate());
               System.out.println("Output frame rate: "+ frc.setFrameRate(15));
          }
          
     }
     realizeProcessor( processor );

This one doesn't work neither.

Thanks for your help.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points