One more thing, I replaced C308 and C312. C312 on the board differed from the schematic (1nF instead of 300pF) so I used a 300pF. These replacements made no difference to the picture. So, I seem to have replaced every cap in the vertical section to no avail.
Here's a test image which I knocked up in GWBASIC. Just rows of dashes, but the top is where the image is stretched most, then the second line is where it is compressed most, then the GWBASIC menu is where the image is normal.
Take a look at the waveform at TP2, which seems to show the raster structure from the vertical scan perspective.
I can see where the three rows are, and the vertical lines that look to me like noise on the ramps must correspond to each of the visible scan lines; then, at the top of the ramp we have the frame flyback (big vertical line dropping, ready for the next frame). Am I interpreting it correctly?
If so, I would expect to see the scan lines well spaced out at the start of the frame, getting closer together around the position of the second line, then spreading out to normal thereafter, but it doesn't seem to be the case. I've zoomed in and I can't see any tightening of the timings between the lines. Which in turn implies the TDA1170 is doing its job properly, but something else isn't.
There are some shorter scan lines at the start of the frame (highlighted in red), is this normal? Front porch?
It looks like a bad cap somewhere, but I have replaced many of them: C310, C301, C311, C302, C307, C309, C303, C306, C300, C308, C312. I think that is all the Vertical Section caps replaced now.
Looking at TP3's waveform, I think there is a correlation between the ramp down and the image, just like TP2, only this time the gradient is changing in a way that seems to mirror the compression of the image. Does that make sense?