Ë
    T^(hp  ã                   óT   — d dl ZddlmZ  ej                  e«      ZdZdZdZ	dZ
d	d„Zy)
é    Né   )ÚloggingzºYou are a helpful language and vision assistant. You are able to understand the visual content that the user provides, and assist the user with a variety of tasks using natural language.zgYou are provided the following series of {frame_count} frames from a {video_duration} [H:MM:SS] video.
z

z
Frame from {timestamp}:c                 ó  — t        | dd«      }|dk  rt        d|› d�«      ‚t        | dd«      }t        | dd«      }|dk  rt        d|› d�«      ‚t        t        ||z  «      «      }t	        ||«      }|d	k  rd	}d}	|d	z
  }
|dkD  r-|d
|z  z
  ||z  kD  rt        ||z  «      }	t        |||z  z
  «      }
t        d|	«      }	t	        |
|d	z
  «      }
|	|
k\  rd|d	z
  }
}	t        j                  |	|
|t        ¬«      }t        j                  |«      }|S )a]  
    Example sampling function which:
      - Uses `max_frames` (if provided) or calculates it from `fps` and metadata.
      - Applies a basic center-skip if fewer frames than available, otherwise
        optionally skips `skip_secs` from both the start and end.
      - Uniformly samples the desired number of frames between the start and end indices.

    Args:
        max_frames (`int`):
            Maximum number of frames to sample.
        target_fps (`int`):
            Target frames to sample per second.
        metadata (`dict`):
            Contains video metadata such as "n_frames" and "video_fps".
        skip_secs (`float`, *optional*, defaults to 1.0):
            Number of seconds to skip from the start and end if the video is long enough.

    Returns:
        numpy.ndarray:
            An array of unique frame indices to sample.
    Útotal_num_framesr   zInvalid total_num_frames=z in metadata.Úfpsg      >@ÚdurationzInvalid duration_seconds=é   é   )Údtype)	ÚgetattrÚ
ValueErrorÚintÚroundÚminÚmaxÚnpÚlinspaceÚunique)ÚmetadataÚ
max_framesÚ
target_fpsÚ	skip_secsr   Ú
native_fpsÚduration_secondsÚestimated_framesÚdesired_framesÚ	start_idxÚend_idxÚindicess               úr/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/smolvlm/video_processing_smolvlm.pyÚsmolvlm_sample_indices_fnr!   !   sQ  € ô. ˜xÐ);¸QÓ?ÐØ˜1ÒÜÐ4Ð5EÐ4FÀmÐTÓUÐUä˜ 5¨$Ó/€JÜ˜x¨°QÓ7Ðà˜1ÒÜÐ4Ð5EÐ4FÀmÐTÓUÐUô œ5 Ð.>Ñ!>Ó?Ó@Ðô Ð)¨:Ó6€NØ˜ÒØˆð €IØ Ñ"€Gà�1‚}Ð*¨Q°©]Ñ:¸zÈJÑ?VÒWÜ˜	 JÑ.Ó/ˆ	ÜÐ&¨°ZÑ)?Ñ?Ó@ˆä�A�yÓ!€IÜ�'Ð+¨aÑ/Ó0€GØ�GÒØÐ 0°1Ñ 4�7ˆ	ä�k‰k˜) W¨nÄCÔH€GÜ�i‰i˜Ó €Gà€Nó    )r   )Únumpyr   Úutilsr   Ú
get_loggerÚ__name__ÚloggerÚDEFAULT_SYSTEM_MESSAGEÚDEFAULT_VIDEO_INTROÚDEFAULT_MEDIA_OUTTROÚFRAME_TIMESTAMP_MESSAGEr!   © r"   r    ú<module>r-      sG   ðó" õ ð 
ˆ×	Ñ	˜HÓ	%€ð VÐ ànð ð Ð Ø5Ð ô9r"   