Hello, I have just started looking at using the libav library to help me do some real-time MJPEG decompression and possibly streaming in combination with some existing OpenCV code I have developed for part of my thesis. I'm relatively new to C/C++ and Linux programming so I have spent a good amount of time looking over the api-example.c file to try and understand how I can use libav for my own application. I have run into a question that I hope should be simple to answer:
The default api-example.c program first encodes an MPEG video using the AV_CODEC_ID_MPEG1VIDEO video codec and saves it to /tmp/test.mpg. It then decodes /tmp/test/mpg and generates a series of .pgm images to /tmp/test%d.ppm. But if I would like to generate color images in raw format (i.e. .ppm) how would I go about modifying the code? I have read about the format of .pgm and .ppm files from (http://paulbourke.net/dataformats/ppm/), but have not been able to generate .ppm images. I have tried creating a new function ppm_save() (modified code attached) and replacing all calls to pgm_save() with my new function, but I essentially get three subsequent frames tiled in the same image file. I believe this is because the call to len = avcodec_decode_video2(c, picture, &got_picture, &avpkt) is only storing the gray image data. Does this have to do with the way *picture is declared as an AVFrame object? Thanks for the help! -Mike _______________________________________________ libav-api mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-api
