Motionvectors¶
Auto-generated documentation for musicalgestures._motionvectors module.
- Mgt-python / Modules / Musicalgestures / Motionvectors
mg_motionvectors¶
Renders a video visualising the motion vectors encoded in the input video.
Inter-frame codecs (MPEG-1/2/4, H.264, H.265, …) store motion vectors that describe
how macroblocks move between frames. This method uses FFmpeg's codecview filter
(with -flags2 +export_mvs) to draw those vectors as arrows on top of the video,
giving a quick, decoder-level view of motion without any re-computation.
NB: Only codecs that actually carry motion vectors will show arrows. Intra-only
formats (e.g. MJPEG, common in .avi files) have none — convert to an inter-frame
codec first (e.g. via show(mode='notebook') which makes an mp4, or any mp4/h264
source) to see motion vectors.
Arguments¶
target_namestr, optional - Target output name for the video. Defaults to None (which uses the input filename with the suffix "_motionvectors").overwritebool, optional - Whether to allow overwriting existing files or to automatically increment the target filename. Defaults to True.
Returns¶
MgVideo- An MgVideo pointing to the rendered motion-vector video.