1 import subprocess
, shutil
, os
, re
, sys
, tempfile
, ConfigParser
, time
, lrucache
, math
3 from debug
import debug_write
, fn_attr
5 info_cache
= lrucache
.LRUCache(1000)
6 videotest
= os
.path
.join(os
.path
.dirname(__file__
), 'videotest.mpg')
9 return config
.get('Server', 'ffmpeg')
12 # subprocess is broken for me on windows so super hack
13 def patchSubprocess():
14 o
= subprocess
.Popen
._make
_inheritable
16 def _make_inheritable(self
, handle
):
17 if not handle
: return subprocess
.GetCurrentProcess()
18 return o(self
, handle
)
20 subprocess
.Popen
._make
_inheritable
= _make_inheritable
21 mswindows
= (sys
.platform
== "win32")
25 def output_video(inFile
, outFile
, tsn
=''):
26 if tivo_compatable(inFile
, tsn
):
27 debug_write(__name__
, fn_attr(), [inFile
, ' is tivo compatible'])
28 f
= file(inFile
, 'rb')
29 shutil
.copyfileobj(f
, outFile
)
32 debug_write(__name__
, fn_attr(), [inFile
, ' is not tivo compatible'])
33 transcode(inFile
, outFile
, tsn
)
35 def transcode(inFile
, outFile
, tsn
=''):
38 settings
['video_codec'] = select_videocodec(tsn
)
39 settings
['video_br'] = select_videobr(inFile
, tsn
)
40 settings
['video_fps'] = select_videofps(tsn
)
41 settings
['max_video_br'] = select_maxvideobr()
42 settings
['buff_size'] = select_buffsize()
43 settings
['aspect_ratio'] = ' '.join(select_aspect(inFile
, tsn
))
44 settings
['audio_br'] = select_audiobr(tsn
)
45 settings
['audio_fr'] = select_audiofr(inFile
, tsn
)
46 settings
['audio_ch'] = select_audioch(tsn
)
47 settings
['audio_codec'] = select_audiocodec(inFile
, tsn
)
48 settings
['ffmpeg_pram'] = select_ffmpegprams(tsn
)
49 settings
['format'] = select_format(tsn
)
51 cmd_string
= config
.getFFmpegTemplate(tsn
) % settings
53 cmd
= [ffmpeg_path(), '-i', inFile
] + cmd_string
.split()
54 print 'transcoding to tivo model '+tsn
[:3]+' using ffmpeg command:'
56 debug_write(__name__
, fn_attr(), ['ffmpeg command is ', ' '.join(cmd
)])
57 ffmpeg
= subprocess
.Popen(cmd
, bufsize
=512*1024, stdout
=subprocess
.PIPE
)
59 shutil
.copyfileobj(ffmpeg
.stdout
, outFile
)
63 def select_audiocodec(inFile
, tsn
= ''):
64 # Default, compatible with all TiVo's
66 type, width
, height
, fps
, millisecs
, kbps
, akbps
, acodec
, afreq
, par1
, par2
, dar1
, dar2
= video_info(inFile
)
67 if config
.getAudioCodec(tsn
) == None:
68 if acodec
in ('ac3', 'liba52', 'mp2'):
70 cmd_string
= '-y -vcodec mpeg2video -r 29.97 -b 1000k -acodec copy -t 00:00:01 -f vob -'
71 if video_check(inFile
, cmd_string
):
72 typetest
, width
, height
, fps
, millisecs
, kbps
, akbps
, acodec
, afreq
, par1
, par2
, dar1
, dar2
= video_info(videotest
)
73 if not akbps
== None and int(akbps
) <= config
.getMaxAudioBR(tsn
):
74 # compatible codec and bitrate, do not reencode audio
77 codec
= config
.getAudioCodec(tsn
)
79 if (codec
== 'copy' and config
.getCopyTS(tsn
).lower() == 'none' \
80 and type == 'mpeg2video') or config
.getCopyTS(tsn
).lower() == 'false':
82 return '-acodec '+codec
+copyts
84 def select_audiofr(inFile
, tsn
):
85 freq
= '48000' #default
86 type, width
, height
, fps
, millisecs
, kbps
, akbps
, acodec
, afreq
, par1
, par2
, dar1
, dar2
= video_info(inFile
)
87 if not afreq
== None and afreq
in ('44100', '48000'):
88 # compatible frequency
90 if config
.getAudioFR(tsn
) != None:
91 freq
= config
.getAudioFR(tsn
)
94 def select_audioch(tsn
):
95 if config
.getAudioCH(tsn
) != None:
96 return '-ac '+config
.getAudioCH(tsn
)
99 def select_videofps(tsn
):
100 vfps
= '-r 29.97' #default
101 if config
.isHDtivo(tsn
):
103 if config
.getVideoFPS(tsn
) != None:
104 vfps
= '-r '+config
.getVideoFPS(tsn
)
107 def select_videocodec(tsn
):
108 vcodec
= 'mpeg2video' #default
109 if config
.getVideoCodec(tsn
) != None:
110 vcodec
= config
.getVideoCodec(tsn
)
111 return '-vcodec '+vcodec
113 def select_videobr(inFile
, tsn
):
114 return '-b '+select_videostr(inFile
, tsn
)
116 def select_videostr(inFile
, tsn
):
117 video_str
= config
.getVideoBR(tsn
)
118 if config
.isHDtivo(tsn
):
119 type, width
, height
, fps
, millisecs
, kbps
, akbps
, acodec
, afreq
, par1
, par2
, dar1
, dar2
= video_info(inFile
)
120 if kbps
!= None and config
.getVideoPCT() > 0:
121 video_percent
= int(kbps
)*10*config
.getVideoPCT()
122 video_bitrate
= max(config
.strtod(video_str
), video_percent
)
123 video_str
= str(int(min(config
.strtod(config
.getMaxVideoBR())*0.95, video_bitrate
)))
126 def select_audiobr(tsn
):
127 return '-ab '+config
.getAudioBR(tsn
)
129 def select_maxvideobr():
130 return '-maxrate '+config
.getMaxVideoBR()
132 def select_buffsize():
133 return '-bufsize '+config
.getBuffSize()
135 def select_ffmpegprams(tsn
):
136 if config
.getFFmpegPrams(tsn
) != None:
137 return config
.getFFmpegPrams(tsn
)
140 def select_format(tsn
):
142 if config
.getFormat(tsn
) != None:
143 fmt
= config
.getFormat(tsn
)
144 return '-f '+fmt
+' -'
146 def select_aspect(inFile
, tsn
= ''):
147 TIVO_WIDTH
= config
.getTivoWidth(tsn
)
148 TIVO_HEIGHT
= config
.getTivoHeight(tsn
)
150 type, width
, height
, fps
, millisecs
, kbps
, akbps
, acodec
, afreq
, par1
, par2
, dar1
, dar2
= video_info(inFile
)
152 debug_write(__name__
, fn_attr(), ['tsn:', tsn
])
154 aspect169
= config
.get169Setting(tsn
)
156 debug_write(__name__
, fn_attr(), ['aspect169:', aspect169
])
158 optres
= config
.getOptres(tsn
)
160 debug_write(__name__
, fn_attr(), ['optres:', optres
])
163 optHeight
= config
.nearestTivoHeight(height
)
164 optWidth
= config
.nearestTivoWidth(width
)
165 if optHeight
< TIVO_HEIGHT
:
166 TIVO_HEIGHT
= optHeight
167 if optWidth
< TIVO_WIDTH
:
168 TIVO_WIDTH
= optWidth
170 d
= gcd(height
,width
)
171 ratio
= (width
*100)/height
172 rheight
, rwidth
= height
/d
, width
/d
174 debug_write(__name__
, fn_attr(), ['File=', inFile
, ' Type=', type, ' width=', width
, ' height=', height
, ' fps=', fps
, ' millisecs=', millisecs
, ' ratio=', ratio
, ' rheight=', rheight
, ' rwidth=', rwidth
, ' TIVO_HEIGHT=', TIVO_HEIGHT
, 'TIVO_WIDTH=', TIVO_WIDTH
])
176 multiplier16by9
= (16.0 * TIVO_HEIGHT
) / (9.0 * TIVO_WIDTH
)
177 multiplier4by3
= (4.0 * TIVO_HEIGHT
) / (3.0 * TIVO_WIDTH
)
179 if config
.isHDtivo(tsn
) and not optres
:
180 if config
.getPixelAR(0):
182 npar
= config
.getPixelAR(1)
185 # adjust for pixel aspect ratio, if set, because TiVo expects square pixels
187 return ['-s', str(width
) + 'x' + str(int(math
.ceil(height
/npar
)))]
189 # FFMPEG expects width to be a multiple of two
190 return ['-s', str(int(math
.ceil(width
*npar
/2.0)*2)) + 'x' + str(height
)]
191 if height
<= TIVO_HEIGHT
:
192 # pass all resolutions to S3, except heights greater than conf height
194 # else, resize video.
195 if (rwidth
, rheight
) in [(1, 1)] and par1
== '8:9':
196 debug_write(__name__
, fn_attr(), ['File + PAR is within 4:3.'])
197 return ['-aspect', '4:3', '-s', str(TIVO_WIDTH
) + 'x' + str(TIVO_HEIGHT
)]
198 elif (rwidth
, rheight
) in [(4, 3), (10, 11), (15, 11), (59, 54), (59, 72), (59, 36), (59, 54)] or dar1
== '4:3':
199 debug_write(__name__
, fn_attr(), ['File is within 4:3 list.'])
200 return ['-aspect', '4:3', '-s', str(TIVO_WIDTH
) + 'x' + str(TIVO_HEIGHT
)]
201 elif ((rwidth
, rheight
) in [(5, 4), (16, 9), (20, 11), (40, 33), (118, 81), (59, 27)] or dar1
== '16:9')\
202 and (aspect169
or config
.get169Letterbox(tsn
)):
203 debug_write(__name__
, fn_attr(), ['File is within 16:9 list and 16:9 allowed.'])
204 if config
.get169Blacklist(tsn
) or (aspect169
and config
.get169Letterbox(tsn
)):
205 return ['-aspect', '4:3', '-s', str(TIVO_WIDTH
) + 'x' + str(TIVO_HEIGHT
)]
207 return ['-aspect', '16:9', '-s', str(TIVO_WIDTH
) + 'x' + str(TIVO_HEIGHT
)]
210 #If video is wider than 4:3 add top and bottom padding
211 if (ratio
> 133): #Might be 16:9 file, or just need padding on top and bottom
212 if aspect169
and (ratio
> 135): #If file would fall in 4:3 assume it is supposed to be 4:3
213 if (ratio
> 177):#too short needs padding top and bottom
214 endHeight
= int(((TIVO_WIDTH
*height
)/width
) * multiplier16by9
)
215 settings
.append('-aspect')
216 if config
.get169Blacklist(tsn
) or config
.get169Letterbox(tsn
):
217 settings
.append('4:3')
219 settings
.append('16:9')
222 if endHeight
< TIVO_HEIGHT
* 0.99:
223 settings
.append('-s')
224 settings
.append(str(TIVO_WIDTH
) + 'x' + str(endHeight
))
226 topPadding
= ((TIVO_HEIGHT
- endHeight
)/2)
230 settings
.append('-padtop')
231 settings
.append(str(topPadding
))
232 bottomPadding
= (TIVO_HEIGHT
- endHeight
) - topPadding
233 settings
.append('-padbottom')
234 settings
.append(str(bottomPadding
))
235 else: #if only very small amount of padding needed, then just stretch it
236 settings
.append('-s')
237 settings
.append(str(TIVO_WIDTH
) + 'x' + str(TIVO_HEIGHT
))
238 debug_write(__name__
, fn_attr(), ['16:9 aspect allowed, file is wider than 16:9 padding top and bottom', ' '.join(settings
)])
239 else: #too skinny needs padding on left and right.
240 endWidth
= int((TIVO_HEIGHT
*width
)/(height
*multiplier16by9
))
241 settings
.append('-aspect')
242 if config
.get169Blacklist(tsn
) or config
.get169Letterbox(tsn
):
243 settings
.append('4:3')
245 settings
.append('16:9')
248 if endWidth
< (TIVO_WIDTH
-10):
249 settings
.append('-s')
250 settings
.append(str(endWidth
) + 'x' + str(TIVO_HEIGHT
))
252 leftPadding
= ((TIVO_WIDTH
- endWidth
)/2)
256 settings
.append('-padleft')
257 settings
.append(str(leftPadding
))
258 rightPadding
= (TIVO_WIDTH
- endWidth
) - leftPadding
259 settings
.append('-padright')
260 settings
.append(str(rightPadding
))
261 else: #if only very small amount of padding needed, then just stretch it
262 settings
.append('-s')
263 settings
.append(str(TIVO_WIDTH
) + 'x' + str(TIVO_HEIGHT
))
264 debug_write(__name__
, fn_attr(), ['16:9 aspect allowed, file is narrower than 16:9 padding left and right\n', ' '.join(settings
)])
265 else: #this is a 4:3 file or 16:9 output not allowed
266 multiplier
= multiplier4by3
267 settings
.append('-aspect')
268 if ratio
> 135 and config
.get169Letterbox(tsn
):
269 settings
.append('16:9')
270 multiplier
= multiplier16by9
272 settings
.append('4:3')
273 endHeight
= int(((TIVO_WIDTH
*height
)/width
) * multiplier
)
276 if endHeight
< TIVO_HEIGHT
* 0.99:
277 settings
.append('-s')
278 settings
.append(str(TIVO_WIDTH
) + 'x' + str(endHeight
))
280 topPadding
= ((TIVO_HEIGHT
- endHeight
)/2)
284 settings
.append('-padtop')
285 settings
.append(str(topPadding
))
286 bottomPadding
= (TIVO_HEIGHT
- endHeight
) - topPadding
287 settings
.append('-padbottom')
288 settings
.append(str(bottomPadding
))
289 else: #if only very small amount of padding needed, then just stretch it
290 settings
.append('-s')
291 settings
.append(str(TIVO_WIDTH
) + 'x' + str(TIVO_HEIGHT
))
292 debug_write(__name__
, fn_attr(), ['File is wider than 4:3 padding top and bottom\n', ' '.join(settings
)])
295 #If video is taller than 4:3 add left and right padding, this is rare. All of these files will always be sent in
296 #an aspect ratio of 4:3 since they are so narrow.
298 endWidth
= int((TIVO_HEIGHT
*width
)/(height
*multiplier4by3
))
299 settings
.append('-aspect')
300 settings
.append('4:3')
303 if endWidth
< (TIVO_WIDTH
* 0.99):
304 settings
.append('-s')
305 settings
.append(str(endWidth
) + 'x' + str(TIVO_HEIGHT
))
307 leftPadding
= ((TIVO_WIDTH
- endWidth
)/2)
311 settings
.append('-padleft')
312 settings
.append(str(leftPadding
))
313 rightPadding
= (TIVO_WIDTH
- endWidth
) - leftPadding
314 settings
.append('-padright')
315 settings
.append(str(rightPadding
))
316 else: #if only very small amount of padding needed, then just stretch it
317 settings
.append('-s')
318 settings
.append(str(TIVO_WIDTH
) + 'x' + str(TIVO_HEIGHT
))
320 debug_write(__name__
, fn_attr(), ['File is taller than 4:3 padding left and right\n', ' '.join(settings
)])
324 def tivo_compatable(inFile
, tsn
= ''):
325 supportedModes
= [[720, 480], [704, 480], [544, 480], [528, 480], [480, 480], [352, 480]]
326 type, width
, height
, fps
, millisecs
, kbps
, akbps
, acodec
, afreq
, par1
, par2
, dar1
, dar2
= video_info(inFile
)
327 #print type, width, height, fps, millisecs, kbps, akbps, acodec
329 if (inFile
[-5:]).lower() == '.tivo':
330 debug_write(__name__
, fn_attr(), ['TRUE, ends with .tivo.', inFile
])
333 if not type == 'mpeg2video':
334 #print 'Not Tivo Codec'
335 debug_write(__name__
, fn_attr(), ['FALSE, type', type, 'not mpeg2video.', inFile
])
338 if os
.path
.splitext(inFile
)[-1].lower() in ('.ts', '.mpv', '.tp'):
339 debug_write(__name__
, fn_attr(), ['FALSE, ext', os
.path
.splitext(inFile
)[-1],\
340 'not tivo compatible.', inFile
])
344 debug_write(__name__
, fn_attr(), ['FALSE, acodec', acodec
, ', not supported.', inFile
])
348 if not akbps
or int(akbps
) > config
.getMaxAudioBR(tsn
):
349 debug_write(__name__
, fn_attr(), ['FALSE,', akbps
, 'kbps exceeds max audio bitrate.', inFile
])
353 abit
= max('0', akbps
)
354 if int(kbps
)-int(abit
) > config
.strtod(config
.getMaxVideoBR())/1000:
355 debug_write(__name__
, fn_attr(), ['FALSE,', kbps
, 'kbps exceeds max video bitrate.', inFile
])
358 debug_write(__name__
, fn_attr(), ['FALSE,', kbps
, 'kbps not supported.', inFile
])
361 if config
.isHDtivo(tsn
):
363 if config
.getPixelAR(0):
364 if par2
!= None or config
.getPixelAR(1) != 1.0:
365 debug_write(__name__
, fn_attr(), ['FALSE,', par2
, 'not correct PAR,', inFile
])
367 debug_write(__name__
, fn_attr(), ['TRUE, HD Tivo detected, skipping remaining tests', inFile
])
370 if not fps
== '29.97':
371 #print 'Not Tivo fps'
372 debug_write(__name__
, fn_attr(), ['FALSE,', fps
, 'fps, should be 29.97.', inFile
])
375 if not config
.get169Setting(tsn
) or (config
.get169Letterbox(tsn
) and config
.get169Setting(tsn
)):
376 if dar1
== None or not dar1
in ('4:3', '8:9'):
377 debug_write(__name__
, fn_attr(), ['FALSE, DAR', dar1
, 'not supported by BLACKLIST_169 tivos.', inFile
])
380 for mode
in supportedModes
:
381 if (mode
[0], mode
[1]) == (width
, height
):
383 debug_write(__name__
, fn_attr(), ['TRUE,', width
, 'x', height
, 'is valid.', inFile
])
385 #print 'Not Tivo dimensions'
386 debug_write(__name__
, fn_attr(), ['FALSE,', width
, 'x', height
, 'not in supported modes.', inFile
])
389 def video_info(inFile
):
390 mtime
= os
.stat(inFile
).st_mtime
391 if inFile
!= videotest
:
392 if inFile
in info_cache
and info_cache
[inFile
][0] == mtime
:
393 debug_write(__name__
, fn_attr(), ['CACHE HIT!', inFile
])
394 return info_cache
[inFile
][1]
396 if (inFile
[-5:]).lower() == '.tivo':
397 info_cache
[inFile
] = (mtime
, (True, True, True, True, True, True, True, True, True, True, True, True, True))
398 debug_write(__name__
, fn_attr(), ['VALID, ends in .tivo.', inFile
])
399 return True, True, True, True, True, True, True, True, True, True, True, True, True
401 cmd
= [ffmpeg_path(), '-i', inFile
]
402 # Windows and other OS buffer 4096 and ffmpeg can output more than that.
403 err_tmp
= tempfile
.TemporaryFile()
404 ffmpeg
= subprocess
.Popen(cmd
, stderr
=err_tmp
, stdout
=subprocess
.PIPE
, stdin
=subprocess
.PIPE
)
406 # wait 10 sec if ffmpeg is not back give up
407 for i
in xrange(200):
409 if not ffmpeg
.poll() == None:
412 if ffmpeg
.poll() == None:
414 info_cache
[inFile
] = (mtime
, (None, None, None, None, None, None, None, None, None, None, None, None, None))
415 return None, None, None, None, None, None, None, None, None, None, None, None, None
418 output
= err_tmp
.read()
420 debug_write(__name__
, fn_attr(), ['ffmpeg output=', output
])
422 rezre
= re
.compile(r
'.*Video: ([^,]+),.*')
423 x
= rezre
.search(output
)
427 info_cache
[inFile
] = (mtime
, (None, None, None, None, None, None, None, None, None, None, None, None, None))
428 debug_write(__name__
, fn_attr(), ['failed at video codec'])
429 return None, None, None, None, None, None, None, None, None, None, None, None, None
431 rezre
= re
.compile(r
'.*Video: .+, (\d+)x(\d+)[, ].*')
432 x
= rezre
.search(output
)
434 width
= int(x
.group(1))
435 height
= int(x
.group(2))
437 info_cache
[inFile
] = (mtime
, (None, None, None, None, None, None, None, None, None, None, None, None, None))
438 debug_write(__name__
, fn_attr(), ['failed at width/height'])
439 return None, None, None, None, None, None, None, None, None, None, None, None, None
441 rezre
= re
.compile(r
'.*Video: .+, (.+) (?:fps|tb).*')
442 x
= rezre
.search(output
)
446 info_cache
[inFile
] = (mtime
, (None, None, None, None, None, None, None, None, None, None, None, None, None))
447 debug_write(__name__
, fn_attr(), ['failed at fps'])
448 return None, None, None, None, None, None, None, None, None, None, None, None, None
450 # Allow override only if it is mpeg2 and frame rate was doubled to 59.94
451 if (not fps
== '29.97') and (codec
== 'mpeg2video'):
452 # First look for the build 7215 version
453 rezre
= re
.compile(r
'.*film source: 29.97.*')
454 x
= rezre
.search(output
.lower() )
456 debug_write(__name__
, fn_attr(), ['film source: 29.97 setting fps to 29.97'])
460 rezre
= re
.compile(r
'.*frame rate differs from container frame rate: 29.97.*')
461 debug_write(__name__
, fn_attr(), ['Bug in VideoReDo'])
462 x
= rezre
.search(output
.lower() )
466 durre
= re
.compile(r
'.*Duration: (.{2}):(.{2}):(.{2})\.(.),')
467 d
= durre
.search(output
)
469 millisecs
= ((int(d
.group(1))*3600) + (int(d
.group(2))*60) + int(d
.group(3)))*1000 + (int(d
.group(4))*100)
473 #get bitrate of source for tivo compatibility test.
474 rezre
= re
.compile(r
'.*bitrate: (.+) (?:kb/s).*')
475 x
= rezre
.search(output
)
480 debug_write(__name__
, fn_attr(), ['failed at kbps'])
482 #get audio bitrate of source for tivo compatibility test.
483 rezre
= re
.compile(r
'.*Audio: .+, (.+) (?:kb/s).*')
484 x
= rezre
.search(output
)
489 debug_write(__name__
, fn_attr(), ['failed at akbps'])
491 #get audio codec of source for tivo compatibility test.
492 rezre
= re
.compile(r
'.*Audio: ([^,]+),.*')
493 x
= rezre
.search(output
)
498 debug_write(__name__
, fn_attr(), ['failed at acodec'])
500 #get audio frequency of source for tivo compatibility test.
501 rezre
= re
.compile(r
'.*Audio: .+, (.+) (?:Hz).*')
502 x
= rezre
.search(output
)
507 debug_write(__name__
, fn_attr(), ['failed at afreq'])
510 rezre
= re
.compile(r
'.*Video: .+PAR ([0-9]+):([0-9]+) DAR [0-9:]+.*')
511 x
= rezre
.search(output
)
512 if x
and x
.group(1)!="0" and x
.group(2)!="0":
513 par1
, par2
= x
.group(1)+':'+x
.group(2), float(x
.group(1))/float(x
.group(2))
515 par1
, par2
= None, None
518 rezre
= re
.compile(r
'.*Video: .+DAR ([0-9]+):([0-9]+).*')
519 x
= rezre
.search(output
)
520 if x
and x
.group(1)!="0" and x
.group(2)!="0":
521 dar1
, dar2
= x
.group(1)+':'+x
.group(2), float(x
.group(1))/float(x
.group(2))
523 dar1
, dar2
= None, None
525 info_cache
[inFile
] = (mtime
, (codec
, width
, height
, fps
, millisecs
, kbps
, akbps
, acodec
, afreq
, par1
, par2
, dar1
, dar2
))
526 debug_write(__name__
, fn_attr(), ['Codec=', codec
, ' width=', width
, ' height=', height
, ' fps=', fps
, ' millisecs=', millisecs
, ' kbps=', kbps
, ' akbps=', akbps
, ' acodec=', acodec
, ' afreq=', afreq
, ' par=', par1
, par2
, ' dar=', dar1
, dar2
])
527 return codec
, width
, height
, fps
, millisecs
, kbps
, akbps
, acodec
, afreq
, par1
, par2
, dar1
, dar2
529 def video_check(inFile
, cmd_string
):
530 cmd
= [ffmpeg_path(), '-i', inFile
] + cmd_string
.split()
531 ffmpeg
= subprocess
.Popen(cmd
, stdout
=subprocess
.PIPE
)
533 shutil
.copyfileobj(ffmpeg
.stdout
, open(videotest
, 'wb'))
539 def supported_format(inFile
):
540 if video_info(inFile
)[0]:
543 debug_write(__name__
, fn_attr(), ['FALSE, file not supported', inFile
])
547 debug_write(__name__
, fn_attr(), ['killing pid=', str(pid
)])
552 os
.kill(pid
, signal
.SIGTERM
)
556 handle
= ctypes
.windll
.kernel32
.OpenProcess(1, False, pid
)
557 ctypes
.windll
.kernel32
.TerminateProcess(handle
, -1)
558 ctypes
.windll
.kernel32
.CloseHandle(handle
)