diff options
| author | Martin Kaistra | 2016-09-10 15:12:31 +0200 |
|---|---|---|
| committer | Martin Kaistra | 2016-09-10 15:12:31 +0200 |
| commit | 3e40b909bfbab96bb2a0f638d60d95375c473acc (patch) | |
| tree | 206a0945532e0a1a20767e0b159b59158be29790 | |
| parent | e612139c6b91efc8d8c3175bf0dc7c9ca7428d7f (diff) | |
| parent | 5fd95ee242722b3bcf5d78b7755cb10aa9dca512 (diff) | |
Merge branch 'rikai-format-compatibility-improvements'
| -rw-r--r-- | video_thread.py | 25 |
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 |
