yangjie10930 / EpMedia

Android上基于FFmpeg开发的视频处理框架,简单易用,体积小,帮助使用者快速实现视频处理功能。包含以下功能:剪辑,裁剪,旋转,镜像,合并,分离,变速,添加LOGO,添加滤镜,添加背景音乐,加速减速视频,倒放音视频。 The video processing framework based on FFmpeg developed on Android is simple, easy to use, and small in size, helping users quickly realize video processing functions. Contains the following functions: editing, cropping, rotating, mirroring, merging, separating, variable speed, adding LOGO, adding filters, adding background music, accelerating and decelerating video, rewinding audio and video.
MIT License
2.4k stars 536 forks source link

图片转视频输出帧率设置无效 #138

Closed LittleLiByte closed 6 years ago

LittleLiByte commented 6 years ago

图片转视频输出帧率设置无效,一直都是25,请问在哪里修改

LittleLiByte commented 6 years ago

解决了,输入之前设置输入帧率为1,输入之后再次设置输出帧率为需要的帧率即可

wayne811 commented 6 years ago

@LittleLiByte 請問再次设置输出帧率 是再次調用 EpEditor.pic2video? 帧率是否就是影片長度? 如不是 那應該調用那一個 謝謝

LittleLiByte commented 6 years ago

@wayne811 直接改命令行就行了,不需要再次调用EpEditor.pic2video,图片张数/帧率=影片时长 pic2video我自己改了下,提供参考

public static void pic2video(String imageInput, String out, int w, int h, float rate, OnEditorListener onEditorListener) {
        if (w < 0 || h < 0) {
            Log.e("ffmpeg", "width and height must greater than 0");
            onEditorListener.onFailure();
            return;
        }
        if (rate <= 0) {
            Log.e("ffmpeg", "rate must greater than 0");
            onEditorListener.onFailure();
            return;
        }
        CmdList cmd = new CmdList();
        cmd.append("ffmpeg").append("-y").append("-f").append("image2").append("-r").append(1).append("-i").append(imageInput)
                .append("-vcodec").append("libx264");
        if (w > 0 && h > 0) {
            cmd.append("-s").append(w + "x" + h);
        }
        cmd.append("-r").append(rate);
        cmd.append("-threads").append("2");
        cmd.append(out);
        long d = VideoUitls.getDuration(imageInput);
        execCmd(cmd, d, onEditorListener);
    }