ercanburak commited on
Commit
026b32c
1 Parent(s): 3ff595d

work even with one video

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -136,7 +136,13 @@ def retrieve_results(selected_dataset, selected_sequence, selected_models, selec
136
  # opt_fill = ":fill=black"
137
  opt_fill = ":fill=white"
138
  # opt_fill = ""
139
- ffmpeg_command_str = "ffmpeg -y " + inputs_str + " -filter_complex \"" + input_scaling_str + ";" + xstack_input_str + "xstack=inputs=" + str(num_inputs) + ":layout=" + layout_str + opt_fill + "\"" + opt + " output.mp4"
 
 
 
 
 
 
140
  print(ffmpeg_command_str)
141
  ret = subprocess.call(ffmpeg_command_str, shell=True)
142
 
@@ -147,6 +153,7 @@ def retrieve_results(selected_dataset, selected_sequence, selected_models, selec
147
  video_bytes = video_file.read()
148
  return video_bytes
149
 
 
150
  st.title("Result Analysis Tool")
151
 
152
  base_data_dir = "data"
 
136
  # opt_fill = ":fill=black"
137
  opt_fill = ":fill=white"
138
  # opt_fill = ""
139
+ if num_inputs > 1:
140
+ ffmpeg_command_str = "ffmpeg -y " + inputs_str + " -filter_complex \"" + input_scaling_str + ";" + xstack_input_str + "xstack=inputs=" + str(num_inputs) + ":layout=" + layout_str + opt_fill + "\"" + opt + " output.mp4"
141
+ else:
142
+ # remove last paranthesis
143
+ idx = input_scaling_str.rfind("[")
144
+ input_scaling_str = input_scaling_str[:idx]
145
+ ffmpeg_command_str = "ffmpeg -y " + inputs_str + " -filter_complex \"" + input_scaling_str + "\"" + opt + " output.mp4"
146
  print(ffmpeg_command_str)
147
  ret = subprocess.call(ffmpeg_command_str, shell=True)
148
 
 
153
  video_bytes = video_file.read()
154
  return video_bytes
155
 
156
+
157
  st.title("Result Analysis Tool")
158
 
159
  base_data_dir = "data"