INNER CODE UNIT · Java

rotation

microshow/RxFFmpeg · rxffmpeg/src/main/java/io/microshow/rxffmpeg/AudioVideoUtils.java:142

        String rotation = retr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION); // 视频旋转方向
        retr.release();
        return Integer.parseInt(rotation);
    }

    /**
     * 获取视频时长 单位:秒
     *
     * @param videoPath
     * @return
     */
    public static int getVideoDuration(String videoPath) {
        MediaMetadataRetriever retr = new MediaMetadataRetriever();
        retr.setDataSource(videoPath);
        String rotation = retr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); // 视频时长 毫秒
        retr.release();
        return Integer.parseInt(rotation) / 1000;//转为秒
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…