Skip to content

Commit

Permalink
Fix messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Marishka17 authored May 4, 2024
1 parent ee90696 commit 20741d2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utils/dataset_manifest/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, source_path, chunk_size, force):
for frame in packet.decode():
# check type of first frame
if not frame.pict_type.name == 'I':
raise InvalidVideoError('First frame is not key frame')
raise InvalidVideoError('The first frame is not a key frame')

# get video resolution
if video_stream.metadata.get('rotate'):
Expand Down Expand Up @@ -96,9 +96,9 @@ def __iter__(self) -> Iterator[Union[int, Tuple[int, int, str]]]:
for frame in packet.decode():
# Check PTS and DTS sequences for validity
if None not in {frame.pts, prev_pts} and frame.pts <= prev_pts:
raise InvalidVideoError('Invalid pts sequences')
raise InvalidVideoError('Detected non-increasing PTS sequence in the video')
if None not in {frame.dts, prev_dts} and frame.dts <= prev_dts:
raise InvalidVideoError('Invalid dts sequences')
raise InvalidVideoError('Detected non-increasing DTS sequence in the video')
prev_pts, prev_dts = frame.pts, frame.dts

if frame.key_frame:
Expand Down Expand Up @@ -131,7 +131,7 @@ def __iter__(self) -> Iterator[Union[int, Tuple[int, int, str]]]:

# Check if the number of key frames meets the upper bound
if key_frame_ratio >= self._upper_bound and not self._force:
raise InvalidVideoError('Too few keyframes')
raise InvalidVideoError('The number of keyframes is not enough for smooth iteration over the video')

# Update frames number if not already set
if not self._frames_number:
Expand Down

0 comments on commit 20741d2

Please sign in to comment.