Altering motion vectors in B- and P- frames
Hello all, I want to alter the motion vectors of B and P frames in a H.264 video. The point of doing this is watermarking / steganography, the goal is to change the motion vectors' width / height based on the watermark. For this, I wanted to try if I can use ffmpeg for this. As far as I can see there is no way for me to edit the motion vectors the H.264 encoder generates. I have considered the AVFilters (at which point the motion vectors don't exist yet) and BitStreamFilters (which are so generic that they don't know about motion vectors, nor can they alter them). Is this correct? If this is incorrect, how would I start altering the motion vectors? I have found multiple software solutions and libraries that can provide me the motion vectors, but no way to alter them. I am willing to go into the source code of FFMPEG or some other encoder to see how I can alter the source code so it will support my use case. I hope I have provided you with enough information and can help me in some way with this. If you have any questions or would need more information, please let me know.
On 26/05/2024 14.18, Bart Westenenk wrote:
Hello all,
I want to alter the motion vectors of B and P frames in a H.264 video. The point of doing this is watermarking / steganography, the goal is to change the motion vectors' width / height based on the watermark.
Motion vectors don't work like you're visualizing, Bart. Motion vectors move macroblocks measuring 16x16 pixels from a reference picture to the current picture, then apply individual pixel corrections to finish the destination picture's macroblock. It's more complex than that because the destination macroblock will not be on macroblock boundaries, so the moved macroblock needs to be merged into the destination's macroblock geometry. Your plan to somehow use motion vectors to watermark is not feasible.
participants (2)
-
Bart Westenenk -
Mark Filipak