Look, I'm in no way an expert here, but your question seems pretty strange:
I suppose by "bayer images" you are referring to this (
http://en.wikipedia.org/wiki/Bayer_filter)? This is just your camera sensor. Its "native" format is RAW.
Then H264, being a motion-compensation based video (as in moving pictures) codec doesn't seem to be the right solution. There is a lossless option in H264 encoders, but that option produces extremely big results.And you gain nothing of the motion-compensation portion of the filter because there's only one frame to compress.
I don't think you'd gain much by using H264 for your images vs RAW or any more common truly lossless formats.
Can you rephrase your question?