

Video grids with ffmpeg
source link: https://www.phpied.com/video-grids-with-ffmpeg/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Video grids with ffmpeg
I wanted to create a video that is a 3x2 grid of 6 other videos. This one to be precise:
I was hoping I can use ffmpeg, because the thought of using a proper video editing software gives me the chills. In fact at some point I thought things will require iMovie and went to install it. But it required OS update. Screw that! FFMPEG it is.
Turns out there's more than one way to skin that particular cat. One is using xstack filter
ffmpeg -i 1.m4v -i 2.m4v -i 3.m4v -i 4.m4v -i 5.m4v -i 6.m4v \ -filter_complex "xstack=inputs=6:layout=0_0|0_h0|w0_0|w0_h0|w0+w3_0|w0+w3_h0" \ -map "[out]" output.m4v
The other is to use hstack and vstack:
ffmpeg -i 1.m4v -i 2.m4v -i 3.m4v -i 4.m4v -i 5.m4v -i 6.m4v \ -filter_complex "[0:v][2:v][4:v]hstack=inputs=3[top];[1:v][3:v][5:v]hstack=inputs=3[bottom];[top][bottom]vstack=inputs=2[v]" \ -map "[v]" output.m4v
I'm no ffmpeg expert so I cannot afford the luxury of even pretending to begin to explain this syntax. But it works!
Side note: video editing with Reaper
How do I trim and time-align video without a video editor? I use my music editing software Reaper (unlimitted trial, $60 otherwise). I record the audio in Reaper and the video on an oldish iPhone. Then I drop the video in Reaper and cut it as regular audio file. And visually align the waveforms from the audio recording and the video. Then turn down the volume of the video.
Recommend
-
16
Real-time video processing with Rust, FFmpeg and OpenCVBy Miguel PalhasOn December 2, 2020
-
10
ffmpeg: make a video with a static image and an audio file July 6th, 2021. Tagged: ...
-
26
ffmpeg-to-webrtc ffmpeg-to-webrtc demonstrates how to send video from ffmpeg to your browser using pion. This example has the same structure as
-
11
How to Extract Key Frames from A Video with ffmpeg2021-12-25tools410 words 2 mins read 39 times readIn order to get enough information from videos, we...
-
7
Merge Instagram Post Live Video and Audio in ffmpeg March 07, 2018 ...
-
10
davidwebca commented
-
5
I need also way to stream multiple videos :/ ...
-
3
Create a Thumbnail From a Video with ffmpeg By David Walsh on October 25, 2022 Creating a thumbnail to represent a video is a frequent task when pr...
-
4
Resize a video with FFmpeg for Mastodon How to resize a video with FFmpeg before uploading it to Mastodon to comply its resolution and size restrictions. ...
-
6
Merging two video clips into one and placing them next to each other with ffmpeg · GitHub Instantly share code, notes, and...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK