Add WriteVideoToFile to video_file_reader.
The function checks the file extension to determine YUV or Y4M format.
Also adds a flag aligned_output_file to compare_videos.py, which allows
saving the aligned reference video to a file.
Bug: webrtc:9642
Change-Id: Ia59f5c123a1e41104756eb6b235b6581c4ffbd77
Reviewed-on: https://webrtc-review.googlesource.com/99503
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Paulina Hensman <phensman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24787}
diff --git a/rtc_tools/compare_videos.py b/rtc_tools/compare_videos.py
index 40a2aab..d9cb670 100755
--- a/rtc_tools/compare_videos.py
+++ b/rtc_tools/compare_videos.py
@@ -36,6 +36,8 @@
'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('--barcode_decoder', type='string',
help=('Path to the barcode decoder script. By default, we '
'will assume we can find it in barcode_tools/'
@@ -127,7 +129,7 @@
"""The main function.
A simple invocation is:
- ./webrtc/rtc_tools/barcode_tools/compare_videos.py
+ ./webrtc/rtc_tools/compare_videos.py
--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>
@@ -165,6 +167,8 @@
]
if options.chartjson_result_file:
cmd.append('--chartjson_result_file=%s' % options.chartjson_result_file)
+ if options.aligned_output_file:
+ cmd.append('--aligned_output_file=%s' % options.aligned_output_file)
frame_analyzer = subprocess.Popen(cmd, stdin=_DevNull(),
stdout=sys.stdout, stderr=sys.stderr)
frame_analyzer.wait()