I'm encoding some video on the iPhone by running the png image data through swscale to get YUV420P data then encoding that frame using the MSMPEG4V1 codec. In the api docs, avcodec_encode_video should return the number of bytes used from the output buffer by that encode operation. There are 234,000 bytes going into the encoder, but the result returned by avcodec_encode_video is simply "4". The result is exactly the same over 24 frames. Something seems fishy here...any insight?
Here's a pastebin link to the code:
http://pastebin.com/ht94FWva
(sorry for the link away from SO, I just didn't want to have the code duplicated in several places)
EDIT:
Also, I've set up a custom log callback for ffmpeg to use and I have the log level set to "Verbose" (libavutil/log.h), so l开发者_C百科ibavcodec should be logging any goofs to the console, but avcodec is quiet throught he whole operation. (note: I did test to make sure my log callback was working)
Could be codec related. I switched it from the MSMPEG4V1 codec to MPEG1VIDEO and avcodec_encode_video is returning values that are a little more in line with what I was expecting.
精彩评论