]> git.parisson.com Git - telemeta.git/commitdiff
goto avconv instead of ffmpeg, mp3 intead of aac, 8 threads for x264 1.4.x
authorGuillaume Pellerin <yomguy@parisson.com>
Wed, 21 Oct 2015 10:15:40 +0000 (12:15 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Wed, 21 Oct 2015 10:15:40 +0000 (12:15 +0200)
tools/scripts/transcode/remux_fix_media.py
tools/scripts/transcode/transcode.py

index a95a3bae0b26bf47ddd33e20d121a9a05ccd01d9..2a988869610b6f4ca9b359adfb0ad8396662bd61 100755 (executable)
@@ -57,7 +57,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 = 'avconv -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
@@ -69,12 +69,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 = 'avconv -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 = 'avconv -loglevel 0 -ss ' + str(offset) + ' -i "' + tmp_file + '" -vcodec copy -acodec copy -f webm -y "' + path + '" > /dev/null'
             print command
             os.system(command)
         except:
@@ -82,7 +82,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 = 'avconv -loglevel 0 -i "'+ source + '" -vn -aq 6 -y "' + path + '" > /dev/null'
             print command
             os.system(command)
         except:
index 4a08335011661fd8ded3b84d62c201de6a0d528a..6cee6308ac1f2dbef2a429f817b73371c07f518c 100755 (executable)
@@ -18,13 +18,13 @@ class Logger:
 
 source_format = 'webm'
 preview_tc = '00:00:05'
-threads = 4
+threads = 8
 
 ffmpeg_args = {
                'mp3' : '-i "%s" -vn -acodec libmp3lame -aq 6 -ac 2',
                'ogg' : '-i "%s" -vn -acodec copy',
                'mp4' : '-i "%s" -vcodec libx264 -threads ' + str(threads) + \
-                       ' -c:v libx264 -crf 17 -maxrate 1100k -bufsize 1835k -acodec libfaac -ab 96k -ac 2',
+                       ' -c:v libx264 -crf 17 -maxrate 1100k -bufsize 1835k -acodec libmp3lame -aq 6 -ac 2',
                'png' : '-ss ' + preview_tc + ' -i "%s"',
               }
 
@@ -33,6 +33,8 @@ log_file = args[-1]
 root_dir = args[-2]
 logger = Logger(log_file)
 
+
+
 for root, dirs, files in os.walk(root_dir):
     for file in files:
         path = os.path.abspath(root + os.sep + file)
@@ -42,8 +44,16 @@ for root, dirs, files in os.walk(root_dir):
                 local_file = name + '.' + format
                 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 -loglevel 0 ' + ffmpeg_args[format] % path + ' -y "' + dest + '"'
+                trig = True
+                for filename in local_files:
+                    if '.' + format in filename:
+                        trig = False
+                        break
+                if (not local_file in local_files and trig == True) or '--force' in args:
+                    command = 'avconv -loglevel 0 ' + ffmpeg_args[format] % path + ' -y "' + dest + '"'
                     logger.logger.info(command)
                     if not '--dry-run' in args:
                         os.system(command)
+
+
+