aboutsummaryrefslogtreecommitdiff
path: root/video_thread.py
diff options
context:
space:
mode:
authorMartin Kaistra2016-09-10 15:12:31 +0200
committerMartin Kaistra2016-09-10 15:12:31 +0200
commit3e40b909bfbab96bb2a0f638d60d95375c473acc (patch)
tree206a0945532e0a1a20767e0b159b59158be29790 /video_thread.py
parente612139c6b91efc8d8c3175bf0dc7c9ca7428d7f (diff)
parent5fd95ee242722b3bcf5d78b7755cb10aa9dca512 (diff)
Merge branch 'rikai-format-compatibility-improvements'
Diffstat (limited to 'video_thread.py')
-rw-r--r--video_thread.py25
1 files changed, 20 insertions, 5 deletions
diff --git a/video_thread.py b/video_thread.py
index ed2af84..9f4ce7b 100644
--- a/video_thread.py
+++ b/video_thread.py
@@ -31,7 +31,14 @@ class Worker(QtCore.QObject):
completeAudioArray = self.core.readAudioFile(inputFile)
- out_pipe = sp.Popen([ self.core.FFMPEG_BIN,
+ # test if user has libfdk_aac
+ encoders = sp.check_output(self.core.FFMPEG_BIN + " -encoders -hide_banner", shell=True)
+ if b'libfdk_aac' in encoders:
+ acodec = 'libfdk_aac'
+ else:
+ acodec = 'aac'
+
+ ffmpegCommand = [ self.core.FFMPEG_BIN,
'-y', # (optional) means overwrite the output file if it already exists.
'-f', 'rawvideo',
'-vcodec', 'rawvideo',
@@ -41,12 +48,20 @@ class Worker(QtCore.QObject):
'-i', '-', # The input comes from a pipe
'-an',
'-i', inputFile,
- '-acodec', "libmp3lame", # output audio codec
+ '-acodec', acodec, # output audio codec
+ '-b:a', "192k",
'-vcodec', "libx264",
- '-pix_fmt', "yuv444p",
+ '-pix_fmt', "yuv420p",
'-preset', "medium",
- '-f', "matroska",
- outputFile],
+ '-f', "mp4"]
+
+ if acodec == 'aac':
+ ffmpegCommand.append('-strict')
+ ffmpegCommand.append('-2')
+
+ ffmpegCommand.append(outputFile)
+
+ out_pipe = sp.Popen(ffmpegCommand,
stdin=sp.PIPE,stdout=sys.stdout, stderr=sys.stdout)
smoothConstantDown = 0.08