]> git.parisson.com Git - telemeta.git/commitdiff
add "" to paths in scripts
authorGuillaume Pellerin <yomguy@parisson.com>
Sun, 29 Sep 2013 20:57:06 +0000 (22:57 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Sun, 29 Sep 2013 20:57:06 +0000 (22:57 +0200)
tools/scripts/transcode/remux_fix_media.py
tools/scripts/transcode/transcode.py

index 3059973f0cf371e47aa62c410969006900ab54f8..ac20e468ebf43c0d01c0f90c83a576f9727f087b 100755 (executable)
@@ -51,7 +51,7 @@ class FixCheckMedia(object):
     def hard_fix_webm(self, path):
         try:
             tmp_file = self.tmp_dir + 'out.webm '
-            command = 'ffmpeg -loglevel 0 -i '+ path + ' -vcodec libvpx -vb 500k -acodec libvorbis -aq 7 -f webm -y ' + tmp_file + ' > /dev/null'
+            command = 'ffmpeg -loglevel 0 -i "'+ path + '" -vcodec libvpx -vb 500k -acodec libvorbis -aq 7 -f webm -y "' + tmp_file + '" > /dev/null'
             print command
             os.system(command)
             command = 'mv '  + tmp_file + path
@@ -63,12 +63,12 @@ class FixCheckMedia(object):
     def fix_webm(self, path):
         try:
             tmp_file = self.tmp_dir + 'out.webm'
-            command = '/usr/local/bin/ffmpeg -loglevel 0 -i ' + path + ' -vcodec copy -acodec copy -f webm -y ' + tmp_file + ' > /dev/null'
+            command = '/usr/local/bin/ffmpeg -loglevel 0 -i "' + path + '" -vcodec copy -acodec copy -f webm -y "' + tmp_file + '" > /dev/null'
             print command
             os.system(command)
             ebml_obj = EBMLData(tmp_file)
             offset = ebml_obj.get_first_cluster_seconds()
-            command = '/usr/local/bin/ffmpeg -loglevel 0 -ss ' + str(offset) + ' -i ' + tmp_file + ' -vcodec copy -acodec copy -f webm -y ' + path + ' > /dev/null'
+            command = '/usr/local/bin/ffmpeg -loglevel 0 -ss ' + str(offset) + ' -i "' + tmp_file + '" -vcodec copy -acodec copy -f webm -y "' + path + '" > /dev/null'
             print command
             os.system(command)
         except:
@@ -76,7 +76,7 @@ class FixCheckMedia(object):
 
     def fix_mp3(self, source, path):
         try:
-            command = '/usr/local/bin/ffmpeg -loglevel 0 -i '+ source + ' -vn -aq 6 -y ' + path + ' > /dev/null'
+            command = '/usr/local/bin/ffmpeg -loglevel 0 -i "'+ source + '" -vn -aq 6 -y "' + path + '" > /dev/null'
             print command
             os.system(command)
         except:
index 32bd3f39cc1979ec5d794e8f219ba9edfa8ff810..451fa0eb080efc3b136655435e7ecc5a6bf4d483 100755 (executable)
@@ -20,9 +20,10 @@ source_format = 'webm'
 preview_tc = '00:00:05'
 threads = 4
 
-ffmpeg_args = {'mp3' : '-i "%s" -vn -acodec libmp3lame -aq 6 -ac 1',
+ffmpeg_args = {
+               'mp3' : '-i "%s" -vn -acodec libmp3lame -aq 6 -ac 1',
                'ogg' : '-i "%s" -vn -acodec copy',
-               'mp4' : '-i "%s" -vcodec libx264 -r 24 -b 512k -threads ' + str(threads) + ' -acodec libfaac -ar 48000 -ab 96k -ac 1',
+               'mp4' : '-i "%s" -vcodec libx264 -r 30 -b 1024k -threads ' + str(threads) + ' -acodec libfaac -ar 48000 -ab 96k -ac 1',
                'png' : '-ss ' + preview_tc + ' -i "%s"',
               }
 
@@ -41,7 +42,7 @@ for root, dirs, files in os.walk(root_dir):
                 dest = os.path.abspath(root + os.sep + local_file)
                 local_files = os.listdir(root)
                 if not local_file in local_files or '--force' in args:
-                    command = 'ffmpeg ' + ffmpeg_args[format] % path + ' -y ' + dest
+                    command = 'ffmpeg -loglevel 0 ' + ffmpeg_args[format] % path + ' -y "' + dest + '"'
                     logger.logger.info(command)
                     if not '--dry-run' in args:
                         os.system(command)