MCPcopy
hub / github.com/diffgram/diffgram / split

Method split

walrus/methods/video/video_preprocess.py:158–300  ·  view source on GitHub ↗

note that filename vs local path vs blobpath are all different!

(self, i: int)

Source from the content-addressed store, hash-verified

156 return None
157
158 def split(self, i: int):
159 """
160 note that filename vs local path vs blobpath are all different!
161 """
162
163 end_time = self.offset_in_seconds + self.parent_input.video_split_duration
164
165 # These are the actual file names and paths
166 # the blob path is based on input id and deteremined at new input.
167 # keep in mind this changes for each of the clips
168 # so no point storing it on the parent
169 # and don't want to store it on the child because
170 # the child will re download it (potentially on a different machine)
171
172 """
173 Feb 8 2020
174 Had issues where duration was wrong
175 Observe that it copies the existing codec when saving
176 Tested and did not change it
177 Realized local machine working probably means some issue
178 with server side version for ffmpeg.
179
180 """
181
182 # Feb 9 2020, original_filename does NOT include extension.
183 # Careful here, ffmpeg needs a valid extension otherwise throws error
184 new_sub_clip_filename = str(self.offset_in_seconds) + "_" + \
185 self.parent_input.original_filename
186
187 output_temp_local_path = f"{self.parent_input.temp_dir}/{new_sub_clip_filename}"
188
189 try:
190 ffmpeg_extract_subclip(
191 self.parent_input.temp_dir_path_and_filename,
192 self.offset_in_seconds,
193 end_time,
194 targetname = output_temp_local_path)
195 logger.info(f"{str(i)} (Iteration) ffmpeg_extract_subclip Success")
196 except Exception as e:
197 self.log['info'] = f"Last iteration: {str(i)}"
198 logger.error(f"Error splitting video {str(e)}")
199 return False
200
201 """
202 It appears that ffmpeg does not detect if there's no "real"
203 data to be read. So we observe that the "last" files, if less than
204 a certain size probably not a real file.
205
206 When looking at the temp dir see one that are 108 KB (108,000 B)
207 Aren't real files?
208
209 Jan 24, 2020 note this seems to change when we did the "fix"
210 for adjusting the split as described here
211 https://github.com/swirlingsand/ai_vision/commit/b7c0aa3891eb89fa76ad2666137bf7469dcbeab9
212
213 Size example
214 then previous file size is size, ie 1000
215 >>> 10 < (1000/10)

Callers 15

split_videoMethod · 0.95
admin_set_logo_coreFunction · 0.80
user_new_apiFunction · 0.80
update_overlay_image_apiFunction · 0.80
append_to_batch_coreFunction · 0.80
parseHeaderMethod · 0.80
parseMethod · 0.80
get_line_numberMethod · 0.80

Calls 5

new_inputMethod · 0.95
clean_up_temp_dirMethod · 0.95
try_to_commitMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected