Search in sources :

Example 1 with MediaAnalyzer

use of org.opencastproject.inspection.ffmpeg.api.MediaAnalyzer in project opencast by opencast.

the class MediaInspector method getFileMetadata.

/**
 * Asks the media analyzer to extract the file's metadata.
 *
 * @param file
 *          the file
 * @return the file container metadata
 * @throws MediaInspectionException
 *           if metadata extraction fails
 */
private MediaContainerMetadata getFileMetadata(File file, boolean accurateFrameCount) throws MediaInspectionException {
    if (file == null)
        throw new IllegalArgumentException("file to analyze cannot be null");
    try {
        MediaAnalyzer analyzer = new FFmpegAnalyzer(accurateFrameCount);
        analyzer.setConfig(map(Tuple.<String, Object>tuple(FFmpegAnalyzer.FFPROBE_BINARY_CONFIG, ffprobePath)));
        return analyzer.analyze(file);
    } catch (MediaAnalyzerException e) {
        throw new MediaInspectionException(e);
    }
}
Also used : MediaInspectionException(org.opencastproject.inspection.api.MediaInspectionException) MediaAnalyzer(org.opencastproject.inspection.ffmpeg.api.MediaAnalyzer) MediaAnalyzerException(org.opencastproject.inspection.ffmpeg.api.MediaAnalyzerException)

Aggregations

MediaInspectionException (org.opencastproject.inspection.api.MediaInspectionException)1 MediaAnalyzer (org.opencastproject.inspection.ffmpeg.api.MediaAnalyzer)1 MediaAnalyzerException (org.opencastproject.inspection.ffmpeg.api.MediaAnalyzerException)1