| | 4 | |
| | 5 | == Analyzing Motion Vectors == |
| | 6 | |
| | 7 | The [http://ffmpeg.org/ffmpeg-all.html#codecview `codecview` filter] can be used to show motion vectors as small arrows for each macroblock. It takes one option called `mv`, which specifies the type of motion vector to be drawn: |
| | 8 | |
| | 9 | * `pf` – forward predicted motion vectors of P pictures |
| | 10 | * `bf` – forward predicted motion vectors of B pictures |
| | 11 | * `bb` – backward predicted motion vectors of B pictures |
| | 12 | |
| | 13 | For example, you can use: |
| | 14 | {{{ |
| | 15 | ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb |
| | 16 | ffmpeg -flags2 +export_mvs -i input.mp4 -vf codecview=mv=pf+bf+bb output.mp4 |
| | 17 | }}} |
| | 18 | |
| | 19 | Example: |
| | 20 | |
| | 21 | [[Image(vismv_pf.png)]] |
| | 22 | |
| | 23 | Caveats: |
| | 24 | * Earlier versions of ffmpeg do not have this filter, but support the now deprecated `-vismv` option. |
| | 25 | * This option does not work for codecs which do not export motion vectors (most non-MPEG based codecs) |
| | 26 | |
| | 27 | |
| | 28 | ---- |
| | 29 | |
| | 30 | |
| | 31 | '''The following sections apply to ffmpeg versions older than October 21 2017.''' |
| 44 | | |
| 45 | | == Analyzing Motion Vectors == |
| 46 | | |
| 47 | | The [http://ffmpeg.org/ffmpeg-all.html#codecview `codecview` filter] can be used to show motion vectors as small arrows for each macroblock. It takes one option called `mv`, which specifies the type of motion vector to be drawn: |
| 48 | | |
| 49 | | * `pf` – forward predicted motion vectors of P pictures |
| 50 | | * `bf` – forward predicted motion vectors of B pictures |
| 51 | | * `bb` – backward predicted motion vectors of B pictures |
| 52 | | |
| 53 | | For example, you can use: |
| 54 | | {{{ |
| 55 | | ffplay -flags2 +export_mvs input.mp4 -vf codecview=mv=pf+bf+bb |
| 56 | | ffmpeg -flags2 +export_mvs -i input.mp4 -vf codecview=mv=pf+bf+bb output.mp4 |
| 57 | | }}} |
| 58 | | |
| 59 | | Example: |
| 60 | | |
| 61 | | [[Image(vismv_pf.png)]] |
| 62 | | |
| 63 | | Caveats: |
| 64 | | * Earlier versions of ffmpeg do not have this filter, but support the now deprecated `-vismv` option. |
| 65 | | * This option does not work for codecs which do not export motion vectors (most non-MPEG based codecs) |