ercanburak commited on
Commit
980d227
·
1 Parent(s): 95312c3

add padding

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -123,20 +123,19 @@ for row_idx in range(num_rows):
123
  inputs_str = " ".join(["-i " + video_path for video_path in video_paths])
124
 
125
  crop_str = "crop=trunc(iw/2)*2:trunc(ih/2)*2"
 
126
 
127
  w = selected_dataset["width"]
128
  input_scaling_parts = []
129
  xstack_input_parts = []
130
  for i in range(num_elements):
131
- input_scaling_part = "[{}:v]scale={}:-1,{}[v{}]".format(i, w, crop_str, i)
132
  input_scaling_parts.append(input_scaling_part)
133
  xstack_input_part = "[v{}]".format(i)
134
  xstack_input_parts.append(xstack_input_part)
135
  input_scaling_str = ";".join(input_scaling_parts)
136
  xstack_input_str = "".join(xstack_input_parts)
137
 
138
-
139
-
140
  # opt = "-c:v libx264 -preset veryslow -crf 18 -c:a copy"
141
  opt = ""
142
  ffmpeg_command_str = "ffmpeg -y " + inputs_str + " -filter_complex \"" + input_scaling_str + ";" + xstack_input_str + "xstack=inputs=" + str(num_elements) + ":layout=" + layout_str + "\"" + opt + " output.mp4"
 
123
  inputs_str = " ".join(["-i " + video_path for video_path in video_paths])
124
 
125
  crop_str = "crop=trunc(iw/2)*2:trunc(ih/2)*2"
126
+ pad_str = "pad=ceil(iw/2)*2+4:ceil(ih/2)*2+4:2:2"
127
 
128
  w = selected_dataset["width"]
129
  input_scaling_parts = []
130
  xstack_input_parts = []
131
  for i in range(num_elements):
132
+ input_scaling_part = "[{}:v]scale={}:-1,{}[v{}]".format(i, w, pad_str, i)
133
  input_scaling_parts.append(input_scaling_part)
134
  xstack_input_part = "[v{}]".format(i)
135
  xstack_input_parts.append(xstack_input_part)
136
  input_scaling_str = ";".join(input_scaling_parts)
137
  xstack_input_str = "".join(xstack_input_parts)
138
 
 
 
139
  # opt = "-c:v libx264 -preset veryslow -crf 18 -c:a copy"
140
  opt = ""
141
  ffmpeg_command_str = "ffmpeg -y " + inputs_str + " -filter_complex \"" + input_scaling_str + ";" + xstack_input_str + "xstack=inputs=" + str(num_elements) + ":layout=" + layout_str + "\"" + opt + " output.mp4"