Very low bit-rate video coding algorithms using predefined regular-shaped patterns to segment out moving objects at macroblock level have exhibited good potential for improved coding efficiency when embedded in the H.264 standard as an extra mode. Even the best-matched regular-shaped pattern from a predefined codebook cannot approximate the shape of the object well, and there is no guarantee that even a regular-shaped object will have a close match with one of the limited number of predefined patterns. Intuitively, improved coding performance can be achieved if patterns are dynamically extracted from the video content. This letter presents a content-based pattern generation (CPG) algorithm for a set of macro blocks, which is shown optimal when only one pattern is allowed to represent the entire set. Coupling CPG, generating a pattern codebook after clustering the macro blocks into several disjoint sets, with any pattern selection algorithm outperforms the existing regular-shaped pattern-based coding while both embedded in H.264.