vmaf 安装使用

本文档介绍了如何安装和使用VMAF,包括通过ffmpeg进行PSNR计算和2VMAF的操作步骤。
部署运行你感兴趣的模型镜像

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

您可能感兴趣的与本文相关的镜像

Python3.11

Python3.11

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值