From: ap105053@kivikkorastas.cs.tut.fi (Antti Paarlahti)
Newsgroups: rec.video
Subject: Macrovision FAQ v1.0
Organization: Tampere University of Technology, Finland, Europe

Since this copy protection thread has surfaced again, I might offer you
some reading. I have appointed myself as the maintainer of the Macrovision
FAQ, because nobody else has done so :-)


ap105053@cs.tut.fi .EQU  "Antti Paarlahti"   ; From Finland
* This signature intentionally left blank.


----8<--------8<--------8<--------8<--------8<--------8<--------8<----

MACROVISION FAQ v1.0
====================

Copyright Antti Paarlahti, ap105053@cs.tut.fi

This file may be freely distributed in electronic form as long as it stays
complete.

This article has been built upon my original "Macrovision explained"-one
that was posted to rec.video some time ago. Completely new in this version
is a "reader-friendly front-end", i.e. an explanation for general audiences
without technical background. Also some minor modifications have been done
to the technical section.

Some material has been acquired from the Net and some (most) from my own
experiments.

New contributions _and_ new questions are most welcome.  Grammar
corrections are accepted, because I am not a native speaker of English.

Information presented here should be correct as far as _I_ know, but utter
rubbish may have crept in, so proceed carefully.


Contents
::::::::

A. What??
B. A non-technical explanation
C. A technical explanation


A. WHAT??
=========

1. What is Macrovision?

Macrovision is a videotape copy protection method for VHS video cassette
recorders. It is used on pre-recorded videotapes, and it seems to be more
common in North America than in Europe. If you want a tape that will have
Macrovision, get a Disney one.

(Someone else might know who invented, marketed and/or used it, etc.)


2. What does it look like?

When dubbing a protected tape, the picture that has gone through the
recording VCR will get dark and then normal again periodically. The picture
may also become unstable when it is at its darkest.

Some televisions do not like Macrovision either; the top of the picture
might be unstable all the time and the colors may flicker.

If you have a TV that has an adjustement for picture height or vertical
hold, you can play with those. Macrovision signals can be seen as very
bright and very dark regions (stripes) near the top of the picture.


3. Is there an easy and economical way to get rid of it?

Not really. There are three main alternatives:

- Modify the VCR. It is easy in principle, just change the value of one
  capacitor or resistor in the destination deck. The problem is, you'd
  probably have to get a service manual to find out which one. Furthermore,
  you still don't get rid of the protection; it just makes the copying
  possible.

- Make an eliminator yourself. It is a relatively straightforward task
  (more in the technical section), _if_ you know electronics. Most
  people don't, unfortunately.

- Buy a commercial "stabilizer". This method is definitely easy, but not
  the cheapest.


B. A non-technical explanation
==============================

Here is a simple explanation of how the method works. It exploits the
automatic gain control (AGC) circuit in the recorder. The purpose of the
AGC is to adjust the level of the video signal in such a way that the
recording capabilities of the tape are fully used. This means that weak
signals are amplified and strong ones are attenuated.

In the Macrovision method, some new signals are inserted in the non-visible
portion of the picture. These signals can make the VCR think that a
perfectly normal picture is suddenly way, way too bright. The AGC circuit
therefore darkens it until it thinks the brightness is normal. Of course,
now the _real_ picture is very dark. The picture is varied between bright
and dark periodically in order to defeat simple eliminators that would just
amplify the dark and murky signal back to almost normal.

Why isn't the TV affected? Well, most TV sets do not have any AGC-circuits
at all, and the rest behave differently from VHS ones.


1. My friend has a VHS VCR that is not affected. How is this possible?

The proper behaviour of the AGC-circuit is very important in order to
achieve good protection. Apparently the specifications were somewhat
"loose" in the pre-Macrovision days, so the old (how old?) machines are not
affected.

JVC, the VHS license holder, has tightened the spec and the control, so it
is difficult to get an "immune" VCR, but there are some machines that are
conveniently "out of spec". No, I don't know which ones.


2. I have heard that 8mm video is not affected by it. Is this true?

