diff options
| author | Martin Kaistra | 2016-09-10 15:09:58 +0200 |
|---|---|---|
| committer | Martin Kaistra | 2016-09-10 15:09:58 +0200 |
| commit | 5fd95ee242722b3bcf5d78b7755cb10aa9dca512 (patch) | |
| tree | 32a72bea4b90facde2f123dc23e5ebc17bf7d479 /video_thread.py | |
| parent | 2efa4cdcb08fc1e214a0dc7d5659f8b22cc3c693 (diff) | |
use aac if libfdk_aac not installed
Diffstat (limited to 'video_thread.py')
| -rw-r--r-- | video_thread.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/video_thread.py b/video_thread.py index 25b3b46..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,13 +48,20 @@ class Worker(QtCore.QObject): '-i', '-', # The input comes from a pipe '-an', '-i', inputFile, - '-acodec', "libfdk_aac", # output audio codec + '-acodec', acodec, # output audio codec '-b:a', "192k", '-vcodec', "libx264", '-pix_fmt', "yuv420p", '-preset', "medium", - '-f', "mp4", - 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 |
