u013692607
不填海的精卫
2018-01-02 06:34

ffmpeg 无法定位程序输入点avcodec_alloc_context3

5
  • 视频
  • ffmpeg

从zeranoe 下载的开发库

 #include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
#include <libavutil/imgutils.h>
#pragma comment(lib, "avcodec.lib")  

#pragma comment(lib,"avutil.lib")


int main(int argc, char **argv)
{
    const char *filename, *codec_name;
    const AVCodec *codec;
    AVCodecContext *c = NULL;
    int i, ret, x, y;
    FILE *f;
    AVFrame *frame;
    AVPacket *pkt;
    uint8_t endcode[] = { 0, 0, 1, 0xb7 };

    if (argc <= 2) {
        fprintf(stderr, "Usage: %s <output file> <codec name>\n", argv[0]);
        exit(0);
    }
    filename = argv[1];
    codec_name = argv[2];

    avcodec_register_all();

    /* find the mpeg1video encoder */
    codec = avcodec_find_encoder_by_name(codec_name);
    if (!codec) {
        fprintf(stderr, "Codec '%s' not found\n", codec_name);
        exit(1);
    }

    c = avcodec_alloc_context3(codec);

    if (!c) {
        fprintf(stderr, "Could not allocate video codec context\n");
        exit(1);
    }


    av_opt_set(c->priv_data, "turn", "zerolatency", 0);



    return 0;
}
只要加上av_opt_set(c->priv_data, "turn", "zerolatency", 0); 就会出现无法定位输入点
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答