aboutsummaryrefslogtreecommitdiff
path: root/_posts/notes/2023-11-04-using-ffmpeg-to-combine-video-side-by-side.md
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2024-03-10 14:59:14 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2024-03-10 14:59:14 +0100
commit1100562e29f6476448b656dbddd4cf22505523f6 (patch)
tree442eec492199104bd49dfd74474ce89ade8fcac9 /_posts/notes/2023-11-04-using-ffmpeg-to-combine-video-side-by-side.md
parenta40d80be378e46a6c490e1b99b0d8f4acd968503 (diff)
downloadmitjafelicijan.com-1100562e29f6476448b656dbddd4cf22505523f6.tar.gz
Move back to JBMAFP
Diffstat (limited to '_posts/notes/2023-11-04-using-ffmpeg-to-combine-video-side-by-side.md')
-rw-r--r--_posts/notes/2023-11-04-using-ffmpeg-to-combine-video-side-by-side.md41
1 files changed, 0 insertions, 41 deletions
diff --git a/_posts/notes/2023-11-04-using-ffmpeg-to-combine-video-side-by-side.md b/_posts/notes/2023-11-04-using-ffmpeg-to-combine-video-side-by-side.md
deleted file mode 100644
index c47a726..0000000
--- a/_posts/notes/2023-11-04-using-ffmpeg-to-combine-video-side-by-side.md
+++ /dev/null
@@ -1,41 +0,0 @@
1---
2title: "Using ffmpeg to combine videos side by side"
3permalink: /using-ffmpeg-to-combine-video-side-by-side.html
4date: 2023-11-04T09:04:28+02:00
5layout: post
6type: note
7draft: false
8---
9
10I had a 4 webm videos (each 492x451) that I wanted to combine to be played side
11by side and I tried [iMovie](https://support.apple.com/imovie) and
12[Kdenlive](https://kdenlive.org/) and failed to do it in an easy way. I needed
13this for Github readme file so it also needed to be a GIF.
14
15The following is the [ffmpeg](https://ffmpeg.org/) version of it.
16
17```sh
18ffmpeg -y \
19 -i 01.webm \
20 -i 02.webm \
21 -i 03.webm \
22 -i 04.webm \
23 -filter_complex "\
24 [0:v] trim=duration=8, setpts=PTS-STARTPTS, scale=492x451, fps=6 [a0]; \
25 [1:v] trim=duration=8, setpts=PTS-STARTPTS, scale=492x451, fps=6 [a1]; \
26 [2:v] trim=duration=8, setpts=PTS-STARTPTS, scale=492x451, fps=6 [a2]; \
27 [3:v] trim=duration=8, setpts=PTS-STARTPTS, scale=492x451, fps=6 [a3]; \
28 [a0][a1][a2][a3] xstack=inputs=4:layout=0_0|w0_0|w0+w1_0|w0+w1+w2_0, scale=1000:-1 [v]" \
29 -map "[v]" \
30 -crf 23 \
31 -preset veryfast \
32 trigraphs.gif
33```
34
35- This will produce `trigraphs.gif` that is also scaled to max 1000px in width
36 (refer to `scale=1000:-1`).
37- The important part for 4x1 stack is `xstack=inputs=4:layout=0_0|w0_0|w0+w1_0|w0+w1+w2_0`.
38- This will also cap frame rate to 6 (refer to `fps=6`) since that is enough and
39 this makes playback of GIFs smoother in a browser.
40
41![Result](./assets/notes/trigraphs.gif){:loading="lazy"}