Baby banging head on my chest

AB

Hi,

I been trying to put my baby to sleep. The 4 week old woke up from deep sleep and started to shout and kick both legs and hands as if trying to fight something . I picked up immediately and tried to console with no luck. Used a pacifier . I tried to feed again and once done tried to put him to sleep but he is wide awake and being a bit fussy .I tried to rest on my chest and he is banging his head vigorously and crying. So I gave the pacifier again . He isn’t sleeping but kicking his hands and legs and suddenly crying and stops when I change position. Any clues what’s he trying to tell me