Difference between revisions of "Documentation/Nightly/Modules/ScreenCapture"

From Slicer Wiki
Jump to: navigation, search
(moved to readthedocs)
Tags: 2017 source edit, Replaced
 
Line 4: Line 4:
 
<!-- ---------------------------- -->
 
<!-- ---------------------------- -->
  
<!-- ---------------------------- -->
+
{{documentation/banner
{{documentation/{{documentation/version}}/module-section|Introduction and Acknowledgements}}
+
| text  = [http://slicer.readthedocs.io/en/latest/user_guide/modules/screencapture.html This page has been moved to read-the-docs.]
{{documentation/{{documentation/version}}/module-introduction-start|{{documentation/modulename}}}}
+
| background-color = 8FBC8F }}
{{documentation/{{documentation/version}}/module-introduction-row}}
 
This work was was funded by Cancer Care Ontario and the Ontario Consortium for Adaptive Interventions in Radiation Oncology (OCAIRO).<br>
 
Author: Andras Lasso, PerkLab, Queen's University<br>
 
Contact: Andras Lasso, <email>lasso@queensu.ca</email><br>
 
{{documentation/{{documentation/version}}/module-introduction-end}}
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Module Description}}
 
This module is for acquiring screen capture videos of Slicer viewers. The module can capture image sequences from slice and 3D views and export them as a sequence of images or a video file.
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Use Cases}}
 
{{#ev:youtube|https://www.youtube.com/watch?v=LG5H66ikF1w}}
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-section|Panels}}
 
* '''Input'''
 
** '''View to capture:''' select slice or 3D view that the content will be captured of
 
** '''Animation mode:'''
 
*** 3D rotation: Acquire video of a rotating 3D view (for 3D viewer only). For smooth repeated display of a 360-degree rotation it is recommended to choose 31 or 61 as "Number of images".<br>[[File:SlicerCaptureRotation.gif]]
 
*** slice sweep: Acquire video while going through selected range of image frames (for slice viewer only).<br>[[File:SlicerCaptureSweep.gif]]
 
*** slice fade: Acquire video while fading between the foreground and background image (for slice viewer only).<br>[[File:SlicerCaptureFade.gif]]
 
*** sequence: Acquire video while going through items in the selected sequence browser. Requires installation of [[documentation/{{documentation/version}}/Extensions/Sequences|Sequences]] extension.<br>[[File:SlicerCaptureSequence.gif]]
 
* '''Output'''
 
** '''Number of images:''' Defines how many frames are generated in the specified range. Higher number results in smoother animation but larger video file.
 
** '''Output directory:''' Image frames or video file will be saved in this directory.
 
** '''Video export:''' If checked then exported images are converted to a single video file in the selected format. Requires [[#Setting up ffmpeg|ffmpeg]].
 
** '''Video file name:''' File name of the created video.
 
** '''Video length:''' Set total replay time of the video by adjusting recommended replay speed.
 
*** H264: modern compressed video format, compatible with most contemporary video players.
 
*** MPEG4: commonly used compressed video format, mostly compatible with older video players.
 
*** Animated GIF: file format that provides lower quality images but allows embedding animations into webpages as simple images.
 
* '''Advanced'''
 
** '''ffmpeg executable:''' Path to ffmpeg executable. Requires download and installation of [[#Setting up ffmpeg|ffmpeg]]. Only needed if video export is selected.
 
** '''Video extra options:''' Options for ffmpeg that controls video format and quality. Only needed if video export is selected.
 
*** Parameters ''-i'' (input files), ''-y'' (overwrite without asking), ''-r'' (frame rate) ''-start_number'' are specified by the module and therefore should not be included in the extra options.
 
*** Examples:
 
**** Add a watermark image (MyLogo.png, 10 pixels from the top-right corner) to exported H.264 or MPEG-4 videos:
 
***** Copy MyLogo.png to the output folder
 
***** Add this to video extra options ''-vf movie=MyLogo.png[watermark];[in][watermark]overlay=main_w-overlay_w-10:10[out]''
 
**** Set grayscale animated GIF width to 200 pixels: ''-vf format=gray,scale=200:-1''
 
**** Set color animated GIF width to 200 pixels: ''-filter_complex [0:v]scale=200:-1[scaled];[0:v]palettegen[pal];[scaled][pal]paletteuse''
 
*** More information about available options:
 
*** https://trac.ffmpeg.org/wiki/Encode/H.264
 
**** https://trac.ffmpeg.org/wiki/Encode/MPEG-4
 
**** https://trac.ffmpeg.org/wiki/Encode/YouTube
 
**** https://ffmpeg.org/ffmpeg-all.html
 
** '''Image file name pattern:''' Defines image file naming pattern. %05d will be replaced by the image number (5 numbers, padded with zeros). Only needed if video export is not selected.
 
=== Setting up ffmpeg ===
 
FFmpeg library is not packaged with 3D Slicer due to large package size and licensing requirements for some video compression methods (see https://ffmpeg.org/legal.html). The FFmpeg library has to be downloaded and set up only once and 3D Slicer will remember its location.
 
==== Windows setup instructions ====
 
* Download ffmpeg from here: https://ffmpeg.org/download.html (click Windows icon, select a package, for example 'Download FFmpeg64-bit static')
 
* Extract downloaded package (for example, to ''C:\Users\Public'')
 
* In ''Advanced'' section, ''ffmpeg executable'': select path for ''ffmpeg.exe'' (for example, ''C:\Users\Public\ffmpeg-20160912-bc7066f-win32-static\bin\ffmpeg.exe'')
 
 
 
==== MacOS setup instructions ====
 
* Install homebrew (from http://brew.sh/)
 
* Run: ''brew install ffmpeg''
 
* In ''Advanced'' section, ''ffmpeg executable'': select ''/usr/local/bin/ffmpeg''.
 
 
 
==== Linux setup instructions ====
 
Run these commands from the terminal:
 
<pre>
 
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
 
cd ffmpeg
 
sudo apt-get install libx264-dev
 
./configure --enable-gpl --enable-libx264 --prefix=${HOME}
 
make install
 
</pre>
 
The binary will be in ${HOME}/bin/ffmpeg
 
 
 
<!-- ---------------------------- -->
 
<!-- {{documentation/{{documentation/version}}/module-section|References}} -->
 
 
 
<!-- ---------------------------- -->
 
<!-- {{documentation/{{documentation/version}}/module-section|Information for Developers}} -->
 
 
 
<!-- ---------------------------- -->
 
{{documentation/{{documentation/version}}/module-footer}}
 
<!-- ---------------------------- -->
 

Latest revision as of 21:06, 2 June 2021

Home < Documentation < Nightly < Modules < ScreenCapture