8mm video is not affected by Macrovision, because it is totally separate
>from VHS. There is no need to have AGC circuits that bear any resemblance
to JVC ones.

Of course, 8mm recorders do not remove the protection, so any subsequent
VHS dub will again be unwatchable.


3. Can Macrovision be defeated by copying via the aerial inputs/outputs?

No, it can't. There was some ancient method that could be eliminated
like that, but it is now long dead. Macrovision is so integrated in the
video signal that these simple tricks will not work.


4. There are many mail-order companies in the USA selling those boxes.
   Can I buy one and use it in Europe?

No, not really. You might get some improvement, but the protection
timings are sufficiently different to keep it from working properly.


5. My TV does not get a stable picture, when I watch rental tapes. Could
   this be a fault of the copy protection?

Yes, very likely. Macrovision signals resemble false synchronization
pulses, and some sets mistake them for the real ones.


6. Can laserdiscs have Macrovision?

Apparently no. First of all, it is technically difficult, because the region
used by Macrovision is also used to hold control data for the laserdisc
players. Secondly, as long as the laserdisc market stays as a niche market,
the distributors will not pressure the manufacturers to change the specs.



C. A technical explanation
==========================


In this part, I represent the empirical data about "Macrovision in
action" that I have gathered with my trusty 20+ year old oscilloscope.

The main topics are:
- current PAL Macrovision
- old NTSC Macrovision

==>> REQUEST: If anyone can analyze the rumoured new NTSC Macrovision
and send the data to me, I'd be very grateful. It's pretty hard to get
NTSC tapes here.

Tapes that I used were Disney's Beauty and the Beast (PAL) and 101
Dalmatians (NTSC).

NB: From here, it gets very technical. A basic knowledge of what video
signal looks like is required.


First, some basics. A television picture consists of 25/30 (PAL/NTSC)
_frames_. Every frame contains a total of 625/525 _lines_ (not all are
visible, though). Frames are _interlaced_, i.e. they are divided into
two _fields_ that are drawn on top of another in such a way that the
first field scans every alternate line and the second field 'fills in'
the missing lines. The scanning is from top to bottom and from left to
right.

The fields are separated by _vertical synchronization_ pulses. The lines
are separated by _horizontal synchronization_ pulses. Both PAL and NTSC
standards specify that those approximately 20 lines that follow a
vertical sync are not to be used in forming the picture. These lines are
not visible in properly adjusted TVs, so they can e.g. carry TeleText
data, or, in our case, Macrovision copy protection signals (see pictures
1 and 2). The vertical sync and invisible lines form the _vertical
blanking region_.


Macrovision
===========

So, what is the trick with Macrovision? In order to understand that,
some knowledge of VHS AGC circuits is needed (AGC==Automatic Gain
Control). The AGC circuits adjust the amplitude of the video (luminance)
signal by measuring the voltage difference between the bottom of the
horizontal sync and the back (rear) porch (see picture 3). Chrominance
AGC is measured from the color burst.

What Macrovision does is to introduce false synchronization pulses
followed by false back porches at a very high voltage level (~15% over
white level).  The VHS VCR looks at the signal and thinks that it is fed
with an extremely high-amplitude signal and adjusts the gain control to
minimum --> the real picture gets very dim (see pictures 4 and 5).

The AGC response must be like this:

- React _fast_ (in a few lines time) to an apparent increase in
  amplitude by attenuating the signal.

- React _slowly_ (in a few frames time) to an apparent decrease in
  amplitude by amplifying the signal.


In the following pictures '|' represents a vertical synchronization
pulse.  Because of interlacing, the sync pulses of corresponding lines
in different fields are spaced 1/2 lines apart. The fields are drawn on
top of another because 1) my 'scope shows them like this, and 2) the
fields are nearly identical anyway.

The scale of the video signal pictures:
- sync bottoms are 2 characters below black level
- white level is 5 characters above black level
- Macrovision signal peaks are 6 characters above black level
  (a reasonably good approximation)


