I have reverse engineered what appears to be a proprietary protocol used by many Chinese designed and manufactured security DVRs. I'm able to extract h.264 frames from a TCP Data Stream. Initially I was able just writing all the frames one after another to a file and using avconv to convert to another video format. The video looks fine, so I am assuming I am doing it correctly.
Since then I've gotten to the point where I can use libav to decode the packets. This of course results in an AVFrame. Right now I am trying to figure out a way to write out the most current frame to a still image. My current understanding of libav is that the pixel format is depending on the source data, in this case h.264. Either way, it appears it is accessible from decoding context struct AVCodecContext::pix_fmt. Apparently if I just wanted to re-encode this in a better supported streaming format it would be easy. But to make these security cameras work with open source software like motion I really need to be able to produce stills. My logic is that if I can convert the pixels into something like RGBA, I can from there easily write to whatever format I want like ppm, jpeg, etc. Apparently this is done with the function sws_scale. The context is easy enough to create with sws_getContext. But I really have no idea what the parameters to sws_scale should be. What are slices? What are strides? I've looked at the documentation but it doesn't really go into detail about what the parameters. I feel like I must be missing some image processing theory or something like that. Also I looked at the latest source folder for libswscale but there do not appear to be any examples in there. Can someone give me an explanation of how sws_scale works? I've found bits and pieces of information scattered across the internet but nothing really concrete. Also, I could not figure out how to search this list. Is that possible? Thank you very much, Eric _______________________________________________ libav-api mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-api
