[FFmpeg-user] Error message 'Could not open codec' when running FFMPEG-codec.
David Kempers
davidkempers at gmail.com
Sun Mar 18 19:28:49 CET 2012
On 18 March 2012 12:55, Anders Branderud <anders.branderud at gmail.com> wrote:
> Hello!
>
> I am running the following code:
>
> https://docs.google.com/document/d/1DbNpoy0MHNjS3ZV-6plaVdbmvW6g08riqtIz6fBO3ZE/edit
>
> Some excerpts:
> video_encode_example("/home/anders/grb_1.mpg", CODEC_ID_MPEG4);
>
> static void video_encode_example(const char *filename, int codec_id)
> {
> {
> //For full code see document attached above.
> /* open it */
> if (avcodec_open2(c, codec, NULL) < 0) {
> fprintf(stderr, "could not open codec\n");
> exit(1);
> }
>
> }
>
> The message 'could not open codec' is printed out.
> video_encode_example("/home/anders/grb_1.mpg", CODEC_ID_MPEG2VIDEO);
> generates the same error message.
>
> How do I resolve this?
> Thanks in advance!
>
>
There's probably a wrong parameter with AVCodecContext.
Off the top of my head I can't remember if CODEC_ID_MPEG2VIDEO and
CODEC_ID_MPEG4 support b frames but I would try to set max_b_frames to 0.
Are all the other parameters the same as the example?
More information about the ffmpeg-user
mailing list