get video fps using FFProbe

前端 未结 3 1533
一生所求
一生所求 2021-01-02 01:50

I am new in ffprobe my aim is get video fps and store into java program. my code store xml files but i want store directly like int fps=30;

ffprobe -v quiet          


        
3条回答
  •  执笔经年
    2021-01-02 02:14

    I found calculate fps in another method that is..

    String query = "ffmpeg -i foo.avi 2>&1 | sed -n 's/.*, \\(.*\\) fp.*/\\1/p' > fps.txt";
        String[] command = {"gnome-terminal", "-x", "/bin/sh", "-c", query};
        Process process = Runtime.getRuntime().exec(command);
        process.waitFor();
        Thread.sleep(2000);
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("fps.txt")));
            output = br.readLine();
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    

    Anyway thanks friends.

提交回复
热议问题