mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
add ffmpeg validator, error handling
This commit is contained in:
parent
4fa28d6c03
commit
64f39193f5
2 changed files with 44 additions and 14 deletions
28
pype/plugins/global/publish/validate_ffmpeg_installed.py
Normal file
28
pype/plugins/global/publish/validate_ffmpeg_installed.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import pyblish.api
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
||||
class ValidateFfmpegInstallef(pyblish.api.Validator):
|
||||
"""Validate availability of ffmpeg tool in PATH"""
|
||||
|
||||
order = pyblish.api.ValidatorOrder
|
||||
label = 'Validate ffmpeg installation'
|
||||
families = ['review']
|
||||
optional = True
|
||||
|
||||
def is_tool(self, name):
|
||||
try:
|
||||
devnull = open(os.devnull, "w")
|
||||
subprocess.Popen(
|
||||
[name], stdout=devnull, stderr=devnull
|
||||
).communicate()
|
||||
except OSError as e:
|
||||
if e.errno == os.errno.ENOENT:
|
||||
return False
|
||||
return True
|
||||
|
||||
def process(self, instance):
|
||||
if self.is_tool('ffmpeg') is False:
|
||||
self.log.error("ffmpeg not found in PATH")
|
||||
raise RuntimeError('ffmpeg not installed.')
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import subprocess
|
||||
import contextlib
|
||||
|
||||
import capture_gui
|
||||
|
|
@ -6,6 +7,7 @@ import clique
|
|||
|
||||
import pype.maya.lib as lib
|
||||
import pype.api
|
||||
import avalon.maya
|
||||
|
||||
from maya import cmds, mel
|
||||
import pymel.core as pm
|
||||
|
|
@ -106,20 +108,20 @@ class ExtractQuicktime(pype.api.Extractor):
|
|||
movieFile = filename + ".mov"
|
||||
full_movie_path = os.path.join(stagingdir, movieFile)
|
||||
self.log.info("output {}".format(full_movie_path))
|
||||
|
||||
try:
|
||||
(
|
||||
ffmpeg
|
||||
.input(input_path, framerate=fps, start_number=int(start))
|
||||
.output(full_movie_path)
|
||||
.run(overwrite_output=True,
|
||||
capture_stdout=True,
|
||||
capture_stderr=True)
|
||||
)
|
||||
except ffmpeg.Error as e:
|
||||
ffmpeg_error = 'ffmpeg error: {}'.format(e.stderr.decode())
|
||||
self.log.error(ffmpeg_error)
|
||||
raise Exception(ffmpeg_error)
|
||||
with avalon.maya.suspended_refresh():
|
||||
try:
|
||||
(
|
||||
ffmpeg
|
||||
.input(input_path, framerate=fps, start_number=int(start))
|
||||
.output(full_movie_path)
|
||||
.run(overwrite_output=True,
|
||||
capture_stdout=True,
|
||||
capture_stderr=True)
|
||||
)
|
||||
except ffmpeg.Error as e:
|
||||
ffmpeg_error = 'ffmpeg error: {}'.format(e.stderr)
|
||||
self.log.error(ffmpeg_error)
|
||||
raise RuntimeError(ffmpeg_error)
|
||||
|
||||
if "files" not in instance.data:
|
||||
instance.data["files"] = list()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue