本文整理汇总了Python中verify.verify_video函数的典型用法代码示例。如果您正苦于以下问题:Python verify_video函数的具体用法?Python verify_video怎么用?Python verify_video使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了verify_video函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_record_to_file
def test_record_to_file(camera, previewing, resolution, filenames_format_options):
filename1, filename2, format, options = filenames_format_options
if resolution == (2592, 1944) and 'resize' not in options:
pytest.xfail('Cannot encode video at max resolution')
if resolution == (1920, 1080) and format == 'mjpeg':
pytest.xfail('Locks up camera')
camera.start_recording(filename1, **options)
try:
camera.wait_recording(1)
verify2 = (
format != 'h264' or (
options.get('inline_headers', True) and
options.get('bitrate', 1)
)
)
if verify2:
camera.split_recording(filename2)
camera.wait_recording(1)
else:
with pytest.raises(picamera.PiCameraRuntimeError):
camera.split_recording(filename2)
finally:
camera.stop_recording()
if 'resize' in options:
resolution = options['resize']
verify_video(filename1, format, resolution)
if verify2:
verify_video(filename2, format, resolution)
开发者ID:RoboPython,项目名称:picamera,代码行数:28,代码来源:test_record.py
示例2: test_circular_record
def test_circular_record(camera, previewing, resolution):
if resolution == (2592, 1944):
pytest.xfail('Cannot encode video at max resolution')
stream = picamera.PiCameraCircularIO(camera, seconds=4)
camera.start_recording(stream, format='h264')
try:
# Keep recording until the stream is definitely full and starts
# removing earlier bits, or until 20 seconds
start = time.time()
while stream._length < stream._size and time.time() - start < 20:
camera.wait_recording(1)
# Record one more second, then test the result
camera.wait_recording(1)
finally:
camera.stop_recording()
temp = tempfile.SpooledTemporaryFile()
for frame in stream.frames:
if frame.header:
stream.seek(frame.position)
break
while True:
buf = stream.read1()
if not buf:
break
temp.write(buf)
temp.seek(0)
verify_video(temp, 'h264', resolution)
开发者ID:RoboPython,项目名称:picamera,代码行数:27,代码来源:test_record.py
示例3: test_record_to_file
def test_record_to_file(camera, previewing, mode, filenames_format_options):
filename1, filename2, format, options = filenames_format_options
resolution, framerate = mode
expected_failures(resolution, format, options)
camera.start_recording(
filename1,
# Check that in the case of cooked formats, capture correctly
# derives the format from the extension
format=format if format in RAW_FORMATS else None,
**options
)
try:
camera.wait_recording(1)
verify2 = format != "h264" or (options.get("inline_headers", True) and options.get("intra_period", 1))
if verify2:
camera.split_recording(filename2)
camera.wait_recording(1)
else:
with pytest.raises(picamera.PiCameraRuntimeError):
camera.split_recording(filename2)
finally:
camera.stop_recording()
if "resize" in options:
resolution = options["resize"]
verify_video(filename1, format, resolution)
if verify2:
verify_video(filename2, format, resolution)
开发者ID:julianscheel,项目名称:picamera,代码行数:27,代码来源:test_record.py
示例4: test_record_to_stream
def test_record_to_stream(camera, previewing, resolution, format_options):
format, options = format_options
if resolution == (2592, 1944) and 'resize' not in options:
pytest.xfail('Cannot encode video at max resolution')
if resolution == (1920, 1080) and format == 'mjpeg':
pytest.xfail('Locks up camera')
stream1 = tempfile.SpooledTemporaryFile()
stream2 = tempfile.SpooledTemporaryFile()
camera.start_recording(stream1, format, **options)
try:
camera.wait_recording(1)
verify2 = (
format != 'h264' or (
options.get('inline_headers', True) and
options.get('bitrate', 1)
)
)
if verify2:
camera.split_recording(stream2)
camera.wait_recording(1)
else:
with pytest.raises(picamera.PiCameraRuntimeError):
camera.split_recording(stream2)
finally:
camera.stop_recording()
stream1.seek(0)
if 'resize' in options:
resolution = options['resize']
verify_video(stream1, format, resolution)
if verify2:
stream2.seek(0)
verify_video(stream2, format, resolution)
开发者ID:RoboPython,项目名称:picamera,代码行数:32,代码来源:test_record.py
示例5: test_record_to_stream
def test_record_to_stream(camera, previewing, mode, format_options):
format, options = format_options
resolution, framerate = mode
expected_failures(resolution, format, options)
stream1 = tempfile.SpooledTemporaryFile()
stream2 = tempfile.SpooledTemporaryFile()
camera.start_recording(stream1, format, **options)
try:
camera.wait_recording(1)
verify2 = format != "h264" or (options.get("inline_headers", True) and options.get("intra_period", 1))
if verify2:
camera.split_recording(stream2)
camera.wait_recording(1)
else:
with pytest.raises(picamera.PiCameraRuntimeError):
camera.split_recording(stream2)
finally:
camera.stop_recording()
stream1.seek(0)
if "resize" in options:
resolution = options["resize"]
verify_video(stream1, format, resolution)
if verify2:
stream2.seek(0)
verify_video(stream2, format, resolution)
开发者ID:julianscheel,项目名称:picamera,代码行数:25,代码来源:test_record.py
示例6: test_circular_record
def test_circular_record(camera, mode):
resolution, framerate = mode
expected_failures(resolution, "h264", {})
stream = picamera.PiCameraCircularIO(camera, seconds=4)
camera.start_recording(stream, format="h264")
try:
# Keep recording until the stream is definitely full and starts
# removing earlier bits, or until 20 seconds
start = time.time()
while stream._length < stream._size and time.time() - start < 20:
camera.wait_recording(1)
# Record one more second, then test the result
camera.wait_recording(1)
finally:
camera.stop_recording()
temp = tempfile.SpooledTemporaryFile()
for frame in stream.frames:
if frame.header:
stream.seek(frame.position)
break
while True:
buf = stream.read1()
if not buf:
break
temp.write(buf)
temp.seek(0)
verify_video(temp, "h264", resolution)
开发者ID:julianscheel,项目名称:picamera,代码行数:27,代码来源:test_record.py
示例7: test_record_sequence_to_file
def test_record_sequence_to_file(camera, mode, tempdir):
resolution, framerate = mode
expected_failures(resolution, "h264", {})
filenames = [os.path.join(tempdir, "clip%d.h264" % i) for i in range(3)]
for filename in camera.record_sequence(filenames):
camera.wait_recording(1)
for filename in filenames:
verify_video(filename, "h264", resolution)
开发者ID:julianscheel,项目名称:picamera,代码行数:8,代码来源:test_record.py
示例8: test_record_sequence_to_stream
def test_record_sequence_to_stream(camera, mode):
resolution, framerate = mode
expected_failures(resolution, "h264", {})
streams = [tempfile.SpooledTemporaryFile() for i in range(3)]
for stream in camera.record_sequence(streams):
camera.wait_recording(1)
for stream in streams:
stream.seek(0)
verify_video(stream, "h264", resolution)
开发者ID:julianscheel,项目名称:picamera,代码行数:9,代码来源:test_record.py
示例9: test_record_sequence_to_file
def test_record_sequence_to_file(camera, previewing, mode, tmpdir):
resolution, framerate = mode
if resolution == (2592, 1944):
pytest.xfail('Cannot encode video at max resolution')
filenames = [os.path.join(str(tmpdir), 'clip%d.h264' % i) for i in range(3)]
for filename in camera.record_sequence(filenames):
camera.wait_recording(1)
for filename in filenames:
verify_video(filename, 'h264', resolution)
开发者ID:GMercat,项目名称:picamera,代码行数:9,代码来源:test_record.py
示例10: test_record_sequence_to_stream
def test_record_sequence_to_stream(camera, previewing, mode):
resolution, framerate = mode
if resolution == (2592, 1944):
pytest.xfail('Cannot encode video at max resolution')
streams = [tempfile.SpooledTemporaryFile() for i in range(3)]
for stream in camera.record_sequence(streams):
camera.wait_recording(1)
for stream in streams:
stream.seek(0)
verify_video(stream, 'h264', resolution)
开发者ID:GMercat,项目名称:picamera,代码行数:10,代码来源:test_record.py
示例11: test_split_and_capture
def test_split_and_capture(camera, previewing, resolution):
if resolution == (2592, 1944):
pytest.xfail('Cannot encode video at max resolution')
v_stream1 = tempfile.SpooledTemporaryFile()
v_stream2 = tempfile.SpooledTemporaryFile()
c_stream1 = tempfile.SpooledTemporaryFile()
camera.start_recording(v_stream1, format='h264')
try:
camera.wait_recording(1)
camera.capture(c_stream1, format='jpeg', use_video_port=True)
camera.split_recording(v_stream2)
camera.wait_recording(1)
finally:
camera.stop_recording()
v_stream1.seek(0)
v_stream2.seek(0)
c_stream1.seek(0)
verify_image(c_stream1, 'jpeg', resolution)
verify_video(v_stream1, 'h264', resolution)
verify_video(v_stream2, 'h264', resolution)
开发者ID:RoboPython,项目名称:picamera,代码行数:20,代码来源:test_record.py
示例12: test_split_and_capture
def test_split_and_capture(camera, mode):
resolution, framerate = mode
expected_failures(resolution, "h264", {})
v_stream1 = tempfile.SpooledTemporaryFile()
v_stream2 = tempfile.SpooledTemporaryFile()
c_stream1 = tempfile.SpooledTemporaryFile()
camera.start_recording(v_stream1, format="h264")
try:
camera.wait_recording(1)
camera.capture(c_stream1, format="jpeg", use_video_port=True)
camera.split_recording(v_stream2)
camera.wait_recording(1)
finally:
camera.stop_recording()
v_stream1.seek(0)
v_stream2.seek(0)
c_stream1.seek(0)
verify_image(c_stream1, "jpeg", resolution)
verify_video(v_stream1, "h264", resolution)
verify_video(v_stream2, "h264", resolution)
开发者ID:julianscheel,项目名称:picamera,代码行数:20,代码来源:test_record.py
示例13: test_multi_res_record
def test_multi_res_record(camera, mode):
resolution, framerate = mode
expected_failures(resolution, "h264", {})
v_stream1 = tempfile.SpooledTemporaryFile()
v_stream2 = tempfile.SpooledTemporaryFile()
new_res = (resolution[0] // 2, resolution[1] // 2)
camera.start_recording(v_stream1, format="h264")
try:
camera.start_recording(v_stream2, format="h264", resize=new_res, splitter_port=2)
try:
camera.wait_recording(1)
camera.wait_recording(1, splitter_port=2)
finally:
camera.stop_recording()
finally:
# Deliberately stop out of order to test #105
camera.stop_recording(splitter_port=2)
v_stream1.seek(0)
v_stream2.seek(0)
verify_video(v_stream1, "h264", resolution)
verify_video(v_stream2, "h264", new_res)
开发者ID:julianscheel,项目名称:picamera,代码行数:21,代码来源:test_record.py
示例14: test_multi_res_record
def test_multi_res_record(camera, previewing, mode):
resolution, framerate = mode
if resolution == (2592, 1944):
pytest.xfail('Cannot encode video at max resolution')
v_stream1 = tempfile.SpooledTemporaryFile()
v_stream2 = tempfile.SpooledTemporaryFile()
new_res = (resolution[0] // 2, resolution[1] // 2)
camera.start_recording(v_stream1, format='h264')
try:
camera.start_recording(v_stream2, format='h264', resize=new_res, splitter_port=2)
try:
camera.wait_recording(1)
camera.wait_recording(1, splitter_port=2)
finally:
camera.stop_recording(splitter_port=2)
finally:
camera.stop_recording()
v_stream1.seek(0)
v_stream2.seek(0)
verify_video(v_stream1, 'h264', resolution)
verify_video(v_stream2, 'h264', new_res)
开发者ID:GMercat,项目名称:picamera,代码行数:21,代码来源:test_record.py
注:本文中的verify.verify_video函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论