Opencv下視頻的讀寫

1. 視頻結構
一個視頻由壓縮格式(container, eg. avi, mkv...)和封裝格式(codec, eg. H264, DIVX)組成.

詳細解釋:源自[1]

For start, you should have an idea of just how a video file looks. Every video file in itself is a container. The type of the container is expressed in the files extension (for example avi, mov or mkv). This contains multiple elements like: video feeds, audio feeds or other tracks (like for example subtitles). How these feeds are stored is determined by the codec used for each one of them. In case of the audio tracks commonly used codecs are mp3 or aac. For the video files the list is somehow longer and includes names such as XVID, DIVX, H264 or LAGS (Lagarith Lossless Codec). The full list of codecs you may use on a system depends on just what one you have installed.

2. Linux下opencv對container和codec的支持
Linux下opencv對codec的支持由系統的FFMpeg庫決定, 而container, opencv目前好像只支持avi.
如果出現"[mp4 @ 0xcb0f40] Tag mp4v/0x7634706d incompatible with output codec id '13'"等類似錯誤, 是由於輸出視頻的後綴不是".avi"引起.
Reference
[1] Creating a video with OpenCV
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章