Thank you for your answer! I'm using latest svn source code. I call
avcodec_register_all() at the start, here is my code(it works fine with
codecs other than H264):

    av_register_all();

    filename = "test.mp4";

    fmt = guess_format(NULL, filename, NULL);
    if (!fmt) {
        printf("Could not deduce output format from file extension: using
MPEG.\n");
        fmt = guess_format("mpeg", NULL, NULL);
    }
    if (!fmt) {
        fprintf(stderr, "Could not find suitable output format\n");
        exit(1);
    }

    fmt->video_codec = CODEC_ID_H264;

    oc = av_alloc_format_context();
    if (!oc) {
        fprintf(stderr, "Memory error\n");
        exit(1);
    }
    oc->oformat = fmt;

    snprintf(oc->filename, sizeof(oc->filename), "%s", filename);

    video_st = NULL;
    if (fmt->video_codec != CODEC_ID_NONE) {
        video_st = add_video_stream(oc, fmt->video_codec);

    }

    if (av_set_parameters(oc, NULL) < 0) {
        fprintf(stderr, "Invalid output format parameters\n");
        exit(1);
    }

    ...


What did I miss?

2008/12/24 Stefano Sabatini <[email protected]>

> On date Wednesday 2008-12-24 17:17:21 +0400, Artem encoded:
> > I'm trying to encode h264 video, I compiled x264 and ffmpeg with x264
> > support:
> >
> > --enable-libmp3lame --disable-vhook --disable-mmx --enable-swscale
> > --enable-gpl --enable-libx264
> >
> > but when I set fmt->video_codec = CODEC_ID_H264
> >
> > I receive:
> >
> > Output #0, mp4, to 'test.mp4':
> >     Stream #0.0: Video: 0x0000, yuv420p, 800x500, q=2-31, 64 kb/s,  4.00
> > tb(c)
> > codec not found
> >
> > What should I do to enable h264 codec ?
>
> 1) avcodec_init()
> 2) use register_codec() avcodec_register_all() (the previous step
>   is not required if you're using a recent FFmpeg build).
>
> > Thanks!
>
> Regards.
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to