It is one object of the present invention to provide a method and system
for embedding an electronic watermark directly in an MPEG stream. An
intra-macroblock of an I-frame or of a P or B-frame is detected in an
MPEG stream, and following the detection of an intra-macroblock of the
I-frame or of the P or B-frame, data for one macroblock are extracted
from the MPEG stream and buffered. An embedding pattern is embedded in
the buffered macroblock without changing the length of VLC, and the
resultant macroblock is returned to the MPEG stream. More specifically, a
DC factor is extracted from the buffered macroblock, and a pseudorandom
number is generated to produce an embedding pattern. Then, whether the
bit length of the DC factor will not be changed by embedding the obtained
embedded pattern is determined. When the bit length of the DC factor not
be changed, the embedding pattern is embedded in the buffered macroblock.
When the bit length will be changed, whether 1/2 of the embedding pattern
can be embedded is determined. If possible, 1/2 of the embedded pattern
is embedded in the macroblock.