在ffmpeg中过滤(去隔行)

时间:2016-12-02 09:37:01

标签: ffmpeg javacpp

是否可以去隔行?我在关注

,不幸的是

  

Java Runtime Environment检测到致命错误:

     

EXCEPTION_ACCESS_VIOLATION(0xc0000005)at pc = 0x00007ff831ee94cd,pid = 8808,tid = 9184

     

JRE版本:Java(TM)SE运行时环境(8.0_91-b14)(版本1.8.0_91-b14)    Java VM:Java HotSpot(TM)64位服务器VM(25.91-b14混合模式windows-amd64压缩oops)    有问题的框架:    C [avfilter-6.dll + 0x394cd]

当init调用avfilter.avfilter_graph_create_filter时。 方法代码:

avfilter.AVFilterContext filter_src_ctx = null;
avfilter.AVFilterContext filter_sink_ctx = null;
 private void init_filtering(avcodec.AVCodecContext ctx, AVFrame frame) {
        avfilter.AVFilter buffer_src = avfilter.avfilter_get_by_name("buffer");
        avfilter.AVFilter buffer_sink = avfilter.avfilter_get_by_name("buffersink");
        avfilter.AVFilterInOut inputs = avfilter.avfilter_inout_alloc();
        avfilter.AVFilterInOut outputs = avfilter.avfilter_inout_alloc();

        String args = String.format("video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
            frame.width(),
            frame.height(),
            frame.format(),
            ctx.time_base().num(),
            ctx.time_base().den(),
            ctx.sample_aspect_ratio().num(),
            ctx.sample_aspect_ratio().den());

        String description = "yadif=1:-1:0";
        avfilter.AVFilterGraph graph = avfilter.avfilter_graph_alloc();

        int result = avfilter.avfilter_graph_create_filter(filter_src_ctx, buffer_src, "in", args, null, graph);
        if (result < 0) {
            System.out.println("error");
        }

        avfilter.AVBufferSinkParams params = avfilter.av_buffersink_params_alloc();
        params.pixel_fmts().put(avutil.AV_PIX_FMT_NONE);

        result = avfilter.avfilter_graph_create_filter(filter_sink_ctx, buffer_sink, "out", null, params, graph);
        av_free(params);
        if (result < 0) {
            System.out.println("error");
        }
        inputs.name(new BytePointer("out"));
        inputs.filter_ctx(filter_sink_ctx);
        inputs.pad_idx(0);
        inputs.next(null);

        inputs.name(new BytePointer("in"));
        inputs.filter_ctx(filter_src_ctx);
        inputs.pad_idx(0);
        inputs.next(null);

        result = avfilter.avfilter_graph_parse_ptr(graph, description, inputs, outputs, null);
        if (result < 0) {
            System.out.println("error");
        }

        result = avfilter.avfilter_graph_config(graph, null);
        if (result < 0) {
            System.out.println("error");
        }
        isInitFilter = true;
    }

我会赞同任何建议。 (这是issue reported in javacpp

的副本

0 个答案:

没有答案