Skip to content

Commit 83649d2

Browse files
committed
adding the scripts for preprocessing zoom recordings
1 parent 3cf6965 commit 83649d2

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed

zoom_preprocessing/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Preprocess zoom recordings
2+
3+
In this folder there are three scripts (3 steps) to preprocess zoom recordings where a single speaker is sharing their screen and webcam so that the recorded video file shows the screenshare+webcam on the same frame.
4+
5+
- Step1 trims the video (e.g. to remove introduction and post-talk discussions)
6+
- Step2 extracts pngs from the video to identify the coordinates for the screenshare and the webcam view of the speaker.
7+
- Step3 splits the zoom video into two sub-videos: the screenshare view and the webcam view, and then overlaps the webcam view on top of the screenshare on the top right corner.
8+
9+
Note: if the speaker is sharing something important in the top right corner, the webcam view will hide it.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# This script runs on triton where the module "ffmpeg" is available. Alternatively, just make sure ffmpeg is visible from your PATH
3+
module load ffmpeg
4+
5+
# For each video to process, find manually the starting time (parameter for -ss) and the length (paramter for -to)
6+
# Here below an example that was splitting two long zoom recordings into 4 shorter videos.
7+
8+
ffmpeg -ss 00:03:06 -i source_videos/1.mp4 -to 00:04:00 -c copy trimmed/1_1_episode1.mp4
9+
ffmpeg -ss 00:00:24 -i source_videos/2.mp4 -to 00:18:06 -c copy trimmed/2_1_episode2.mp4
10+
ffmpeg -ss 00:26:32 -i source_videos/2.mp4 -to 00:23:46 -c copy trimmed/2_2_episode2.mp4
11+
ffmpeg -ss 01:09:10 -i source_videos/2.mp4 -to 00:16:51 -c copy trimmed/2_3_episode2.mp4
12+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# This step is needed to identify the coordinates of the screen-share and of the "webcam" of the speaker. It basically saves pngs for one frame for each video and then manually one has to identify the coordinates for step3
4+
5+
for n in $(find trimmed -name "*.mp4");do
6+
bn=$(basename $n)
7+
echo 'ffmpeg -i '$n' -vf "select=eq(n\,5000)" -vframes 1 frames/'$bn'.png'
8+
ffmpeg -i $n -vf "select=eq(n\,5000)" -vframes 1 frames/$bn.png
9+
done
10+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
# Episode 1
3+
# x y w h
4+
# screen: 6 176 2230 1250
5+
# camera: 2240 710 320 164
6+
# crop out the screen
7+
ffmpeg -i trimmed/1_1_episode1.mp4 -filter:v "crop=2230:1250:6:176" -c:v libx264 -crf 18 -preset fast -c:a copy cropped/1_1_episode1_screen.mp4
8+
9+
# crop out the camera
10+
ffmpeg -i trimmed/1_1_episode1.mp4 -filter:v "crop=320:164:2240:710" -c:v libx264 -crf 18 -preset fast -c:a copy cropped/1_1_episode1_camera.mp4
11+
12+
# merge screen and camera
13+
ffmpeg -i cropped/1_1_episode1_screen.mp4 -i cropped/1_1_episode1_camera.mp4 -filter_complex "[0:v][1:v] overlay=W-w:0" -c:v libx264 -crf 18 -preset fast -c:a copy final/episode1.mp4
14+
15+
# Episode2_1
16+
# x y w h
17+
# 4 182 1912 1074
18+
# we don't have camera for this episode :(
19+
ffmpeg -i trimmed/2_1_episode2.mp4 -filter:v "crop=1912:1074:4:182" -c:v libx264 -crf 18 -preset fast -c:a copy final/2_1_episode2_screen.mp4
20+
21+
# Episode2_2
22+
# x y w h
23+
# screen: 4 182 1912 1074
24+
# camera: 1920 90 320 164
25+
# crop out the screen
26+
ffmpeg -i trimmed/2_2_episode2.mp4 -filter:v "crop=1912:1074:4:182" -c:v libx264 -crf 18 -preset fast -c:a copy cropped/2_2_episode2_screen.mp4
27+
28+
# crop out the camera
29+
ffmpeg -i trimmed/2_2_episode2.mp4 -filter:v "crop=320:164:1920:90" -c:v libx264 -crf 18 -preset fast -c:a copy cropped/2_2_episode2_camera.mp4
30+
31+
# merge screen and camera
32+
ffmpeg -i cropped/2_2_episode2_screen.mp4 -i cropped/2_2_episode2_camera.mp4 -filter_complex "[0:v][1:v] overlay=W-w:0" -c:v libx264 -crf 18 -preset fast -c:a copy final/episode2.mp4
33+
34+
35+
# Episode2_3
36+
# x y w h
37+
# screen: 4 182 1912 1074
38+
# camera 1920 90 320 164
39+
40+
# crop out the screen
41+
ffmpeg -i trimmed/2_3_episode2.mp4 -filter:v "crop=1912:1074:4:182" -c:v libx264 -crf 18 -preset fast -c:a copy cropped/2_3_episode2_screen.mp4
42+
43+
# crop out the camera
44+
ffmpeg -i trimmed/2_3_episode2.mp4 -filter:v "crop=320:164:1920:90" -c:v libx264 -crf 18 -preset fast -c:a copy cropped/2_3_episode2_camera.mp4
45+
46+
# merge screen and camera
47+
ffmpeg -i cropped/2_3_episode2_screen.mp4 -i cropped/2_3_episode2_camera.mp4 -filter_complex "[0:v][1:v] overlay=W-w:0" -c:v libx264 -crf 18 -preset fast -c:a copy final/episode2.mp4
48+

0 commit comments

Comments
 (0)