Check this thread for some ideas.
Generally, having this inside the parser seems like the wrong way forward. This should be done in a separate element, either by directly making use of the codec parser APIs and modifying the bitstream accordingly, or via the new API mentioned in that thread.