mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-04 14:58:55 +08:00
Fix get_num_frames_in_video (#2090)
* Fix get_num_frames_in_video * Make sure that there is a number * Fix output[0]
This commit is contained in:
1 parent
c023f82b11
commit
ef1350bd36
1 file changed
+4
-2
@@ -17,6 +17,7 @@
|
|||||||
import math
|
import math
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
import re
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Literal, Optional, OrderedDict, Tuple, Union
|
from typing import List, Literal, Optional, OrderedDict, Tuple, Union
|
||||||
@@ -93,8 +94,9 @@ def get_num_frames_in_video(video: Path) -> int:
|
|||||||
-show_entries stream=nb_read_packets -of csv=p=0 "{video}"'
|
-show_entries stream=nb_read_packets -of csv=p=0 "{video}"'
|
||||||
output = run_command(cmd)
|
output = run_command(cmd)
|
||||||
assert output is not None
|
assert output is not None
|
||||||
output = output.strip(" ,\t\n\r")
|
number_match = re.search(r"\d+", output)
|
||||||
return int(output)
|
assert number_match is not None
|
||||||
|
return int(number_match[0])
|
||||||
|
|
||||||
|
|
||||||
def convert_video_to_images(
|
def convert_video_to_images(
|
||||||
|
|||||||
Reference in new issue
Block a user