whyclxw
2024-01-27 cf2df97ee7c5bb861526ef0ec9beaa174c04c872
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.lxw.test3d.FFM;
 
 
/**
 * @ClassName ConverVideoTest
 * @Desecription TODO
 * @Author tkk
 * @Date 2019/11/13 9:43
 **/
public class ConverVideoTest {
 
    /**
     * @Description:(1.转码功能调用)
     * @param:@param yuanPATH
     * @return:void
     * @author:Zoutao
     * @date:2018-6-23
     * @version:V1.0
     */
    /*本地测试专用--zoutao*/
    public static void main(String[] args) {
        //System.out.println(DateUtils.getCurrentDateTime());
        ConverVideoTest c = new ConverVideoTest();
        //String yuanPATH = "D:/file/IMG_4141.MP4";  //本地源视频
        String yuanPATH = "E:\\ffmpeg\\2.avi";  //本地源视频
        c.run(yuanPATH);
        //System.out.println(DateUtils.getCurrentDateTime());
    }
 
    //web调用
    public void run(String yuanPATH) {
        try {
            // 转码开始
 
            //String filePath = "D:/testfile/video/rmTest.rm";  //本地源视频测试
 
            String filePath = yuanPATH;                //web传入的源视频
            System.out.println("ConverVideoTest说:传入工具类的源视频为:"+filePath);
 
            ConverVideoUtils zout = new ConverVideoUtils(filePath);  //传入path
            String targetExtension = ".mp4";                  //设置转换的格式
            boolean isDelSourseFile = true; //删除源文件
 
            boolean beginConver = zout.beginConver(targetExtension,isDelSourseFile);
            System.out.println(beginConver);
 
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}