Examples of IMediaReader


Examples of com.xuggle.mediatool.IMediaReader

    File outputFile = new File(args[1]);

    // create a media reader and configure it to generate BufferImages

    IMediaReader reader = ToolFactory.makeReader(inputFile.toString());
    reader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);

    // create a writer and configure it's parameters from the reader
   
    IMediaWriter writer = ToolFactory.makeWriter(outputFile.toString(), reader);

    // create a tool which paints video time stamp into frame

    IMediaTool addTimeStamp = new TimeStampTool();

    // create a tool which reduces audio volume to 1/10th original

    IMediaTool reduceVolume = new VolumeAdjustTool(0.1);

    // create a tool chain:
    //   reader -> addTimeStamp -> reduceVolume -> writer

    reader.addListener(addTimeStamp);
    addTimeStamp.addListener(reduceVolume);
    reduceVolume.addListener(writer);

    // add a viewer to the writer, to see media modified media
   
    writer.addListener(ToolFactory.makeViewer());

    // read and decode packets from the source file and
    // then encode and write out data to the output file
   
    while (reader.readPacket() == null)
      do {} while(false);
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.