FFmpeg截取一个视频中的一张图

String videoPath = "D:\\班迪\\bandicam 2023-09-12 13-43-08-842.mp4";// 输入视频文件路径
String thumbnailPath = "D:\\班迪\\bandicam 2023-09-12 13-43-08-842.mp4.jpg";// 输出图片文件路径

// 构建FFmpeg命令
ProcessBuilder processBuilder = new ProcessBuilder("ffmpeg", "-i", videoPath, "-ss", "00:00:01", "-vframes", "1", thumbnailPath);

try {
    // 执行FFmpeg命令
    Process process = processBuilder.start();
    process.waitFor();
    System.out.println("截图成功");
} catch (Exception e) {
    e.printStackTrace();
}

你可能感兴趣的:(ffmpeg,音视频)