parameters: (self, video, probesecs)
docstring: Probe video file or image directory for FPS and number of frames.
docstring_summary: Probe video file or image directory for FPS and number of frames.
docstring_tokens: Probe video file or image directory for FPS and number of frames .
function: def probe_video(self, video, probesecs):
  		'''Probe video file or image directory for FPS and number of frames.'''
  		url = video.url
  
  		if url == 'Image List':
  			return 1 # 1 FPS
  		else:
  			ROOT = os.path.join(os.path.dirname(__file__), '..', '..', '..')
  			
  			cmd = [
  				'ffprobe', 
  				'-hide_banner',				
  				'-print_format', 'json',
  				'-read_intervals', '%+{}'.format(probesecs),
  				'-show_streams', 
  				'-count_frames',
  				'-select_streams', 'v:0'
  			]
  			
  			if not url.startswith('http'):	
  				# Local file path, relative to serving directory			
  				url = os.path.normpath(os.path.join(ROOT, 'annotator', url.strip('/')))
  			else:
  				# Timeout for reaching remote file
  				cmd.extend(['-timeout', str(int(5e6))])
  			
  			cmd.extend(['-i', url])
  
  			try:   
  				p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)    
  				out, err =  p.communicate()
  				if p.returncode != 0:
  					print('--Failed to probe video with error {}'.format(err))
  					return None
  				
  				content = json.loads(out.decode('utf-8'))
  				stream = content['streams'][0]
  				return eval(stream['r_frame_rate'])
  			except FileNotFoundError:
  				print('--Failed to find `ffprobe`. Make sure to have `ffmpeg` in your PATH.')
  				return None
function_tokens: def probe_video ( self , video , probesecs ) : url = video . url if url == 'Image List' : return 1 # 1 FPS else : ROOT = os . path . join ( os . path . dirname ( __file__ ) , '..' , '..' , '..' ) cmd = [ 'ffprobe' , '-hide_banner' , '-print_format' , 'json' , '-read_intervals' , '%+{}' . format ( probesecs ) , '-show_streams' , '-count_frames' , '-select_streams' , 'v:0' ] if not url . startswith ( 'http' ) : # Local file path, relative to serving directory			 url = os . path . normpath ( os . path . join ( ROOT , 'annotator' , url . strip ( '/' ) ) ) else : # Timeout for reaching remote file cmd . extend ( [ '-timeout' , str ( int ( 5e6 ) ) ] ) cmd . extend ( [ '-i' , url ] ) try : p = subprocess . Popen ( cmd , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) out , err = p . communicate ( ) if p . returncode != 0 : print ( '--Failed to probe video with error {}' . format ( err ) ) return None content = json . loads ( out . decode ( 'utf-8' ) ) stream = content [ 'streams' ] [ 0 ] return eval ( stream [ 'r_frame_rate' ] ) except FileNotFoundError : print ( '--Failed to find `ffprobe`. Make sure to have `ffmpeg` in your PATH.' ) return None