Removing 444 because it's pointless, adding no_loop command for non-looping GIFs
This commit is contained in:
parent
5a1fae172e
commit
2dcf1fba8a
@ -20,6 +20,8 @@ def get_args() -> Dict[str, Any]:
|
|||||||
default='12', help='framerate of GIF (default: 12)')
|
default='12', help='framerate of GIF (default: 12)')
|
||||||
parser.add_argument('-e', '--extra', default=False, action='store_true', \
|
parser.add_argument('-e', '--extra', default=False, action='store_true', \
|
||||||
help='increase quality at the expense of file size and encoding time')
|
help='increase quality at the expense of file size and encoding time')
|
||||||
|
parser.add_argument('--no_loop', default=False, action='store_true', \
|
||||||
|
help='don\'t loop the animated GIF')
|
||||||
parser.add_argument('-t', '--tag', type=str, default=get_tag(), \
|
parser.add_argument('-t', '--tag', type=str, default=get_tag(), \
|
||||||
help='optional tag included in file name')
|
help='optional tag included in file name')
|
||||||
return vars(parser.parse_args())
|
return vars(parser.parse_args())
|
||||||
@ -44,6 +46,7 @@ def generate_gif_files(inputs: List[str], args: Dict[str, Any]) -> Dict[str, Tup
|
|||||||
width = args['width']
|
width = args['width']
|
||||||
framerate = args['framerate']
|
framerate = args['framerate']
|
||||||
extra = args['extra']
|
extra = args['extra']
|
||||||
|
no_loop = args['no_loop']
|
||||||
|
|
||||||
extra_cmd = ''
|
extra_cmd = ''
|
||||||
quality = '90'
|
quality = '90'
|
||||||
@ -51,14 +54,15 @@ def generate_gif_files(inputs: List[str], args: Dict[str, Any]) -> Dict[str, Tup
|
|||||||
extra_cmd = '--extra'
|
extra_cmd = '--extra'
|
||||||
quality = '100'
|
quality = '100'
|
||||||
|
|
||||||
|
no_loop_cmd = ''
|
||||||
|
if no_loop: no_loop_cmd = '--repeat -1'
|
||||||
|
|
||||||
output_map = {}
|
output_map = {}
|
||||||
for input in inputs:
|
for input in inputs:
|
||||||
file_name = f"{Path(input).stem}_{tag}.gif"
|
file_name = f"{Path(input).stem}_{tag}.gif"
|
||||||
full_path = f"{Path(input).parent}/{file_name}"
|
full_path = f"{Path(input).parent}/{file_name}"
|
||||||
if extra:
|
command = ['-i', input, '-pix_fmt', 'yuv422p', '-f', 'yuv4mpegpipe', '-', '|', 'gifski', \
|
||||||
ex_cmd = '--extra'
|
'--width', f"{width}", '-r', f"{framerate}", extra_cmd, '-Q', quality, no_loop_cmd, \
|
||||||
command = ['-i', input, '-pix_fmt', 'yuv444p', '-f', 'yuv4mpegpipe', '-', '|', 'gifski', \
|
|
||||||
'--width', f"{width}", '-r', f"{framerate}", extra_cmd, '-Q', quality, \
|
|
||||||
'-o', f"{full_path}", '-']
|
'-o', f"{full_path}", '-']
|
||||||
command = list(filter(None, command))
|
command = list(filter(None, command))
|
||||||
success = call_ffmpeg(command)
|
success = call_ffmpeg(command)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user