Many times when we see a video on mobile devices is badly cropped, it is not much you can do about it. Understanding this problem, Google’s AI’s team has built an open-source solution on top of MediaPipe, Autoflip, which can reframe a video that fits any device or dimension (landscape, portrait, etc.).
AutoFlip works in three phases. The first phase includes scene detection; the second is the video content analysis, and the third is reframing. For this tool, if a video and a target dimension are given, it analyzes the video content. Later it develops optimal tracking and cropping strategies, which finally enables it to create an output video at the same time limit in the desired aspect ratio.
Unlike traditional approaches for reframing, AutoFlip does not require video curators instead its totally automatic using artificial intelligence.
Run the following command to build the AutoFlip pipeline:
bazel build -c opt --define MEDIAPIPE_DISABLE_GPU=1 mediapipe/examples/desktop/autoflip:run_autoflip
GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/autoflip/run_autoflip \ --calculator_graph_config_file=mediapipe/examples/desktop/autoflip/autoflip_graph.pbtxt \ --input_side_packets=input_video_path=/absolute/path/to/the/local/video/file,output_video_path=/absolute/path/to/save/the/output/video/file,aspect_ratio=1:1