changeset 5:6c1b7f249352 draft

Uploaded
author greg
date Tue, 17 Oct 2017 14:07:44 -0400
parents af39d74b5595
children ebfec8e5e838
files ffmpeg.xml
diffstat 1 files changed, 29 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ffmpeg.xml	Tue Oct 17 10:11:15 2017 -0400
+++ b/ffmpeg.xml	Tue Oct 17 14:07:44 2017 -0400
@@ -1,19 +1,40 @@
 <tool id="ffmpeg" name="FFMPEG" version="3.2.4">
-    <description> video to image converter</description>
+    <description> video / image converter</description>
     <requirements>
         <requirement type="package" version="3.2.4">ffmpeg</requirement>
     </requirements>
     <command detect_errors="exit_code"><![CDATA[
-mkdir output &&
-ffmpeg -i '$input' -filter:v fps=fps=1/$sbf 2>/dev/null output/%05d.jpg
+#if str($conversion_cond) == "video":
+    mkdir output &&
+    ffmpeg -i '$input' -filter:v fps=fps=1/$sbf 2>/dev/null output/%05d.$ext
+#else:
+#end if
     ]]></command>
     <inputs>
-        <param name="input" type="data" format="avi,mpg" label="Select input video" />
-        <param name="sbf" type="integer" value="1" label="Number of seconds between frames" />
+        <conditional name="conversion_cond">
+            <param name="conversion" type="select" label="Convert">
+                <option value="video" selected="true">video to images</option>
+                <option value="images">images to video</option>
+            </param>
+            <when value="video">
+                <param name="input" type="data" format="avi,mpg" label="Select input video"/>
+                <param name="sbf" type="integer" value="1" label="Number of seconds between frames"/>
+                <param name="ext" type="select" label="Image format">
+                    <option value="jpg" selected="true">Jpg</option>
+                    <option value="png">Png</option>
+                    <option value="bmp">bmp</option>
+                </param>
+            </when>
+        </conditional>
     </inputs>
     <outputs>
-        <collection name="output" type="list">
-            <discover_datasets pattern="__name__" directory="output" format="jpg" />
+        <collection name="output_from_video" type="list">
+            <discover_datasets pattern="__name__" directory="output" format="jpg"/>
+            <filter>conversion_cond['conversion'] == 'video'</filter>
+            <change_format>
+                <when input="conversion_cond.ext" value="png" format="png"/>
+                <when input="conversion_cond.ext" value="bmp" format="bmp"/>
+            </change_format>
         </collection>
     </outputs>
     <tests>
@@ -23,7 +44,7 @@
     <help>
 **What it does**
 
-Converts video files to images.
+Converts video files to images and image files to video files.
 
 -----