[FFmpeg-user] Altering motion vectors in B- and P- frames

Bart Westenenk bart at westenenk.me
Sun May 26 21:18:21 EEST 2024

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 
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.

More information about the ffmpeg-user mailing list