[./tv/vignettes/vignettes.py] ffmpeg a une facheuse tendance à planter en utilisant toutes les ressources cpu sur certains chaînes

darcs-hash:20090304121231-8fbb1-6348917f8aadbabcba5e3fbd2d0a208f2cbf0924.gz
This commit is contained in:
Olivier Huber 2009-03-04 13:12:31 +01:00
parent 055a655738
commit b4ce95f3fa

View file

@ -115,11 +115,15 @@ def vignettes() :
print '\trecuperation du flux' print '\trecuperation du flux'
#ip port duree #ip port duree
os.system('/usr/scripts/tv/dumpudp %s 1234 2 > %s/%s.ts 2>/dev/null' % (ip,tmp_dir,ip)) os.system('/usr/scripts/tv/dumpudp %s 1234 2 > %s/%s.ts 2>/dev/null' % (ip,tmp_dir,ip))
os.system('ffmpeg -deinterlace -an -i %s/%s.ts -s 400x300 -r 1 -t 00:00:01 -f image2 %s/%s.jpg 1>/dev/null 2>/dev/null' % (tmp_dir,ip,img_dir,fqdn)) pid = os.spawnlp(os.P_NOWAIT,'ffmpeg','ffmpeg','-deinterlace','-an','-i','%s/%s.ts' %(tmp_dir,ip),'-s','400x300','-r','1','-t','00:00:01','-f','image2','%s/%s.jpg' % (img_dir,fqdn))
time.sleep(3)
os.kill(pid,9)
if not os.path.exists('%s/%s.jpg' % (img_dir,fqdn)) or not os.stat('%s/%s.jpg' % (img_dir,fqdn))[6] : if not os.path.exists('%s/%s.jpg' % (img_dir,fqdn)) or not os.stat('%s/%s.jpg' % (img_dir,fqdn))[6] :
print '\tOn retente' print '\tOn retente'
os.system('/usr/scripts/tv/dumpudp %s 1234 2 > %s/%s.ts ' % (ip,tmp_dir,ip)) os.system('/usr/scripts/tv/dumpudp %s 1234 2 > %s/%s.ts ' % (ip,tmp_dir,ip))
os.system('ffmpeg -deinterlace -an -i %s/%s.ts -s 400x300 -r 1 -t 00:00:01 -f image2 %s/%s.jpg 1>/dev/null 2>/dev/null' % (tmp_dir,ip,img_dir,fqdn)) pid = os.spawnlp(os.P_NOWAIT,'ffmpeg','ffmpeg','-deinterlace','-an','-i %s/%s.ts' %(tmp_dir,ip),'-s 400x300','-r 1','-t 00:00:01','-f image2 %s/%s.jpg' % (img_dir,fqdn))
time.sleep(3)
os.kill(pid,9)
if not os.path.exists('%s/%s.jpg' % (img_dir,fqdn)) or not os.stat('%s/%s.jpg' % (img_dir,fqdn))[6] : if not os.path.exists('%s/%s.jpg' % (img_dir,fqdn)) or not os.stat('%s/%s.jpg' % (img_dir,fqdn))[6] :
shutil.copy('%s/fail.jpg' % (img_dir) , '%s/%s.jpg' % (img_dir,fqdn)) shutil.copy('%s/fail.jpg' % (img_dir) , '%s/%s.jpg' % (img_dir,fqdn))