#9260 closed defect (invalid)
avcodec_open2 fails for raw video (AV_CODEC_ID_RAWVIDEO) in 32-bit ffmpeg DLL
Reported by: | Thomas | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | unspecified | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
I think I've found a problem in the 32-bit DLL of ffmpeg v4.3.1 (the same code works perfectly fine with the 64-bit DLL of ffmpeg v4.3.1).
I am trying to create an .avi file with uncompressed video frames (AV_CODEC_ID_RAWVIDEO)
but avcodec_find_encoder cannot find the encoder
ret = avcodec_open2(c, codec, &opt);
returns "codec" with the following fields:
codec.name = "mpeg4"
codec.long_name = "MPEG-4 part 2"
codec.id = AV_CODEC_ID_RAWVIDEO
I have the same problem with and without adding an audio stream.
Again, the problem does not appear with the 64-bit DLL of ffmpeg v4.3.1
Change History (3)
comment:1 by , 3 years ago
comment:2 by , 3 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
There is no "the 32-bit DLL of ffmpeg v4.3.1"; FFmpeg does not distribute official binaries.
I think I know what your problem is: Since dcc39ee10e82833ce24aa57926c00ffeb1948198, AV_CODEC_ID_MPEG4 == 12, AV_CODEC_ID_RAWVIDEO == 13; before said commit, AV_CODEC_ID_MPEG4 == 13 and AV_CODEC_ID_RAWVIDEO == 14. It seems to me that your code uses the new codec IDs (i.e. you use avcodec_find_encoder(13)), but links against an old version of libavcodec that is somewhere in your (32-bit) PATH. And therefore you get the MPEG-4 encoder.
PS: Anyway, avcodec_open2() does not return a codec; it expects the codec to be either already set (when the AVCodec has already been set in avcodec_alloc_context()) or it expects it to be given to avcodec_open2().
comment:3 by , 3 years ago
Thanks A LOT mkver!
You were right. I was linking with a previous .lib.
Now I link with the correct .lib and it works fine.
Thanks again.
Please test current FFmpeg git head, the only version supported on this bug tracker, and explain how you compiled the libraries.