Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Feb 2004
    Messaggi
    724

    [java] jmf acquisizione video

    vorrei acquisire un video da una webcam o telecamera e salvarli in un file...
    ho trovato la jmf ma nn so come utilizzarla, avete qualche dritta esempi o cos'altro?
    grazie

  2. #2
    Utente di HTML.it
    Registrato dal
    Feb 2004
    Messaggi
    724
    ho trovato questo codice per acquisire audio video e salvarlo su file ma nn so come inserirlo nel progetto, cioè se va bene così com'è o ha bisogno di altro... Avete qualche idea?

    codice:
    Format formats[] = new Format[2];
    formats[0] = new AudioFormat(AudioFormat.IMA4);
    formats[1] = new VideoFormat(VideoFormat.CINEPAK);
    FileTypeDescriptor outputType =
    new FileTypeDescriptor(FileTypeDescriptor.QUICKTIME);
    Processor p = null;
    try {
    p = Manager.createRealizedProcessor(new ProcessorModel(formats,
    outputType));
    } catch (IOException e) {
    System.exit(-1);
    } catch (NoProcessorException e) {
    System.exit(-1);
    } catch (CannotRealizeException e) {
    System.exit(-1);
    }
    // get the output of the processor
    DataSource source = p.getDataOutput();
    // create a File protocol MediaLocator with the location
    // of the file to
    // which bits are to be written
    MediaLocator dest = new MediaLocator("file://foo.mov");
    // create a datasink to do the file writing & open the
    // sink to make sure
    // we can write to it.
    DataSink filewriter = null;
    try {
    filewriter = Manager.createDataSink(source, dest);
    filewriter.open();
    } catch (NoDataSinkException e) {
    System.exit(-1);
    } catch (IOException e) {
    System.exit(-1);
    } catch (SecurityException e) {
    System.exit(-1);
    }
    // now start the filewriter and processor
    try {
    filewriter.start();
    } catch (IOException e) {
    System.exit(-1);
    }
    p.start();
    // stop and close the processor when done capturing...
    // close the datasink when EndOfStream event is received...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.