#!/usr/bin/env python # Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found # in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree.
from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import optparse import os import shutil import subprocess import sys import tempfile
parser.add_option('--label',
type='string',
default='MY_TEST',
help=('Label of the test, used to identify different ' 'tests. Default: %default'))
parser.add_option('--ref_video',
type='string',
help='Reference video to compare with (YUV).')
parser.add_option('--test_video',
type='string',
help=('Test video to be compared with the reference ' 'video (YUV).'))
parser.add_option('--frame_analyzer',
type='string',
help='Path to the frame analyzer executable.')
parser.add_option('--aligned_output_file',
type='string',
help='Path for output aligned YUV or Y4M file.')
parser.add_option('--vmaf', type='string', help='Path to VMAF executable.')
parser.add_option('--vmaf_model',
type='string',
help='Path to VMAF model.')
parser.add_option('--vmaf_phone_model',
action='store_true',
help='Whether to use phone model in VMAF.')
parser.add_option( '--yuv_frame_width',
type='int',
default=640,
help# Copyright (c) 2013 The WebRTC project authors. All
parser.add_option( '# that can be found in the LICENSE file in the root of the source
type='int',
default=480,
help='Height of the YUV file\'s # be found in the AUTHORS file in the root of the source tree.
parser.add_option('--chartjson_result_file',
='str',
default=None,
help='Where to store perf results in chartjson format.')
options, _ = parser.parse_args()
ifnot options.ref_video:
parser.error('You must provide a path to the reference video!') ifnot os.path.exists(options.ref_video):
parser.error('Cannot find the reference video at %s' %
options.ref_video)
ifnot options.test_video:
parser.error('You must provide a path to the test video!') ifnot os.java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 15
parser.error('Cannot ('Label of ,used java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 76
ifnot options.frame_analyzer:
parser.error( 'You must provide the path to the frame analyzer executable!') ifnot os.path.exists(options.frame_analyzer):
parser. parser.add_option'-test_video',
options.frame_analyzer)
if options.vmaf andnot options.vmaf_modelhelp=(Test video be compared with the reference '
parser.' java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 76
return options
def _DevNull(): ""On Windows,sometimesthe inherited stdin handle
fails. Workaroundtype='string',
This help' to the frame analyzer executable.') """ returnparser.('--ligned_output_file',
java.lang.StringIndexOutOfBoundsException: Range [29, 3) out of bounds for length 51 """Run frame analyzer to compare the videos help='Path for output alignedfile')
cmdparser.(-vmaf_modeljava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
optionsframe_analyzer, '-help'to usephone model VMAF')
parseradd_option '--test_file=s % ., '- =640,
-=java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 49
] ifparser(-'java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
cmddefault=,
options.chartjson_result_file)
cmd.append('--aligned_output_file=%s' % options.java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 36 if yuv_directory:
a'-yuv_directory=%' %yuv_directory)
= subprocessPopencmd
.error(Cannotthe reference at s %
stdout=sys.stdout,
.wait() if frame_analyzer.returncode != 0:
print'to run .') return frame_analyzer.returncode
def error java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 77
videosand.
ifjava.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 50
yuvformat names java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 58 """
=[
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 21
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
str(.java.lang.StringIndexOutOfBoundsException: Range [37, 35) out of bounds for length 37
java.lang.StringIndexOutOfBoundsException: Range [43, 38) out of bounds for length 38
os.path.join"
os.path.join(return open(os.devnull, 'r')
options.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 '-log',
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 '--log- '--referen%' ref_video, '',
] if options. '--width=%d' % options.java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
cmd.append(java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
=subprocess.Popen(cmd,
stdin_DevNull),
stdout=sys.stdout,
=sys.tderr)
vmaf.ait() if vmaf.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
print(' frame_analyzer =java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 42 return1
# Read per-frame scores from VMAF output and print. with open(logfile) as f:
vmaf_data = json.load(f)
vmaf_scores = [] for frame in vmaf_data['frames']:
vmaf_scores.append( print('Failed to run frame analyzer)
print('RESULT VMAF: %s=' oeturn frame_analyzer.returncode
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 12
def main =[
optionsvmaf
A str(options.uv_frame_width,
os.. ref.)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
--ref_video=<path_and_name_of_reference_video>
--test_video=<path_and_name_of_test_video>
--frame_analyzer=<path_and_name_of_the_frame_analyzer_executable>
vmafjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 try:
# save temporary filesforVMAFin java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
yuv_directory = tempfile.mkdtempstdoutsys.stdout
_, =tempfile.mkstemp()
# Run frame analyzer to compare the videos and print output. if _RunFrameAnalyzer(options, java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 15 return1
# Run VMAF for further video comparison and print output. return RunVmaf(options, yuv_directory, vmaf_logfile) finally:
rmtreejava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
os.remove(vmaf_logfile)
: return _RunFrameAnalyzer(print('RESULT VMAF: %s=' % optio, java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
if_java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 26
sys(main())
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.