From 8477a6c219c92de65d23b4516fe7c8cfe8ac1b5f Mon Sep 17 00:00:00 2001 From: pommicket Date: Sun, 12 Jun 2016 15:28:00 -0400 Subject: Fixed codec problems --- AutoImagesGPU2.py | 16 ---------------- AutoVideosGPU.py | 10 ++++++++-- AutoVideosGPU2.py | 16 ---------------- ImportAutoImages.py | 1 - ImportAutoVideos.py | 1 - README.md | 4 ++-- 6 files changed, 10 insertions(+), 38 deletions(-) delete mode 100644 AutoImagesGPU2.py delete mode 100644 AutoVideosGPU2.py delete mode 100644 ImportAutoImages.py delete mode 100644 ImportAutoVideos.py diff --git a/AutoImagesGPU2.py b/AutoImagesGPU2.py deleted file mode 100644 index d23f06f..0000000 --- a/AutoImagesGPU2.py +++ /dev/null @@ -1,16 +0,0 @@ -import os - -def removeIfExists(filename): - if os.path.exists(filename): - os.remove(filename) - - -exitStatus = os.system('python AutoImagesGPU.py') - -SEGFAULT = 35584 - -while exitStatus == SEGFAULT: - exitStatus = os.system('python ImportAutoImages.py') - -removeIfExists('AutoImagesSettings.txt') -removeIfExists('imageNumber.txt') diff --git a/AutoVideosGPU.py b/AutoVideosGPU.py index a088e65..e65f82d 100644 --- a/AutoVideosGPU.py +++ b/AutoVideosGPU.py @@ -98,8 +98,13 @@ def createVideo(width, height, videoLength, frameRate, functionLength, except: fourcc = cv2.VideoWriter_fourcc(*'XVID') name = ' '.join([namemaker3.generate() for i in range(3)]) + '.avi' - out = cv2.VideoWriter(directory+'/'+name,fourcc, frameRate, (width,height)) - + out = cv2.VideoWriter(directory+'/'+name, fourcc, frameRate, (width,height)) + if not out.isOpened(): + try: + fourcc = cv2.cv.CV_FOURCC(*'MJPG') + except: + fourcc = cv2.VideoWriter_fourcc(*'MJPG') + out = cv2.VideoWriter(directory+'/'+name, fourcc, frameRate, (width,height)) for t in range(int(videoLength*frameRate)): clProgram = replace(clProgramTemplate2, '', str(t)) @@ -120,6 +125,7 @@ def createVideo(width, height, videoLength, frameRate, functionLength, out.write(output[:, :, ::-1]) out.release() + def createVideos(): diff --git a/AutoVideosGPU2.py b/AutoVideosGPU2.py deleted file mode 100644 index b724c2d..0000000 --- a/AutoVideosGPU2.py +++ /dev/null @@ -1,16 +0,0 @@ -import os - -def removeIfExists(filename): - if os.path.exists(filename): - os.remove(filename) - - -exitStatus = os.system('python AutoVideosGPU.py') - -SEGFAULT = 35584 - -while exitStatus == SEGFAULT: - exitStatus = os.system('python ImportAutoVideos.py') - -removeIfExists('AutoVideosSettings.txt') -removeIfExists('videoNumber.txt') diff --git a/ImportAutoImages.py b/ImportAutoImages.py deleted file mode 100644 index 1643a4a..0000000 --- a/ImportAutoImages.py +++ /dev/null @@ -1 +0,0 @@ -import AutoImagesGPU diff --git a/ImportAutoVideos.py b/ImportAutoVideos.py deleted file mode 100644 index a371f51..0000000 --- a/ImportAutoVideos.py +++ /dev/null @@ -1 +0,0 @@ -import AutoVideosGPU diff --git a/README.md b/README.md index e34502b..3fc5798 100644 --- a/README.md +++ b/README.md @@ -40,11 +40,11 @@ cd /directory/where/AutoArt/is/ To run AutoImages: ``` -python AutoImagesGPU2.py +python AutoImagesGPU.py ``` To run AutoVideos: ``` -python AutoVideosGPU2.py +python AutoVideosGPU.py ``` To run AutoAudio: ``` -- cgit v1.2.3