diff --git a/nextflow/configs/profiles/sumner2.config b/nextflow/configs/profiles/sumner2.config index 32482af4..6aeefdeb 100644 --- a/nextflow/configs/profiles/sumner2.config +++ b/nextflow/configs/profiles/sumner2.config @@ -540,6 +540,15 @@ process { errorStrategy = { task.attempt <= 3 ? 'retry' : 'ignore' } maxRetries = 3 } + withLabel: "r_compression" { + // Note: These resources are enough for 1-hour 800x800 videos. + // TODO: These values should scale to duration and size of video. + cpus = 2 + memory = 2.GB + time = 2.hours + array = 200 + errorStrategy = 'ignore' + } } executor { diff --git a/nextflow/modules/compression.nf b/nextflow/modules/compression.nf index fed540d0..f40af959 100644 --- a/nextflow/modules/compression.nf +++ b/nextflow/modules/compression.nf @@ -9,7 +9,10 @@ * @return file Path to compressed video */ process COMPRESS_VIDEO_CRF { - label "compression" + label "cpu" + // Any environment with ffmpeg installed should work here. + label "tracking" + label "r_compression" input: tuple path(video_file), val(crf), val(keyframe_interval) @@ -19,7 +22,7 @@ process COMPRESS_VIDEO_CRF { script: """ - 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 + 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 """ } @@ -38,7 +41,10 @@ process COMPRESS_VIDEO_CRF { * @note COMPRESS_VIDEO_CRF will typically produce better videos with a low signal-to-noise ratio. */ process COMPRESS_VIDEO_BR { - label "compression" + label "cpu" + // Any environment with ffmpeg installed should work here. + label "tracking" + label "r_compression" input: tuple path(video_file), val(bitrate), val(keyframe_interval) @@ -66,6 +72,8 @@ process COMPRESS_VIDEO_BR { * @note Difference videos are useful in comparing changes due to compression. */ process COMPUTE_VIDEO_DIFFERENCE { + label "cpu" + // Any environment with ffmpeg installed should work here. label "tracking" input: