下载
git clone https://github.com/Telecommunication-Telemedia-Assessment/bitstream_mode3_p1204_3.git
Requirements
To be able to run the model you need to install some software. In addition, we suggest to have high enough free memory available – for a 10 second UHD-1 video sequence, 4 GB of memory should be sufficient.
Currently the model is only tested on Ubuntu >= 18.04.
git python3, python3-pip, python3-venv
poetry (e.g. pip3 install poetry)
ffmpeg bitstream_mode3_videoparser, will be installed automatically
all dependencies for the bitstream_mode3_videoparser are required
安装
1、本文使用的python版本是3.6.13.
2、首先安装一些依赖的工具。
pip3 install poetry
pip3 install virtualenv
virtualenv venv,然后再当前路径下增加了venv的目录。
下载_bz2.cpython-36m-x86_64-linux-gnu.so
chmod 755 _bz2.cpython-36m-x86_64-linux-gnu.so
然后把下载好的_bz2.cpython-36m-x86_64-linux-gnu.so放在/usr/local/lib/python3.6/lib-dynload/路径下,对应你自己安装的python3的路径。
source ./venv/bin/activate,如下
(venv) [xxx@xxx bitstream_mode3_p1204_3]#
3、执行。
(venv) [xxx@xxx bitstream_mode3_p1204_3]# poetry run p1204_3 test_videos/test_video_h264.mkv
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/data0/ffmpeg-roi/bitstream_mode3_p1204_3/p1204_3/__init__.py", line 10, in <module>
from p1204_3.model import P1204BitstreamMode3
File "/data0/ffmpeg-roi/bitstream_mode3_p1204_3/p1204_3/model.py", line 11, in <module>
from p1204_3.modelutils import map_to_45
File "/data0/ffmpeg-roi/bitstream_mode3_p1204_3/p1204_3/modelutils.py", line 6, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
根据执行过程中的提示,继续安装一些依赖。
pip3 install pandas
pip3 install scipy
pip3 install sklearn_json
需要把ffprobe放在./venv/bin/下,ffprobe可以从FFmpeg官网下载或者自己编译。
因为编译bitstream_mode3_videoparser依赖scons,还需要安装scons。
pip3 install scons
执行过程中会自动下载依赖的 bitstream_mode3_videoparser:
(venv) [xxx@xxx bitstream_mode3_p1204_3]# poetry run p1204_3 test_videos/test_video_h264.mkv
INFO:root:handle the following videos (# 1):
test_videos/test_video_h264.mkv
INFO:root:check or install video parser
INFO:root:clone and build video parser, this will take some time
Cloning into '/xxx/bitstream_mode3_p1204_3/p1204_3/bitstream_mode3_videoparser'...
remote: Enumerating objects: 6308, done.
remote: Counting objects: 100% (6308/6308), done.
remote: Compressing objects: 100% (4419/4419), done.
remote: Total 6308 (delta 1712), reused 6291 (delta 1695), pack-reused 0
Receiving objects: 100% (6308/6308), 13.36 MiB | 68.00 KiB/s, done.
Resolving deltas: 100% (1712/1712), done.
/xxx/bitstream_mode3_p1204_3/venv/bin/scons
configure, build and install ffmpeg
编译video parser过程中,根据实际环境修改build.sh,编译通过之后就可以使用了.
4、使用
可以得到每秒的得分和整个sequence的得分,如下:
(venv) [xxx@xxx bitstream_mode3_p1204_3]# poetry run p1204_3 aoli.mp4
INFO:root:handle the following videos (# 1):
/xxx/aoli.mp4
INFO:root:check or install video parser
INFO:root:video parser is checked out
INFO:root:video parser is build
INFO:root:run bitstream parser for /xxx/aoli.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/xxx/aoli.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100
Duration: 00:00:03.03, start: 0.000000, bitrate: 8304 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 8300 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (default)
Metadata:
handler_name : ?Mainconcept Video Media Handler
FrmNum: 0 FrmType: I FrmSize: 137880 POC: 0 Blcky: 0.000 0.000 0.031
FrmNum: 1 FrmType: B FrmSize: 7042 POC: 2 Blcky: 0.031 0.031 0.038
FrmNum: 2 FrmType: P FrmSize: 30030 POC: 4 Blcky: 0.003 0.002 0.052
FrmNum: 3 FrmType: B FrmSize: 11552 POC: 6 Blcky: 0.009 0.007 0.067
FrmNum: 4 FrmType: P FrmSize: 36166 POC: 8 Blcky: 0.002 0.002 0.051
FrmNum: 5 FrmType: B FrmSize: 11190 POC: 10 Blcky: 0.009 0.007 0.067
FrmNum: 6 FrmType: P FrmSize: 42467 POC: 12 Blcky: 0.002 0.001 0.047
FrmNum: 7 FrmType: B FrmSize: 16663 POC: 14 Blcky: 0.005 0.004 0.059
FrmNum: 8 FrmType: P FrmSize: 44131 POC: 16 Blcky: 0.001 0.001 0.047
FrmNum: 9 FrmType: B FrmSize: 16540 POC: 18 Blcky: 0.005 0.004 0.058
FrmNum: 10 FrmType: P FrmSize: 45339 POC: 20 Blcky: 0.001 0.001 0.047
FrmNum: 11 FrmType: B FrmSize: 18130 POC: 22 Blcky: 0.005 0.004 0.058
Writing stats to output file: ./tmp/aoli.json.bz2
INFO:root:use feature cache file ./tmp/aoli_feat.pkl
INFO:root:features extracted
[
{
"date": "2021-03-01 16:50:24.704629",
"debug": {
"baseline": 3.762936004800362,
"coding_deg": 23.213830474759376,
"rf_pred": 3.774329301102418,
"temporal_deg": 4.24464617766511,
"upscaling_deg": 11.497589538727595
},
"per_second": [
3.757771051573633,
3.8661782530254043,
3.7182273861626376
],
"per_sequence": 3.76863265295139,
"video_basename": "aoli.mp4",
"video_full_path": "/xxx/aoli.mp4"
}
]
INFO:root:store all results to reports