vmaf 安装使用

vmaf安装

# 系统版本 MacOS 10.13.2
brew install gcc freetype pkg-config homebrew/science/hdf5 python
# 替换 MacOS 自带的 Python
echo "export PATH=/usr/local/opt/python/libexec/bin:$PATH" >> ~/.bash_profile
source ~/.bash_profile
brew install numpy scipy
# 和 README 不一样的是用了 pip2 命令
pip2 install matplotlib notebook pandas sympy nose scikit-learn h5py
# 安装 vmaf
git clone https://github.com/Netflix/vmaf.git
cd vmaf
git submodule update --init --recursive
make
echo export PYTHONPATH="$(pwd)/python/src:$(pwd)/sureal/python/src:$PYTHONPATH" >> ~/.bash_profile
source ~/.bash_profile

echo 'FFMPEG_PATH = "/usr/local/bin/ffmpeg"' >> /Users/mj/vmaf/python/src/vmaf/externals.py

ffmpeg2psnr

#!/usr/bin/env bash

if [ ""$1 == "" ]; then
  echo "error: ffmpeg2psnr src.flv dst.flv [fmt]"
  exit
fi

if [ ""$2 == "" ]; then
  echo "error: ffmpeg2psnr src.flv dst.flv [fmt]"
  exit
fi

src=$1
dst=$2
fmt=yuv420p
if [ ""$3 != "" ]; then
  fmt=$3
fi

width=`ffprobe -i ${src} -print_format json -show_streams -select_streams v:0 |grep '"width"' |awk '{print $2}' |awk -F ',' '{print $1}'`
height=`ffprobe -i ${src} -print_format json -show_streams -select_streams v:0 |grep '"height"' |awk '{print $2}' |awk -F ',' '{print $1}'`

dir="/tmp/psnr/"
srcDst=$dir$src
dstDst=$dir$dst

mkdir -p $dir${src%/*}
mkdir -p $dir${dst%/*}

ffmpeg -i $src  -vsync 0 $srcDst.yuv -y
ffmpeg -i $dst  -vsync 0 $dstDst.yuv -y

echo "File" $src.yuv $dst.yuv $width $height $fmt
run_psnr $fmt $width $height $srcDst.yuv $dstDst.yuv

/bin/rm $srcDst.yuv $dstDst.yuv

ffmpeg22vmaf

#!/usr/bin/env bash

if [ ""$1 == "" ]; then
  echo "error: ffmpeg22vmaf src.flv dst.flv [fmt]"
  exit
fi

if [ ""$2 == "" ]; then
  echo "error: ffmpeg22vmaf src.flv dst.flv [fmt]"
  exit
fi

src=$1
dst=$2
fmt=yuv420p
if [ ""$3 != "" ]; then
  fmt=$3
fi

width=`ffprobe -i ${src} -print_format json -show_streams -select_streams v:0 |grep '"width"' |awk '{print $2}' |awk -F ',' '{print $1}'`
height=`ffprobe -i ${src} -print_format json -show_streams -select_streams v:0 |grep '"height"' |awk '{print $2}' |awk -F ',' '{print $1}'`

dir="/tmp/vmaf/"
srcDst=$dir${src}
dstDst=$dir${dst}

mkdir -p $dir${src%/*}
mkdir -p $dir${dst%/*}

ffmpeg -i $src  -vsync 0 $srcDst.yuv -y
ffmpeg -i $dst  -vsync 0 $dstDst.yuv -y

echo "File" $srcDst.yuv $dstDst.yuv $width $height $fmt
run_vmaf $fmt $width $height $srcDst.yuv $dstDst.yuv --phone-model

/bin/rm $srcDst.yuv $dstDst.yuv

你可能感兴趣的:(工具)