-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from pyscioffice/bug_fix
Fix convert bug
- Loading branch information
Showing
4 changed files
with
34 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
from pymov2gif import convert | ||
import os | ||
import subprocess | ||
|
||
|
||
def convert(file, resolution="800x600", framerate=10, output_file=None): | ||
""" | ||
Convert *.mov files to *.gif format | ||
Args: | ||
file (str): Input movie file in *.mov format | ||
resolution (str): Resolution of the output *.gif file - default: 800x600 | ||
framerate (int): Framerate of the output *.gif file - default: 10 | ||
output_file (str/None): Filename of the output *.gif file - optional | ||
""" | ||
file = os.path.abspath(os.path.expanduser(file)) | ||
if output_file is None: | ||
output_file = os.path.splitext(os.path.basename(file))[0] + ".gif" | ||
command_options = ( | ||
"ffmpeg -i " | ||
+ file | ||
+ " -s " | ||
+ resolution | ||
+ " -pix_fmt rgb24 -r " | ||
+ str(framerate) | ||
+ " -f gif - | gifsicle --optimize=3 --delay=3 > " | ||
+ output_file | ||
) | ||
subprocess.check_output(command_options, shell=True, universal_newlines=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.