Video Scrubbing

Scrubbing Personal Information from video files regularly and in batch

Video Scrubbing

Before we share our video data, we first need to remove the sections that have been marked as personal information. You should only scrub video files after the personal information has been checked over completely.

Table of Contents

Videoscrub

This script, found on our Github repo here, functions as a censor for our video files. We have a script called videoscrub that censors our video files. For video PI, it overlays a pure black image file onto the video stream to censor it, and for audio PI, it makes the video silent.

This script depends on FFmpeg. Make sure that the ffmpeg executable is on the system PATH.

There are two versions of this script. One is a command line utility (videoscrub.py) and the other has a GUI (videoscrub-gui.py). They both have the same functionality. The good thing about the command line version is that it can be called from other processes programmatically.

Personal info .csv

The videoscrub script takes a csv file containing PI timestamps as input. This file is generated by the personalinfo.rb script found in the Datavyu Scripts repository. personalinfo.rb takes the PI timestamps from an opf and outputs a csv called [name of opf]_personal_info.csv that contains this information:

audio/video,onset_ms,offset_ms

For example:

audio,2000,3000

audio,5000,7000

audio,9000,13000

video,1000,4000

video,8000,12000

Usage

for GUI

Make sure to pull the latest version by opening a terminal window, type in 'cd' and drag the videoscrub folder from the desktop's Github folder. Press enter. Type 'git pull' and press enter. To start the scrub process, type 'python videoscrub.py' and press enter. This will cause a new scrub window to pop up.

Follow the directions below to load the data:

  1. Load video with "Load Video" - video will be located in the subject files video processing folder.

  2. Load video mask file with "Load Mask" - located in the github folder on the desktop, in the video scrub folder, in the data folder. Select the file named 'black1280x720.png'

  3. Load timestamps with "Load Timestamps" - file located in subject files video annotation folder.

  4. Click "Scrub" to start the process.

  • This will prompt you for a location to save the scrubbed video to. The file should be named XX_XX_video_scrubbed.mp4 and it should be saved to the same directory as the unscrubbed video.mp4 within the Processing folder (ex. Subject_Files/01_01-01-2016/01_06/Home_Visit/Processing/Video_Files).

  1. You can also scrub multiple video files at once to save time. Open up a new terminal window by going to terminal -> new window -> basic (or Command N). Set the new file up the same exact way.

for CLI

Open up a terminal window, type in "cd" and drag the videoscrub folder from the Github folder (from the BLab share). Press enter. Then enter the following script:

The script must be called with 4 arguments:

$ python videoscrub.py [input video.mp4] [personal information .csv] data/black640x368.png [output video.mp4]
  1. input video

  2. personal_info .csv (output by the DataVyu script)

  3. video mask file (this doesn't change; always use black1280x720.png for our videos)

  4. output file (remember to include .mp4 extension)

For example:

$ python videoscrub.py 01_06_video.mp4 01_06_coderSD_personal_info.csv data/black1280x720.png 01_06_video_scrubbed.mp4

NOTE: THIS PROCESS TAKES A LOT OF TIME!

The file should be named XX_XX_video_scrubbed.mp4 and it should be saved to the same directory as the unscrubbed video.mp4 within the Processing folder (ex. Subject_Files/01_01-01-2016/01_06/Home_Visit/Processing/Video_Files).

Final Steps

  1. Open up the newly scrubbed video and check a couple of things: a. The video has rendered successfully by referencing the length of each video with its unscrubbed counterpart b. What we wanted to scrub was actually scrubbed (audio muted and videos blocked out in the proper regions)

Batch video scrubbing

  • found in datavyu_scripts repo.

  • need to provide 2 paths (by setting variables in the script at the top)

    • folder with all the opf_files (collected (variable called 'filedir')

    • folder where to dump personal_info.csv files (variable called 'pinfo_dir')

  • found in the videoscrub repo

  • takes 4 arguments:

    • path to folder with original video files

    • path to folder with personal_info.csv files generated from the batch_personal_info.rb script above.

    • path to black1280x720.png file to mask video with (a copy should be in the 'data' folder in videoscrub repo)

    • output folder to dump the scrubbed files

Last updated