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

14 則留言:

Majortotosite Pro 提到...

It’s in point of fact a nice and helpful piece of information. I am satisfied that you simply
shared this helpful information with us. Please stay us informed like this. 토토사이트

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. 온라인경마

Oncasinosite Net 提到...

You made some really good points there. I checked on the net to learn more about the issue and found most people will go along with your views on this web site. 바카라

Totopick Pro 提到...

If you jumble everything together, trying to get the most material you can get on one page, readers will become overwhelmed. 사설토토

SAFE SITES18 提到...

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


SAFE SITES18 提到...

Usually I do not read article on blogs, but I would like to say that this write-up very forced me to take a look at and do so! Your writing style has been surprised me. Thanks, quite nice post. 바둑이사이트넷

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.

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

gostopsite 提到...



It’s remarkable to discover somebody who has an admitted thought on this point.
고스톱
고스톱사이트
토토사이트
고스톱