Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image FFmpeg:计算将图像和.mp3转换为视频的时间_Image_Video_Ffmpeg - Fatal编程技术网

Image FFmpeg:计算将图像和.mp3转换为视频的时间

Image FFmpeg:计算将图像和.mp3转换为视频的时间,image,video,ffmpeg,Image,Video,Ffmpeg,有什么公式可以用来计算FFmpeg将单个.jpg图像和.mp3歌曲转换为视频所用的时间吗 我正在使用以下代码: ffmpeg -loop 1 -r ntsc -i image.jpg -i song.mp3 -c:a copy -c:v libx264 \ -preset fast -threads 0 -shortest 谢谢你的提示。使用-r 1,速度更快 ffmpeg -loop 1 -r 1 -i image.jpg -i song.mp3 -c:a copy -c:v libx26

有什么公式可以用来计算FFmpeg将单个.jpg图像和.mp3歌曲转换为视频所用的时间吗

我正在使用以下代码:

ffmpeg -loop 1 -r ntsc -i image.jpg -i song.mp3 -c:a copy -c:v libx264 \ -preset fast -threads 0 -shortest 谢谢你的提示。

使用-r 1,速度更快

ffmpeg -loop 1 -r 1 -i image.jpg -i song.mp3 -c:a copy -c:v libx264 \ -preset fast -threads 0 -shortest 使用-r 1,速度更快

ffmpeg -loop 1 -r 1 -i image.jpg -i song.mp3 -c:a copy -c:v libx264 \ -preset fast -threads 0 -shortest
首先,使用键-t10运行基准测试,这意味着10秒基准测试并计算运行时间

ffmpeg -i .......... -t 10 -f null - -benchmark
基准测试输出,运行时:utime:


首先,使用键-t10运行基准测试,这意味着10秒基准测试并计算运行时间

ffmpeg -i .......... -t 10 -f null - -benchmark
基准测试输出,运行时:utime:

首先,从FFmpeg侦听器的OnProgress方法调用此方法

GetProgress是一种查找执行估计时间的方法

转换到HMMSS

首先,从FFmpeg侦听器的OnProgress方法调用此方法

GetProgress是一种查找执行估计时间的方法

转换到HMMSS


谢谢你,史蒂文。你能解释一下参数-R1是什么吗?另外,对于如何计算完成编码过程所需的时间,您有什么线索吗?谢谢你的帮助。helpr代表“比特率”应该是-帧率,而不是-r。谢谢你的帮助。你能解释一下参数-R1是什么吗?另外,对于如何计算完成编码过程所需的时间,您有什么线索吗?谢谢你的帮助。helpr代表“比特率”应该是-帧速率,而不是-r。
 public void onProgress(String s) {
            getProgress(s);
            Log.e("Editor", "String ==== " + s);
    }
 private void getProgress(String message) {
            Pattern pattern = Pattern.compile("time=([\\d\\w:]{8}[\\w.][\\d]+)");
            Matcher matcher = pattern.matcher(message);
            matcher.find();
            String tempTime = String.valueOf(matcher.group(1));
            Log.d(TAG, "getProgress: tempTime " + tempTime);
            String[] arrayTime = tempTime.split("[:|.]");
            long currentTime =
                    TimeUnit.HOURS.toMillis(Long.parseLong(arrayTime[0]))
                            + TimeUnit.MINUTES.toMillis(Long.parseLong(arrayTime[1]))
                            + TimeUnit.SECONDS.toMillis(Long.parseLong(arrayTime[2]))
                            + Long.parseLong(arrayTime[3]);

            String speed;
            speed = message.substring(message.indexOf("speed=") + 1, message.indexOf("x")).split("=")[1];

            long percent = 100 * currentTime / videoLengthInMillis;
            long time = TimeUnit.HOURS.toMillis(Long.parseLong(arrayTime[0])) * 3600 + TimeUnit.MINUTES.toMillis(Long.parseLong(arrayTime[1])) * 60 + TimeUnit.SECONDS.toMillis(Long.parseLong(arrayTime[2])) + Math.round(Long.parseLong(arrayTime[3]));
            long ETA = Math.round((Math.round(videoLengthInMillis) - time) / Float.valueOf(speed));
            Log.e(TAG, "currentTime -> " + currentTime + "s % -> " + percent);
            Log.e(TAG, "ETA -> " + ETA);

            progressBar.setProgress((int) percent);
            String EstimateTime = convertSecondsToHMmSs(ETA);
            Log.e(TAG, "EstimateTime -> " + EstimateTime);
            ProcessTime.setText(EstimateTime);
        } 
public static String convertSecondsToHMmSs(long millis) {

    long seconds=(millis/1000);
    long s = seconds % 60;
    long m = (seconds / 60) % 60;
    long h = (seconds / (60 * 60)) % 24;
    return String.format("%d:%02d:%02d", h,m,s);
}