Created
June 22, 2018 22:56
-
-
Save jhallard/09b310af5ceb460188452e8f304cd1b5 to your computer and use it in GitHub Desktop.
Visualize the motion vectors in an h264 encoded video using ffmpeg and vlc (works on OSX)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vis_motion_vectors () | |
{ | |
if [ "$#" -lt 1 ]; then | |
echo "Need an input file"; | |
return 1; | |
else | |
ffmpeg -y -loglevel error -flags2 +export_mvs -i "$1" -vf codecview=mv=pf+bf+bb /tmp/motion_vectors.mp4; | |
case "$(uname -s)" in | |
Linux*) vlc /tmp/motion_vectors.mp4;; | |
Darwin*) open /tmp/motion_vectors.mp4 -a vlc;; | |
*) echo "unknown platform, unable to run. open /tmp/motion_vectors.mp4 in VLC manually";; | |
esac | |
fi | |
} | |
# use like | |
# $ use_motion_vectors /tmp/video.mp4 | |
# it will open VLC with a new video that has the motion vectors encoded over the video |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment