Python check ffmpeg
9 Python code examples are found related to "
check ffmpeg".
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: download.py From instagram-livestream-downloader with MIT License | 8 votes |
def check_ffmpeg(binary_path): ffmpeg_binary = binary_path or os.getenv('FFMPEG_BINARY', 'ffmpeg') cmd = [ ffmpeg_binary, '-version'] logger.debug('Executing: "%s"' % ' '.join(cmd)) exit_code = subprocess.call(cmd) logger.debug('Exit code: %s' % exit_code)
Example 2
Source File: diagnostics.py From aeneas with GNU Affero General Public License v3.0 | 6 votes |
def check_ffmpeg(cls): """ Check whether ``ffmpeg`` can be called. Return ``True`` on failure and ``False`` on success. :rtype: bool """ try: from aeneas.ffmpegwrapper import FFMPEGWrapper input_file_path = gf.absolute_path(u"tools/res/audio.mp3", __file__) handler, output_file_path = gf.tmp_file(suffix=u".wav") converter = FFMPEGWrapper() result = converter.convert(input_file_path, output_file_path) gf.delete_file(handler, output_file_path) if result: gf.print_success(u"ffmpeg OK") return False except: pass gf.print_error(u"ffmpeg ERROR") gf.print_info(u" Please make sure you have ffmpeg installed correctly") gf.print_info(u" and that its path is in your PATH environment variable") return True
Example 3
Source File: Utils.py From Instagram-API with MIT License | 5 votes |
def checkFFMPEG(): """ Check for ffmpeg/avconv dependencies :rtype: str/bool :return: name of the library if present, false otherwise """ try: return_value = exec_php(['ffmpeg', '-version', '2>&1'])[0] if return_value == 0: return "ffmpeg" return_value = exec_php(['avconv', '-version', '2>&1'])[0] if return_value == 0: return "avconv" except Exception: pass return False
Example 4
Source File: DownloaderForRedditGUI.py From DownloaderForReddit with GNU General Public License v3.0 | 5 votes |
def check_ffmpeg(self): """ Checks that ffmpeg is installed on the host system and notifies the user if it is not installed. Will also disable reddit video download depending on the user input through the dialog. """ if not VideoMerger.ffmpeg_valid and self.settings_manager.display_ffmpeg_warning_dialog: disable = Message.ffmpeg_warning(self) self.settings_manager.download_reddit_hosted_videos = not disable self.settings_manager.display_ffmpeg_warning_dialog = False
Example 5
Source File: gnomecast.py From gnomecast with GNU General Public License v3.0 | 5 votes |
def check_ffmpeg(self): time.sleep(1) ffmpeg_available = True print('check_ffmpeg') try: print(subprocess.check_output(['which', 'ffmpeg'])) except Exception as e: print(e, e.output) ffmpeg_available = False if not ffmpeg_available: def f(): dialog = Gtk.MessageDialog(self.win, 0, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, "FFMPEG not Found") dialog.format_secondary_text("Could not find ffmpeg. Please run 'sudo apt-get install ffmpeg'.") dialog.run() dialog.destroy() # TODO: there's a weird pause here closing the dialog. why? sys.exit(1) GLib.idle_add(f)
Example 6
Source File: convert.py From speech with Apache License 2.0 | 5 votes |
def check_ffmpeg(): """ Check if ffmpeg is installed. """ return check_install(FFMPEG, "-version")
Example 7
Source File: flow.py From iqiyi-parser with MIT License | 5 votes |
def checkFfmpeg(): dlm = nbdler.Manager() if (not os.path.exists('ffmpeg.exe') or os.path.exists('ffmpeg.exe.nbdler')) and not os.path.exists(cv.FFMPEG_PATH): dlg = wx.MessageDialog(None, u'该程序需要ffmpeg.exe才能完成工作,是否要下载?', u'提示', wx.YES_NO | wx.ICON_INFORMATION) if dlg.ShowModal() != wx.ID_YES: return False dl = nbdler.open(urls=[TOOL_REQ_URL['ffmpeg']], max_conn=16, filename='ffmpeg.zip') dlm.addHandler(dl) dlg = gui.DialogGetTool(gui.frame_downloader, u'正在下载 Ffmpeg 3.2.zip', dl.getFileSize(), dlm) dlg.Bind(wx.EVT_TIMER, GetTool._process, dlg.timer) dlg.timer.Start(50, oneShot=False) dlm.run() msg = dlg.ShowModal() if not dlm.isEnd(): dlm.shutdown() dlg.Destroy() return False GetTool.unzip_ffmpeg('ffmpeg.zip') if msg == wx.ID_OK: return True else: return False else: return True
Example 8
Source File: freesound.py From Mash-Cogs with GNU General Public License v3.0 | 5 votes |
def check_ffmpeg(): """Windows only""" files = ("ffmpeg", "ffprobe", "ffplay") if not all([shutil.which(f) for f in files]): # Return the path to an executable which would be run if the given cmd was called. If no cmd would be called, return None. return False else: return True
Example 9
Source File: utilities.py From BORIS with GNU General Public License v3.0 | 4 votes |
def check_ffmpeg_path(): """ check for ffmpeg path firstly search for embedded version if not found search for system wide version (must be in the path) Returns: bool: True if ffmpeg path found else False str: if bool True returns ffmpegpath else returns error message """ if sys.platform.startswith("linux") or sys.platform.startswith("darwin"): ffmpeg_path = pathlib.Path("") # search embedded ffmpeg if sys.argv[0].endswith("start_boris.py"): ffmpeg_path = pathlib.Path(sys.argv[0]).resolve().parent / "boris" / "misc" / "ffmpeg" if sys.argv[0].endswith("__main__.py"): ffmpeg_path = pathlib.Path(sys.argv[0]).resolve().parent / "misc" / "ffmpeg" if not ffmpeg_path.is_file(): # search global ffmpeg ffmpeg_path = "ffmpeg" # test ffmpeg r, msg = test_ffmpeg_path(str(ffmpeg_path)) if r: return True, str(ffmpeg_path) else: return False, "FFmpeg is not available" ''' r = False if os.path.exists(os.path.abspath(os.path.join(syspath, os.pardir)) + "/FFmpeg/ffmpeg"): ffmpeg_bin = os.path.abspath(os.path.join(syspath, os.pardir)) + "/FFmpeg/ffmpeg" r, msg = test_ffmpeg_path(ffmpeg_bin) if r: return True, ffmpeg_bin # check if ffmpeg in same directory than boris.py if os.path.exists(syspath + "/ffmpeg"): ffmpeg_bin = syspath + "/ffmpeg" r, msg = test_ffmpeg_path(ffmpeg_bin) if r: return True, ffmpeg_bin # check for ffmpeg in system path ffmpeg_bin = "ffmpeg" r, msg = test_ffmpeg_path(ffmpeg_bin) if r: return True, ffmpeg_bin else: logging.critical("FFmpeg is not available") return False, "FFmpeg is not available" ''' if sys.platform.startswith("win"): ffmpeg_path = pathlib.Path("") # search embedded ffmpeg if sys.argv[0].endswith("start_boris.py"): ffmpeg_path = pathlib.Path(sys.argv[0]).resolve().parent / "boris" / "misc" / "ffmpeg.exe" if sys.argv[0].endswith("__main__.py"): ffmpeg_path = pathlib.Path(sys.argv[0]).resolve().parent / "misc" / "ffmpeg.exe" if not ffmpeg_path.is_file(): # search global ffmpeg ffmpeg_path = "ffmpeg" # test ffmpeg r, msg = test_ffmpeg_path(str(ffmpeg_path)) if r: return True, str(ffmpeg_path) else: return False, "FFmpeg is not available"