Manipulating Zoom videos using FFmpeg
Background
If you’re like me and taught your classes online for the past year and a half using zoom, you may have faced two common video-related issues:
- You interrupted your recording in the middle and as a result, zoom produced
two or more video files (e.g.,
zoom_0.mp4
andzoom_1.mp4
). You are now looking to merge them back into one. - You want to edit out some parts of the video files; typically the beginning or the end.
If you’re like me, you’re also not a big fan of bulky GUIs and would rather know how to use your favorite CLI video editing tool: FFmpeg!
Merging one or more videos
Assuming you have two or more Zoom videos in your current directory (e.g.,
zoom_0.mp4
and zoom_1.mp4
), you first need to create a file that lists them
in order:
$ echo "file 'zoom_0.mp4'" > list.txt
$ echo "file 'zoom_1.mp4'" >> list.txt
...
One all the video files are listed in the file, you can run ffmpeg
and merge
them together into a single video file (e.g., merged.mp4
):
$ ffmpeg -f concat -i list.txt -c copy merged.mp4
This operation is extremely fast as ffmpeg
does not re-encode the videos, it
just concatenate them one after the other.
Splitting a video
From beginning to timestamp
In order to split a Zoom video starting from the beginning and up until a certain timestamp (e.g., 42 minutes and 03 seconds):
$ ffmpeg -i zoom_0.mp4 -c copy -map 0 -brand mp42 -t 42:03 part1.mp4
From timestamp to end
In order to split a Zoom video starting from a certain timestamp (e.g., 42 minutes and 27 seconds) and up until the end:
$ ffmpeg -i zoom_0.mp4 -c copy -map 0 -brand mp42 -ss 42:27 part2.mp4