|
1 |
| - |
2 | 1 | import importlib
|
3 | 2 | import math
|
4 | 3 | import os
|
|
17 | 16 |
|
18 | 17 | loader_details = (
|
19 | 18 | importlib.machinery.ExtensionFileLoader,
|
20 |
| - importlib.machinery.EXTENSION_SUFFIXES |
| 19 | + importlib.machinery.EXTENSION_SUFFIXES, |
21 | 20 | )
|
22 | 21 |
|
23 | 22 | extfinder = importlib.machinery.FileFinder(lib_dir, loader_details)
|
|
26 | 25 | torch.ops.load_library(ext_specs.origin)
|
27 | 26 | _HAS_VIDEO_OPT = True
|
28 | 27 | except (ImportError, OSError):
|
29 |
| - warnings.warn("Could not import video_reader bakcend." |
30 |
| - + " Make sure ffmpeg is installed properly" |
31 |
| - + " and rebuild torchvision.") |
| 28 | + pass |
32 | 29 |
|
33 | 30 |
|
34 | 31 | default_timebase = Fraction(0, 1)
|
@@ -243,10 +240,18 @@ def _read_video_from_file(
|
243 | 240 | audio_timebase.numerator,
|
244 | 241 | audio_timebase.denominator,
|
245 | 242 | )
|
246 |
| - vframes, _vframe_pts, vtimebase, vfps, vduration, \ |
247 |
| - aframes, aframe_pts, atimebase, asample_rate, aduration = ( |
248 |
| - result |
249 |
| - ) |
| 243 | + ( |
| 244 | + vframes, |
| 245 | + _vframe_pts, |
| 246 | + vtimebase, |
| 247 | + vfps, |
| 248 | + vduration, |
| 249 | + aframes, |
| 250 | + aframe_pts, |
| 251 | + atimebase, |
| 252 | + asample_rate, |
| 253 | + aduration, |
| 254 | + ) = result |
250 | 255 | info = _fill_info(vtimebase, vfps, vduration, atimebase, asample_rate, aduration)
|
251 | 256 | if aframes.numel() > 0:
|
252 | 257 | # when audio stream is found
|
@@ -281,8 +286,18 @@ def _read_video_timestamps_from_file(filename):
|
281 | 286 | 0, # audio_timebase_num
|
282 | 287 | 1, # audio_timebase_den
|
283 | 288 | )
|
284 |
| - _vframes, vframe_pts, vtimebase, vfps, vduration, \ |
285 |
| - _aframes, aframe_pts, atimebase, asample_rate, aduration = (result) |
| 289 | + ( |
| 290 | + _vframes, |
| 291 | + vframe_pts, |
| 292 | + vtimebase, |
| 293 | + vfps, |
| 294 | + vduration, |
| 295 | + _aframes, |
| 296 | + aframe_pts, |
| 297 | + atimebase, |
| 298 | + asample_rate, |
| 299 | + aduration, |
| 300 | + ) = result |
286 | 301 | info = _fill_info(vtimebase, vfps, vduration, atimebase, asample_rate, aduration)
|
287 | 302 |
|
288 | 303 | vframe_pts = vframe_pts.numpy().tolist()
|
@@ -406,10 +421,18 @@ def _read_video_from_memory(
|
406 | 421 | audio_timebase_denominator,
|
407 | 422 | )
|
408 | 423 |
|
409 |
| - vframes, _vframe_pts, vtimebase, vfps, vduration, \ |
410 |
| - aframes, aframe_pts, atimebase, asample_rate, aduration = ( |
411 |
| - result |
412 |
| - ) |
| 424 | + ( |
| 425 | + vframes, |
| 426 | + _vframe_pts, |
| 427 | + vtimebase, |
| 428 | + vfps, |
| 429 | + vduration, |
| 430 | + aframes, |
| 431 | + aframe_pts, |
| 432 | + atimebase, |
| 433 | + asample_rate, |
| 434 | + aduration, |
| 435 | + ) = result |
413 | 436 |
|
414 | 437 | if aframes.numel() > 0:
|
415 | 438 | # when audio stream is found
|
@@ -447,10 +470,18 @@ def _read_video_timestamps_from_memory(video_data):
|
447 | 470 | 0, # audio_timebase_num
|
448 | 471 | 1, # audio_timebase_den
|
449 | 472 | )
|
450 |
| - _vframes, vframe_pts, vtimebase, vfps, vduration, \ |
451 |
| - _aframes, aframe_pts, atimebase, asample_rate, aduration = ( |
452 |
| - result |
453 |
| - ) |
| 473 | + ( |
| 474 | + _vframes, |
| 475 | + vframe_pts, |
| 476 | + vtimebase, |
| 477 | + vfps, |
| 478 | + vduration, |
| 479 | + _aframes, |
| 480 | + aframe_pts, |
| 481 | + atimebase, |
| 482 | + asample_rate, |
| 483 | + aduration, |
| 484 | + ) = result |
454 | 485 | info = _fill_info(vtimebase, vfps, vduration, atimebase, asample_rate, aduration)
|
455 | 486 |
|
456 | 487 | vframe_pts = vframe_pts.numpy().tolist()
|
|
0 commit comments