2007年6月11日 星期一

Motion Vector Extraction

為了做 MULTIMEDIA ANALYSIS AND INDEXING 這門課的 project,我們這組需要從 MPEG video 裡面取出 motion vector(它在 MPEG video 裡的用途是用來做壓縮。一個物體在畫面裡面移動時,其實只需要描述它的位移,而不需整個重新 encode)。

不知道是不是因為大部分的人需要的都是 video 的 frame,而不是 motion vector(其實在解壓縮時只差一步),我 google 了好久都找不到工具可以用。後來發現 ffmpeg 的 ffplay 可以直接把 motion vector 邊撥邊畫出來,但是還是沒辦法 dump 出來。

$ ffplay -vismv 3 xxx.mpg

vismv 那個參數其實是三個 bit,第一個 bit 代表 P-Frame,第二個代表 B-Frame 的 forward motion vector,第三個 bit 則是 B-Frame 的 backward vector。

不過,這只能看。所以我參考 Using libavformat and libavcodec 跟 ffplay 的 source code 寫了一個程式。這個程式可以把 video 每個 frame (除了沒有 motion vector 的 I-Frame)的 motion vector 取出來。如果要改成取第幾個 frame、或是某個 range 之類的,也很好改。

g++ compile 時需要加上 -lavcodec -lavformat 兩個參數,當然也要先裝上 libavcodec 跟 libavformat 兩個 library。有裝 ffmpeg 就會有。

http://cmlab.csie.org/~victor/archive/motion_vector.cpp

13 則留言:

Racesite Pro 提到...

Hey there. I discovered your web site by way of Google at the same time as searching for a similar subject, your site got here up. It looks great. I have bookmarked it in my google bookmarks to come back then. 온라인경마

SAFE SITES18 提到...

I really loved reading your blog. I also found your posts very interesting. 바카라사이트인포


SAFE SITES18 提到...

Thanks for your outstanding article. You know how to get your readers' attention. 바카라사이트윈

casinositewiki 提到...

I have taken this blog that written very well. I like you.
카지노사이트위키
온라인카지노사이트
카지노사이트탑
바카라사이트

oncasinosite 提到...

Thanks for sharing nice information here. Keep it up
카지노사이트
온라인카지노
카지노
바카라

safetotosite18 提到...

This is the perfect post. It helped me a lot.
안전토토사이트
먹튀검증

casinositeone.JDS 提到...


You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. Feel free to visit my website;
카지노사이트원
카지노사이트
바카라사이트

casinosite777infoJDS 提到...

I was very pleased to find this page. I wanted to thank you for your time due to this wonderful read!! I definitely loved every part of it and I have you bookmarked to check out new information on your blog 카지노사이트777
카지노사이트
바카라사이트

casinositezoneJDS 提到...


Everything is very open with a precise clarification of the issues. It was really informative.

카지노사이트존
카지노사이트
바카라사이트

SpOrTsToToToP 提到...

I AM VERY COMFORTABLE TO THIS BEAUTIFUL CONTENT FROM THE PURE READING.THANKS FOR KEEN UP THE GOOD WORK.
*******

William Stephen 提到...

I really enjoyed reading the above article. It is very pleasant to read. Shenandoah Traffic Lawyer

Alex 提到...

winchester traffic lawyer
A Winchester traffic lawyer assists clients facing traffic violations in Winchester, Virginia. They navigate legal proceedings, negotiate with prosecutors, and strive to minimize penalties or dismiss charges when possible.

edward john 提到...

The author needs more context to write a review comment on motion vector extraction. They suggest referring to specific tools like OpenCV, PyTorch, and TensorFlow, and evaluating their accuracy, efficiency, ease of use, and documentation. When evaluating a tool, consider accuracy, efficiency, ease of use, features, and community and support. The tool should capture the movement of objects in video, be fast, easy to use, offer advanced features, and have a large user community.
motorcycle accident attorneys