Package ca.carleton.gcrc.olkit.multimedia.ffmpeg

Examples of ca.carleton.gcrc.olkit.multimedia.ffmpeg.VideoInfo


    if( null == progress ) {
      progress = MultimediaConversionProgressNull.getSingleton();
    }
   
    // Get information about video
    VideoInfo videoInfo = null;
    {
      FFmpeg ffmpeg = new FFmpeg();
      videoInfo = ffmpeg.getVideoInfo( inFile );
    }
   
    // Check if conversion is required
    boolean conversionRequired = false;
    if( null == videoInfo.bitRate ) {
      conversionRequired = true;
    } else if( videoInfo.bitRate.intValue() > 250000 ) {
      conversionRequired = true;
    }
    if( false == "h264".equals( videoInfo.videoCodec ) ) {
      conversionRequired = true;
    }
    if( false == "mpeg4aac".equals( videoInfo.audioCodec ) ) {
      conversionRequired = true;
    }
   
    // Report length and dimensions
    request.setInDurationInSec( videoInfo.durationInSec );
    request.setInHeight(videoInfo.height);
    request.setInWidth(videoInfo.width);
   
    if( false == conversionRequired ) {
      // Conversion not required, converted file is the uploaded file
      request.setOutFile(inFile);
      progress.updateProgress(100);
    } else {
      File outFile = request.getOutFile();
      if( null == outFile ) {
        File parentDir = inFile.getParentFile();
        outFile = File.createTempFile("conv", ".mp4", parentDir);
      }
     
      FFmpeg ffmpeg = new FFmpeg(progress);
      ffmpeg.convertVideo(videoInfo, outFile);
     
      request.setOutFile(outFile);
      request.setConversionPerformed(true);

      VideoInfo outVideoInfo = ffmpeg.getVideoInfo( outFile );
      request.setOutDurationInSec( outVideoInfo.durationInSec );
      request.setOutHeight(outVideoInfo.height);
      request.setOutWidth(outVideoInfo.width);
    }
   
View Full Code Here


    if( null == progress ) {
      progress = MultimediaConversionProgressNull.getSingleton();
    }

    // Get information about audio
    VideoInfo audioInfo = null;
    {
      FFmpeg ffmpeg = new FFmpeg();
      audioInfo = ffmpeg.getVideoInfo( inFile );
    }
   
    // Check if conversion is required
    boolean conversionRequired = false;
    if( null == audioInfo.bitRate ) {
      conversionRequired = true;
    } else if( audioInfo.bitRate.intValue() > 250000 ) {
      conversionRequired = true;
    }
    if( false == "mpeg4aac".equals( audioInfo.audioCodec ) ) {
      conversionRequired = true;
    }

    // Report length and dimensions
    request.setInDurationInSec( audioInfo.durationInSec );
   
    if( false == conversionRequired ) {
      // Conversion not required, converted file is the uploaded file
      request.setOutFile(inFile);
      progress.updateProgress(100);
    } else {
      File outFile = request.getOutFile();
      if( null == outFile ) {
        File parentDir = inFile.getParentFile();
        outFile = File.createTempFile("conv", ".mp4", parentDir);
      }

      FFmpeg ffmpeg = new FFmpeg(progress);
      ffmpeg.convertAudio(audioInfo, outFile);
     
      request.setOutFile(outFile);
      request.setConversionPerformed(true);

      VideoInfo outAudioInfo = ffmpeg.getVideoInfo( outFile );
      request.setOutDurationInSec( outAudioInfo.durationInSec );
      request.setOutHeight(0);
      request.setOutWidth(0);
    }
  }
View Full Code Here

    }
  }
 
  private void convertVideo() throws Exception {
    // Get information about video
    VideoInfo videoInfo = null;
    {
      FFmpeg ffmpeg = new FFmpeg();
      videoInfo = ffmpeg.getVideoInfo( fileInfo.getUploadedFile() );
    }
   
View Full Code Here

    }
  }
 
  private void convertAudio() throws Exception {
    // Get information about audio
    VideoInfo audioInfo = null;
    {
      FFmpeg ffmpeg = new FFmpeg();
      audioInfo = ffmpeg.getVideoInfo( fileInfo.getUploadedFile() );
    }
   
View Full Code Here

TOP

Related Classes of ca.carleton.gcrc.olkit.multimedia.ffmpeg.VideoInfo

Copyright © 2018 www.massapicom. 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.