@@ -9,10 +9,11 @@ def check_dir():
99
1010def init_parser () :
1111 parser = argparse .ArgumentParser (description = "Extract frames from a video." )
12- parser .add_argument ('--path' , type = str , required = True , help = "Path to the video file." )
13- parser .add_argument ('--frame' , type = int , help = "Frame number to extract." )
14- parser .add_argument ('--min' , type = int , help = "Minimum frame number to extract." )
15- parser .add_argument ('--max' , type = int , help = "Maximum frame number to extract." )
12+ parser .add_argument ('--path' , '-p' , type = str , required = True , help = "Path to the video file." )
13+ parser .add_argument ('--frame' , '-f' , type = int , help = "Frame number to extract." )
14+ parser .add_argument ('--min' , type = int , help = "(Range) Minimum frame number to extract." )
15+ parser .add_argument ('--max' , type = int , help = "(Range) Maximum frame number to extract." )
16+ parser .add_argument ('--version' , '-v' , action = "version" , version = "%(prog)s v0.1.0 (Beta version)" , help = "Print program version and exit" )
1617
1718 args = parser .parse_args ()
1819
@@ -22,6 +23,8 @@ def init_parser() :
2223 frame .extract_single_frame (args .frame )
2324 elif args .min is not None and args .max is not None :
2425 frame .extract_frames (args .min , args .max )
26+ elif (args .min is not None and args .max is None ) or (args .min is None and args .max is not None ):
27+ print ("Use both args '--min' and '--max' to specified range frames." )
2528 else :
2629 print ("No frame or range specified. Extracting all frames from the video." )
2730 frame .extract_frames ()
0 commit comments