Skip to content

Commit 71c870b

Browse files
authored
Merge pull request #82 from KumarLabJax/KLAUS-267-compression-resource-config
Klaus 267 compression resource config
2 parents 9838295 + ffe680d commit 71c870b

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

nextflow/configs/profiles/sumner2.config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,15 @@ process {
540540
errorStrategy = { task.attempt <= 3 ? 'retry' : 'ignore' }
541541
maxRetries = 3
542542
}
543+
withLabel: "r_compression" {
544+
// Note: These resources are enough for 1-hour 800x800 videos.
545+
// TODO: These values should scale to duration and size of video.
546+
cpus = 2
547+
memory = 2.GB
548+
time = 2.hours
549+
array = 200
550+
errorStrategy = 'ignore'
551+
}
543552
}
544553

545554
executor {

nextflow/modules/compression.nf

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
* @return file Path to compressed video
1010
*/
1111
process COMPRESS_VIDEO_CRF {
12-
label "compression"
12+
label "cpu"
13+
// Any environment with ffmpeg installed should work here.
14+
label "tracking"
15+
label "r_compression"
1316

1417
input:
1518
tuple path(video_file), val(crf), val(keyframe_interval)
@@ -19,7 +22,7 @@ process COMPRESS_VIDEO_CRF {
1922

2023
script:
2124
"""
22-
ffmpeg -i ${video_file} -c:v libx264 -pix_fmt yuv420p -preset slow -crf ${crf} -g ${keyframe_interval} -f mp4 ${video_file.baseName}_g${keyframe_interval}_crf${crf}.mp4
25+
ffmpeg -i ${video_file} -c:v libx264 -pix_fmt yuv420p -preset veryfast -crf ${crf} -g ${keyframe_interval} -f mp4 ${video_file.baseName}_g${keyframe_interval}_crf${crf}.mp4
2326
"""
2427
}
2528

@@ -38,7 +41,10 @@ process COMPRESS_VIDEO_CRF {
3841
* @note COMPRESS_VIDEO_CRF will typically produce better videos with a low signal-to-noise ratio.
3942
*/
4043
process COMPRESS_VIDEO_BR {
41-
label "compression"
44+
label "cpu"
45+
// Any environment with ffmpeg installed should work here.
46+
label "tracking"
47+
label "r_compression"
4248

4349
input:
4450
tuple path(video_file), val(bitrate), val(keyframe_interval)
@@ -66,6 +72,8 @@ process COMPRESS_VIDEO_BR {
6672
* @note Difference videos are useful in comparing changes due to compression.
6773
*/
6874
process COMPUTE_VIDEO_DIFFERENCE {
75+
label "cpu"
76+
// Any environment with ffmpeg installed should work here.
6977
label "tracking"
7078

7179
input:

0 commit comments

Comments
 (0)