0
|
1 <tool id="ffmpeg" name="FFMPEG" version="3.2.4">
|
5
|
2 <description> video / image converter</description>
|
0
|
3 <requirements>
|
|
4 <requirement type="package" version="3.2.4">ffmpeg</requirement>
|
|
5 </requirements>
|
|
6 <command detect_errors="exit_code"><![CDATA[
|
11
|
7 mkdir output &&
|
7
|
8 #if str($conversion_cond.conversion) == "video":
|
10
|
9 #if str($output_process_log) == 'yes':
|
|
10 ffmpeg -i '$conversion_cond.input' -filter:v fps=fps=1/$conversion_cond.sbf 2>$output_log output/%05d.jpg
|
|
11 #else:
|
|
12 ffmpeg -i '$conversion_cond.input' -filter:v fps=fps=1/$conversion_cond.sbf 2>/dev/null output/%05d.jpg
|
|
13 #end if
|
11
|
14 #else:
|
|
15 ## str($conversion_cond.conversion) == "images"
|
|
16 mkdir input_dir &&
|
|
17 #for $i in $conversion_cond.input:
|
|
18 #set input_filename = $i.file_name
|
|
19 #set full_name = $i.name
|
16
|
20 #set ext = $i.ext
|
15
|
21 cp $input_filename input_dir/$full_name &&
|
11
|
22 #end for
|
|
23 #if str($output_process_log) == 'yes':
|
15
|
24 ffmpeg -r $conversion_cond.frame_rate -f mp4 -s 1920x1080 -i input_dir/%05d_predictions.$ext -vcodec libx264 -crf $conversion_cond.quality -pix_fmt yuv420p 2>$output_log $output_video
|
11
|
25 #else:
|
15
|
26 ffmpeg -r $conversion_cond.frame_rate -f mp4 -s 1920x1080 -i input_dir/%05d_predictions.$ext -vcodec libx264 -crf $conversion_cond.quality -pix_fmt yuv420p 2>/dev/null $output_video
|
11
|
27 #end if
|
5
|
28 #end if
|
0
|
29 ]]></command>
|
|
30 <inputs>
|
5
|
31 <conditional name="conversion_cond">
|
|
32 <param name="conversion" type="select" label="Convert">
|
|
33 <option value="video" selected="true">video to images</option>
|
|
34 <option value="images">images to video</option>
|
|
35 </param>
|
|
36 <when value="video">
|
9
|
37 <param name="input" type="data" format="avi,mpg,mp4" label="Select input video"/>
|
5
|
38 <param name="sbf" type="integer" value="1" label="Number of seconds between frames"/>
|
|
39 </when>
|
11
|
40 <when value="images">
|
12
|
41 <param name="input" type="data_collection" collection_type="list" format="jpg,png" label="Select input images"/>
|
11
|
42 <param name="frame_rate" type="integer" value="60" label="Number of frames per second"/>
|
|
43 <param name="quality" type="integer" value="15" label="Image quality" help="Lower means better quality, 15-25 is usually good"/>
|
|
44 </when>
|
5
|
45 </conditional>
|
9
|
46 <param name="output_process_log" type="select" display="radio" label="Output process log?">
|
|
47 <option value="no" selected="true">No</option>
|
|
48 <option value="yes">Yes</option>
|
|
49 </param>
|
0
|
50 </inputs>
|
|
51 <outputs>
|
11
|
52 <data name="output_log" format="txt" label="${tool.name} (process log) on ${on_string}">
|
|
53 <filter>output_process_log == 'yes'</filter>
|
|
54 </data>
|
9
|
55 <collection name="output_from_video" type="list" label="${tool.name} (images) on ${on_string}">
|
5
|
56 <discover_datasets pattern="__name__" directory="output" format="jpg"/>
|
|
57 <filter>conversion_cond['conversion'] == 'video'</filter>
|
0
|
58 </collection>
|
11
|
59 <data name="output_video" format="mp4" label="${tool.name} (video) on ${on_string}">
|
|
60 <filter>conversion_cond['conversion'] == 'images'</filter>
|
9
|
61 </data>
|
0
|
62 </outputs>
|
|
63 <tests>
|
|
64 <test>
|
|
65 </test>
|
|
66 </tests>
|
|
67 <help>
|
|
68 **What it does**
|
|
69
|
5
|
70 Converts video files to images and image files to video files.
|
0
|
71
|
|
72 -----
|
|
73
|
|
74 **Options**
|
|
75
|
|
76 </help>
|
|
77 <citations>
|
|
78 </citations>
|
|
79 </tool>
|