Java将图片转为视频

话不多说,上代码

        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入图片位置:");
        String charImagePath =  scanner.nextLine();
		// 需要原视频配合,负责生成出来的视频和原视频画面对不上
        System.out.println("请输入参考视频地址位置:");
        String sourceVideolUrl =  scanner.nextLine();

        System.out.println("请输入新视频存储位置:");
        String targetVideoUrl =  scanner.nextLine();

        // 图片生成视频
        //读取所有图片
        File file = new File(charImagePath);
        File[] charImageFiles = file.listFiles();
        Map<Integer, File> imgMap = new HashMap<Integer, File>();
        for (File imgFile : charImageFiles) {
            String imageName = imgFile.getName();
            int num = Integer.parseInt( imageName.substring(0, imageName.lastIndexOf(".")));
            imgMap.put(num, imgFile);
        }
        try {
            Util.imageTovideo(sourceVideolUrl,targetVideoUrl,imgMap);
        } catch (FFmpegFrameRecorder.Exception e) {
            e.printStackTrace();
        }

资源下载
Java将图片转为视频

Java将图片转为字符形式的图片

Java 视频按帧分解成图片

懒得下载或网络不好的,直接可去下方下载maven依赖包,放到本地的maven仓库即可
下载maven

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值