0

Is it possible to create a grid of 9 videos to form one big video, then snapshot the first frame to create a thumbnail showing the first frames of all 9 videos? I wish to take the first 9 videos from a contact.txt file

I started by trying with 4 videos but it still doesnt work:

ffmpeg -y -ss 00:00:01 -protocol_whitelist file,pipe -f concat -safe 0 -i "concat.txt" -filter_complex "[0:v][1:v]hstack=inputs=2[top];[2:v][3:v]hstack=inputs=2[bottom];[top][bottom]vstack=inputs=2[v]" -map "[v]" -s 1280x720 "thumb.jpg"

Trying to get this layout: enter image description here

MUST use files from concat list in text file

John Doe
  • 301
  • 2
  • 12
  • `ffmpeg -i input0 -i input1 -i input2 -i input3 -i input4 -i input5 -i input6 -i input7 -i input8 -filter_complex "[0:v][1:v][2:v][3:v][4:v][5:v][6:v][7:v][8:v]xstack=inputs=9:layout=0_0|w0_0|w0+w1_0|0_h0|w3_h0|w3+w4_h0|0_h0+h1|w6_h0+h1|w6+w7_h0+h1,scale=1280:-1" -frames:v 1 output.jpg` adapted from [Vertically or horizontally stack (mosaic) several videos using ffmpeg?](https://stackoverflow.com/a/33764934/). Not practical to do it using the concat demuxer as ffmpeg will treat it as 1 sequentially ordered, long input. – llogan Feb 28 '21 at 22:40
  • Is it possible to make this work with a contact text file list of videos instead of directly specifying input files? – John Doe Feb 28 '21 at 22:43
  • Yes, but it will not be straightforward. 1) Determine the timestamp for the first frame of each video. 2) use select filter to select desired frame using timestamp from previous step. 3) arrange with xstack filter. However, as you are doing no concatenation the concat demuxer the wrong tool for the job. – llogan Feb 28 '21 at 22:48
  • Why is it a requirement to use the concat demuxer file list? – llogan Feb 28 '21 at 22:55
  • Because this is part of a much larger program I have been developing over the past few months, and long story short, a concat text file is the only way for me to feed the videos into the command at the stage where I need it. – John Doe Mar 01 '21 at 14:49
  • I found another way around it without using concat but instead setting 9 variables in sequence within a loop then using the created variables as inputs for the code you provided. After a lot of tweaking, I got the result I needed. Thank you. – John Doe Mar 01 '21 at 15:29

0 Answers0