Picture 1: PAL vertical blanking region with Macrovision
--------------------------------------------------------

   Scope             Interlace           Macrovision regions
   trigger           starts    ...........................................
   :                 :         1                   2 1                   2
   :                 :         1  Region 1         2 1  Region 2         2
   :  Vertical sync  :         1  (between '1's)   2 1  (between '2's)   2
   :                 :         1                   2 1                   2
_           _ _ _ _ ________________________________________________________
 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
 |_|_|_|_|_| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |

   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3   3
   1   1   1   1   1   1   2   2   2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 3 1 3 1 3
 1 4 2 5 3 6 4 7 5 8 6 9 7 0 8 1 9 2 0 3 1 4 2 5 3 6 4 7 5 8 6 9 7 0 8 1 9 2
 The number of the scanline starting after this sync pulse


                :
                : Picture
                : start
                :
______________________...
| | | | | | | | | | |
| | | | | | | | | | |

3   3   3   3   3   3
3 2 3 2 3 2 3 2 3 2 3
2 0 3 1 4 2 5 3 6 4 7


I'll explain those regions later. It is very easy to calculate the
required timing for a Macrovision eliminator from this picture (more
later, also).  There are other line numbering systems, but this is "time
sequential".


Picture 2: NTSC vertical blanking region with Macrovision
---------------------------------------------------------

   Scope                 Interlace         Macrovision region         Picture
   trigger               starts    ................................... start
   :                     :         :                                 :   :
   :                     :         :                                 :   :
   :  Vertical sync      :         :                                 :   :
   :                     :         :                                 :   :
_             _ _ _ _ _ ____________________________________________________
 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
 |_|_|_|_|_|_| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |

   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2   2
   6   6   6   6   6   6   7   7   7 1 7 1 7 1 7 1 7 1 7 1 7 1 7 1 8 1 8 1 8
 1 4 2 5 3 6 4 7 5 8 6 9 7 0 8 1 9 2 0 3 1 4 2 5 3 6 4 7 5 8 6 9 7 0 8 1 9 2


As can be observed, NTSC timing is a little bit tighter. I'm not sure
about the line numbering, because I have no NTSC-references, so please
correct me.


Now, what do those lines inside Macrovision regions contain? Back to
basics, once again.



Picture 3: PAL/NTSC normal line
-------------------------------

This is one normal PAL/NTSC scanline as seen on an oscilloscope screen.

Time in microseconds
0         1         2         3         4         5         6   0         1
0123456789012345678901234567890123456789012345678901234567890123012345678901

      ___________________________________________________             ______
     |      ^-- White level                              |           |
     |                                                   |  Color    |
     |             Arbitrary picture data                |  burst--v |
     |                                                   |           |
 _MM_|___________________________________________________|_      _MM_|______
| WW        ^-- Black level                                |    | WW
|                                                          |____|

                                            Front porch --^   ^  ^-- Back
                                            Horizontal        |      porch
                                            synchronization --+


Here are both the PAL and NTSC Macrovision 'magic' lines that do the
trick.  Both are shown at their maximum amplitudes.


Picture 4: PAL Macrovision line
-------------------------------

0         1         2         3         4         5         6   0         1
0123456789012345678901234567890123456789012345678901234567890123012345678901
         _    _    _    _    _    _    _                                 _
        | |  | |  | |  | |  | |  | |  | |                               | |
        | |  | |  | |  | |  | |  | |  | |                               | |
        | |  | |  | |  | |  | |  | |  | |                               | |
        | |  | |  | |  | |  | |  | |  | |                               | |
        | |  | |  | |  | |  | |  | |  | |                               | |
 _MM__  | |  | |  | |  | |  | |  | |  | |__________________      _MM__  | |
| WW  | |  | |  | |  | |  | |  | |  | |                    |    | WW  | |  |
|     |_|  |_|  |_|  |_|  |_|  |_|  |_|                    |____|     |_|  |


Picture 5: NTSC Macrovision line
--------------------------------

0         1         2         3         4         5         6   0         1
0123456789012345678901234567890123456789012345678901234567890123012345678901
         __      __      __      __                                      __
        |  |    |  |    |  |    |  |                                    |  |
        |  |    |  |    |  |    |  |                                    |  |
        |  |    |  |    |  |    |  |                                    |  |
        |  |    |  |    |  |    |  |                                    |  |
        |  |    |  |    |  |    |  |                                    |  |
 _MM__  |  |__  |  |__  |  |__  |  |_______________________      _MM__  |  |
| WW  | |     | |     | |     | |                          |    | WW  | |
|     |_|     |_|     |_|     |_|                          |____|     |_|




The lines drawn above are quite similar. Both try to present false
synchronization pulses to the VCR the first 40 microseconds or so. The
rest of the line is black, because false syncs there would trigger the
sync circuits in monitors/TVs and consequently the top of the picture
would be very unstable. Some TVs really do suffer even now, I have seen
it myself.


But that is not all. If the pulses had a constant amplitude, it would be
quite easy just to increase the amplitude of the video signal and get a
decent picture. Therefore the false back porch voltage level is varied
according to some simple rules in order to get the brightness changes as
annoying as possible.

The following pictures show, how the false back porch amplitudes change
with time. The lowest level is black, the highest is "super-white". The
false syncs (below black level) do not change their amplitude. The
perceived brightness of the TV picture is the inverse, e.g. the highest
level in the diagram means the darkest picture on the screen.


Picture 6: Pulsating cycles, PAL
--------------------------------

      _____________________                                          ___...
     /                     \           R1      R1      R1           /
    /                       \          ___     ___     ___         /
   /                         \   ||   |   |   |   |   |   |   |   /
  /                           \  ||   |   |   |   |   |   |   |  /
 /                             \ ||___|R2 |___|R2 |___|R2 |___| /
/                               \||   |___|   |___|   |___|   |/

:     :                   :      ::   :   :   :   :   :   :   :      :
: 2s  :        7s         : 2.3s ::32f:32f:32f:32f:32f:32f:32f:  2s  :
:     :                   :      ::   :   :   :   :   :   :   :      :
                                 10f                          2f
                                           <-- ~9s -->
R1 = lines in region 1
R2 = lines in region 2
f  = frames

Here is where the two regions differ. When R1 rises to ~60% of max
amplitude, R2 goes to black. Otherwise they change in parallel.


Picture 7:Pulsating cycles, NTSC
--------------------------------

      ____________________..._________________                     _____...
     /                                        \                   /
    /                                          \                 /
   /                                             \              /
  /                                               \            /
 /                                                  \         /
/                                                    \_______/

:     :                                      :       :       :     :
:3.5s :                 22s                  :  5s   :  4s   :3.5s :
:     :                                      :       :       :     :


As can be seen, old NTSC-Macrovision cycle is very simple. Please, once
again, send me information about the new one.

All the slopes and the stable regions between them are timed in seconds,
because a) the timing is not so critical and b) it is difficult to say
in which frame a slope starts or ends.


How to eliminate
----------------

Here is a small disclaimer-type paragraph: I have built an eliminator and
have used it for backing up my own precious videotapes. Try, for example,
get a replacement for your damaged "The Little Mermaid" videotape. You're
lucky, if you succeed. I almost never rent videotapes; the picture sucks
and they are usually "pan-and-scan" transfers. And the last reason: I'm a
hardware hacker, so I did it just for the heck of it.

Macrovision elimination is _very_ simple, if you have some knowledge of
electronics. My primary inspiration was 

"Macrovision decoder/blanker"
Elektor Electronics, October 1988, pp. 44-47.

(Note: it features an older version of Macrovision; not that different,
though.)

I built roughly an equivalent circuit myself, but it was higly
unsatisfactory. Reasons:

1) The circuit assumes that the incoming video signal has a certain
amplitude ==> it uses fixed voltages and signal levels, which do not
work properly (because of varying input level and unaccurate clamping).

2) Too many cheap electronic switches along the signal path ==> visibly
worsened picture quality (soft, color fluctuations).

3) Chops off color burst from protected lines ==> horrible color purity
errors near the top edge of the picture (perhaps the most visible error).


Below is a block diagram of my currently satisfactorily working device.
It resembles only remotely the EE one. The basic idea is that the
Macrovision pulses are replaced with a black level. I challenge anyone
to make a simpler device.


