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