Java 音视频处理库 JAVE 使用示例:获取音频和视频属性
这段代码示例展示了如何使用 JAVE 库获取音频和视频文件的属性信息,包括编码格式、比特率、声道数、采样率等。
MultimediaObject inputFile = new MultimediaObject(new File(inputFilePath));
AudioAttributes audio = new AudioAttributes();
audio.setCodec(inputFile.getAudio().getCodec());
audio.setBitRate(inputFile.getAudio().getBitRate());
audio.setChannels(inputFile.getAudio().getChannels());
audio.setSamplingRate(inputFile.getAudio().getSamplingRate());
VideoAttributes video = new VideoAttributes();
video.setCodec(inputFile.getVideo().getCodec());
video.setBitRate(inputFile.getVideo().getBitRate());
video.setFrameRate(inputFile.getVideo().getFrameRate());
video.setSize(inputFile.getVideo().getSize());
这段代码可能依赖的jar坐标是:
- JAVE(Java Audio Video Encoder)的jar包。
原文地址: https://www.cveoy.top/t/topic/oE5F 著作权归作者所有。请勿转载和采集!