Picture 8: Block diagram
------------------------


   video             _______                _____      _____
   in >------+----->| sync  |>------------>|     |>-->|     |>-+
             |      | sepa  | vsync        |delay|    | MMV |  | Pulse
             |      | rator |              |     |    |  1  |  | that
             |      |_______|>-------+     |_____|    |_____|  | lasts
             |       LM1881   burst  |     region              | the
             |                       |     start               | whole
electr.     0|                       |                         | Macrov.
switch    ___|_                      |         _               | region
         |   o | insert_black        |        | |<-------------+
     +-----o/  |<----------------------------<|&|
     |   |___o_|                     |        |_|<--------+
     |       |                       |                    |
     |      1| black                 |                    |~45us pulse
     |       | level                 |                    | that covers
     |       |                       |                    | the false
     |     __^_____                  |                    | syncs
     |    |        |                 |                    |
     |    | sample |sample_now       | line_start _____   |
     +--->| and    |<----------------+---------->|     |>-+
     |    | hold   |                             | MMV |
     |    |________|                             |  2  |
     |     sample black level                    |_____|
     |     from back porch
     |
     |     ________
     |    |        |
     |    | video  |    video
     +--->| output |>--------->
          | buffer |    out
          |________|


Some explanations:

- Sync separator is the small and cheap LM1881. Only vertical sync and
  burst gate are used. I mention the explixit type here, because the
  device is practically built around it and because it replaces a whole
  chunk of analog electronics.

- The sample and hold circuit is used to sample the black level. Although
  the sampling occurs at color burst time, I have not experienced any
  difficulties. 2 opamps, 1 electronic switch and a capacitor make a
  wonderful S&H circuit. The sampling input is from the output of the
  video switch, because the false syncs trigger LM1881, too.

- The delay block delays the vertical sync until the Macrovision region is
  about to begin.

- MMV 1 (monostable multivibrator) is triggered when the Macrovision region
  starts and produces a pulse that lasts until the end of the region.

- MMV 2 is triggered at the end of the burst gate and it produces a pulse
  that lasts about 45 us == until all false syncs are gone. This MMV must
  not be retriggerable within the pulse, because the false syncs come
  through LM1881 and try to retrigger.

- The video output buffer can be a transistor or two. It does not need to
  have any voltage gain, because the VCR has the AGC circuits. If it
  doesn't, you dont't need this circuit in the first place!

I do have the whole circuit as a 2-color IFF-ILBM picture (Amiga native
format). I am able to convert it into almost any format, if anyone is
interested. Surely no-one is... B^)



Other methods
==============

One method that I have seen on some old rental cassettes is the changing
of horizontal sync amplitude in the middle of a frame. When dubbed, the
AGC circuits change the gain to keep the sync amplitude constant, and
the resulting picture has very noticeable bands of bright and dim
picture.


Original frame

       v--- constant grey level
...........................................................................

___________________________________________________________________________
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | |                 | | | | | | | | | |               | | | | | |

(The amplitude change is somewhat exaggerated)


Dubbed result
               ..............                      ............
              .              .                    .            .
..............                ....................              ...........

___________________________________________________________________________
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |


Disadvantages of this method:
- All the patterns I have seen have been stationary, so you can get used
  to it.
- It is effective only in dark pictures; it is virtually unnoticeable in
  bright pictures.
- If TV/monitor uses sync tip clamping, banding becomes visible, although
  it is less disturbing and reversed:


..............                ......................              .........
              ................                      ..............
______________                ______________________              __________
| | | | | | | ________________| | | | | | | | | | | ______________| | | | |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |


Remedy: clamp to front or back porch and re-create sync.


Another method I have seen is to place a color subcarrier burst at the
bottom of the horizontal synchronization pulse:

..._      _MM___...
    |    | WW
    |MMMM|
     WWWW

The only effect I noticed was that the colors changed a little, when
switching between 'clean' sync and 'bursted' sync. Does anyone
guess what it is supposed to be doing?


OK, this is the end. Thank you for reading. Happy hacking.
----8<--------8<--------8<--------8<--------8<--------8<--------8<----
