Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GIF to mp4 #113

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added examples/dracula.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions spec/graphtests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@
_skipcompare: true
_skiperrors: true
input: "files/video-3dpmic.mp4"
-
_name: gif_to_mp4
_graph: 'passthrough.mp4'
_skipcompare: true
_skiperrors: true
input: "files/dracula.gif"
-
_name: regcheck_nocontenttype_queryparams
_graph: passthrough.jpg
Expand Down
8 changes: 6 additions & 2 deletions src/imgflo.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enrichGraphDefinition = (graph, publicOnly) ->
minimum: 100
graph.inports.video_framerate =
process: 'save'
port: 'framerate'
port: 'frame-rate'
metadata:
description: "Frames per second in output video"
type: 'number'
Expand All @@ -49,6 +49,7 @@ enrichGraphDefinition = (graph, publicOnly) ->
minimum: 1

supportedVideoTypes = ['mp4']
supportedVideoInputTypes = ['mp4', 'gif']
supportedTypes = ['jpg', 'jpeg', 'png', null].concat(supportedVideoTypes)

extractMetadata = (stdout) ->
Expand Down Expand Up @@ -83,8 +84,11 @@ class ImgfloProcessor extends common.Processor
@installdir = installdir

process: (outputFile, outputType, graph, iips, inputFile, inputType, callback) ->
return callback new errors.UnsupportedImageType inputType, supportedTypes if inputType not in supportedTypes
return callback new errors.UnsupportedImageType outputType, supportedTypes if outputType not in supportedTypes
if typeIsVideo outputType
return callback new errors.UnsupportedImageType inputType, supportedTypes if inputType not in supportedVideoInputTypes
else
return callback new errors.UnsupportedImageType inputType, supportedTypes if inputType not in supportedTypes
return callback new Error 'Requested graph has no "output" outport defined' if not graph.outports?.output

g = prepareImgfloGraph graph, iips, inputFile, outputFile, inputType, outputType
Expand Down