• Stars
    star
    253
  • Rank 160,776 (Top 4 %)
  • Language
    C++
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tool for easy extraction of motion vectors stored in video files

Information & Contact

We release mpegflow for easy extraction of MPEG-flow (motion vectors) from video files along with a visualization tool vis, both under the MIT license. We provide Makefiles for Linux / Windows and distribute binary releases.

Please submit bugs on GitHub directly. For any other question, please contact Vadim Kantorov at [email protected] or [email protected].

If you use this code, please cite our work:

@inproceedings{kantorov2014,
      author = {Kantorov, V. and Laptev, I.},
      title = {Efficient feature extraction, encoding and classification for action recognition},
      booktitle = {Proc. Computer Vision and Pattern Recognition (CVPR), IEEE, 2014},
      year = {2014} }

Below is a visualization of some flow maps of MPI Sintel's alley_1 sequence:

Source 3 15 50
mpegflow
Ground truth

mpegflow

The tool accepts a video file path as command-line argument and writes MPEG-flow (motion vectors) to standard output. By default, the tool outputs the motion vectors arranged in two matrices - dx and dy.

Command-line options:
Option Description
--help or -h will output the usage info
--raw will prevent motion vectors from being arranged in matrices
--grid8x8 will force fine 8x8 grid
--occupancy will append occupancy matrix after motion vector matrices
--quiet will suppress debug output

vis

The tool accepts a video file path and a dump directory as command-line arguments, output of mpegflow on standard input and saveson disk the visualization of motion vectors overlayed on video frames.

Command-line options:
Option Description
--help or -h will output the usage info
--occupancy will expect occupancy information from mpegflow and will visualize it as well

Examples

  • To extract motion vectors:

    ./mpegflow examples/mpi_sintel_final_alley_1.avi > examples/alley_1.txt

  • To visualize motion vectors:

    mkdir -p examples/vis_dump && ./mpegflow examples/mpi_sintel_final_alley_1.avi | ./vis examples/mpi_sintel_final_alley_1.avi examples/vis_dump

Feel free to copy-paste and run the examples above. More runnable examples are in examples/extract_motion_vectors.sh and examples/vis_motion_vectors.sh. Feel free to use vis.cpp and examples/vis_hue.m as examples of parsing mpegflow output. examples/vis_hue can also be used to produce hue flow visualizations like above.

Building from source

mpegflow depends only on a recent FFmpeg, vis depends on FFmpeg, OpenCV and libpng. The tools are known to work with FFmpeg 3.1 and OpenCV 3.1.

Once the dependencies are visible to g++, run:

make     # to build mpegflow
make vis # to build vis

You will probably end up with a shared build; for a static build, please feel free to play with Makefile.

To build the tools on Windows:

  1. Create directory dependencies
  2. Extract FFmpeg dev and shared builds to the dependencies directory (for mpegflow and vis)
  3. Extract an OpenCV 3.x build to the dependencies directory (for vis)
  4. Open VS2015 x64 Native Tools Command Prompt (VS2015 Community Edition will work) and run:
# fix the paths and versions before running

nmake mpegflow.exe FFMPEG_DIR=dependencies\ffmpeg-3.0.1-win64-dev\ffmpeg-3.0.1-win64-dev
# nmake vis.exe OPENCV_DIR=dependencies\opencv-3.1.0\opencv\build\x64\vc14
  1. The Windows build is not fully static. You need to keep avutil-54.dll, avformat-56.dll, avcodec-56.dll, swresample-2.dll (for mpegflow) and opencv_world310.dll (for vis) in the same directory as the binary. Note that the instructions and the Makefile assume x64 machine architecture.

More Repositories

1

caffemodel2pytorch

Convert Caffe models to PyTorch
Python
358
star
2

fastvideofeat

Efficient feature extraction, aggregation and classification for action recognition (CVPR 2014)
TeX
111
star
3

contextlocnet

ContextLocNet: Context-aware Deep Network Models for Weakly Supervised Localization (ECCV 2016)
Lua
88
star
4

ctc

Primer on CTC implementation in pure Python PyTorch code
Python
83
star
5

metriclearningbench

Metric learning models in PyTorch with results on CUB2011, CARS196, Stanford Online Products
Python
65
star
6

caffemodel2json

A small tool to dump Caffe's *.caffemodel to JSON for inspection
Python
40
star
7

convasr

Baseline convolutional ASR system in PyTorch
HTML
21
star
8

discordspeechtotext

Discord Speech-To-Text bot in Python using Google Cloud Speech-To-Text API
Python
21
star
9

tfcheckpoint2pytorch

Converts TensorFlow checkpoints (with index, meta and data files) to PyTorch, HDF5 and JSON
Python
18
star
10

wemosetup

A simple Python script to set up WeMo devices
Python
16
star
11

tsp-bb

Implementation of branch-and-bound for TSP in C++
C++
13
star
12

wigwam

A humane dependency fetcher for scientific projects
Python
10
star
13

readaudio

Read audio with FFmpeg into NumPy/PyTorch via ctypes (standard library module)
C
10
star
14

inferspeech

PyTorch speech2text inference script for the NVidia openseq2seq wav2letter model variant
Python
9
star
15

yet_another_pytorch_slot_attention

Reimplementation of Slot Attention (object discovery task) in PyTorch with converted checkpoint
Python
7
star
16

busyboxnanozipdiff3

Build script of BusyBox for WebAssembly (wasm) using Emscripten
C
6
star
17

mask2cad_pytorch

Python
6
star
18

echomsk

Crawler and parser utilities for Russian talk radio echo.msk.ru
Python
6
star
19

dotnetlibtorch

The simplest possible interfacing of C# and libtorch via DLPack P/Invoke wrapper around C function and structures
C#
5
star
20

pydlpack

Create a DLPack tensor in plain C library, wrap DLPack structures in Python, import DLpack tensor into NumPy / PyTorch
C
4
star
21

zrxiv

HTML
4
star
22

selective_search_pytorch

Selective Search reimplementation in PyTorch that allows to extract not only the bounding boxes, but also the region masks
C++
4
star
23

natudump

Scraping LegiFrance naturalisation decrees for fun and OSINT profit
Python
3
star
24

prostoboxes

A one-file, zero-dependency bounding box image annotation HTML user interface
Python
2
star
25

convdia

Jupyter Notebook
2
star
26

gittex

JavaScript
2
star
27

lexical-playground-only

TypeScript
2
star
28

busytex

[WIP] TexLive 2020 compiled with Emscripten into WebAssembly and bundled into a single executable
JavaScript
1
star
29

paws

Minimal scripts for spinning EC2 instances and running Deep Learning jobs
Python
1
star
30

vosges

Vosges is a simple Python tool for generating and running Sun Grid Engine (SGE) jobs, with a nice HTML dashboard
Python
1
star
31

UBR

Python
1
star
32

torchwav

Adaptation of wave and scipy.io.wavfile for reading .WAV audio format in PyTorch
Python
1
star
33

busyidetest

1
star
34

open_stt_splits

Python
1
star