Boredom has distinct physical and mental qualities.
Investigation of these qualities is by definition the antithesis of boredom.
For me, there seem to be two kinds.
One is a dull heavy blanket that makes me lean to one side or slump.
Paradoxically, at the same time the mind is exhausting itself running in circles half-awake, thinking about everything and nothing.
When I feel bored and tired it's actually because my mind is exhausting itself this way.
Noticing this and coming back to the object of meditation helps redirect all that energy.
It's amazing how bored sleepiness dissipates when re-collecting the mind onto the breath.
I'd say this boredom's root is ignorance, ignoring this present experience.
Just coming back to what you're doing is a good antidote.
The other main kind of boredom is resentful.
I don't WANT to be doing this, this chore needs to be done or that book would be a lot more interesting.
Thoughts and agitation can feel like bees trapped in a jar.
I'd say this boredom's root is aversion, obviously to meditation.
Your choice of antidotes to aversion will help.
I try to think something like, "I know this is worthwhile, and for the benefit of others. What a precious opportunity that few get! I shouldn't waste it."
Anything to engender the gratitude and energy that are helpful in meditation.
It's extremely hard to sit through agitated boredom.
But a lot of meditation is precisely this kind of fact finding.
What are the qualities of my experience?
How will I recognize them in the future and not get swept away?
What happens if I watch this rise and fall?
Usually we don't let it get to the "fall" stage before reacting, including boredom.
Also, Henepola Gunaratana said that if you're bored during breathing/walking meditation, you can rest assured that you haven't properly investigated your object.
That is, you've already made the breath or a step into a two-dimensional picture to put on a mental shelf.
It no longer reflects the vibrant vitality of experience.
Finally, one antidote to boredom that I find fascinating is being like a mental gatekeeper.
Watch your object closely, and try to notice the sensation right before the mind tries to shift to something else.
You may be surprised at what you notice.