예제 #1
0
//
// Load images from network stream, run motion detection, write to MP4 files and trap and print notifications
// WARNING - This example can write lots of files, some large, to /tmp (or wherever configured)
//
int main( int argc, const char *argv[] )
{
    debugInitialise( "example9", "", 0 );

    Info( "Starting" );

    avInit();

    Application app;

    NetworkAVInput input( "input", "rtsp://170.93.143.139:1935/rtplive/0b01b57900060075004d823633235daa" );
    app.addThread( &input );

    MotionDetector motionDetector( "detector" );
    motionDetector.registerProvider( input );
    app.addThread( &motionDetector );

    VideoParms videoParms( 640, 480 );
    AudioParms audioParms;
    VideoRecorder recorder( "recorder" , "/transfer", "mp4", videoParms, audioParms );
    //MovieFileOutput recorder( "recorder" , "/tmp", "mp4", 300, videoParms, audioParms );
    recorder.registerProvider( motionDetector );
    app.addThread( &recorder );

    NotifyOutput notifier( "notifier" );
    notifier.registerProvider( recorder );
    app.addThread( &notifier );

    app.run();
}
예제 #2
0
//
// Run motion detection on a saved file, provide debug images in matrix mode over HTTP
//
int main( int argc, const char *argv[] )
{
    debugInitialise( "example6", "", 5 );

    Info( "Starting" );

    avInit();

    Application app;

    NetworkAVInput input( "input", "/tmp/movie.mp4" );
    app.addThread( &input );

    MotionDetector motionDetector( "modect" );
    motionDetector.registerProvider( input );
    //EventRecorder eventRecorder( "/transfer/ozx" );
    app.addThread( &motionDetector );

    MatrixVideo matrixVideo( "matrix", PIX_FMT_YUV420P, 640, 480, FrameRate( 1, 10 ), 2, 2 );
    matrixVideo.registerProvider( *motionDetector.refImageSlave() );
    matrixVideo.registerProvider( *motionDetector.compImageSlave() );
    matrixVideo.registerProvider( *motionDetector.deltaImageSlave() );
    matrixVideo.registerProvider( *motionDetector.varImageSlave() );
    app.addThread( &matrixVideo );

    Listener listener;
    app.addThread( &listener );

    HttpController httpController( "p8080", 8080 );
    listener.addController( &httpController );

    httpController.addStream( "file", input );
    httpController.addStream( "debug", SlaveVideo::cClass() );
    httpController.addStream( "debug", matrixVideo );
    httpController.addStream( "debug", motionDetector );

    app.run();
}