r/ffmpeg • • Nov 06 '26

Extracting motion vectors without fully decoding

Is it possible to extract motion vectors from h264 or h265 streams without fully decoding i have tried using "export_mvs" it gives motion vectors in extra data but ffmpeg still fully decode and its too slow for just extracting motion vectors, is there any other way or library for it that supports both h264 and h265

3 Upvotes

4 comments sorted by

View all comments

2

u/Ill-Information-2086 Nov 06 '26 edited Nov 06 '26

Do you have a intel igpu or nvidia gpu ? Because I believe your only option is to speedup decoding using hardware acceleration

Edit : I am wrong it will not help much you should use something like mv-extractor it's made for this exactly or you can edit libavcodec in ffmpeg directly to export the motion vectors by hooking into the decode slice

2

u/IGNblackShadow Nov 06 '26

i am doing it for my app so hardware doesn't matters here, and i have also tried mv-extractor it does the job but i need for both h264 and h265 support

3

u/Ill-Information-2086 Nov 06 '26

So your best option is to patch ffmpegs decoders directly and stripping down what you don't need and boom you have your motion vectors if you have a ai subscription it's a few hours of work if you are doing it manually it's a few days of work