forked from LBRYCommunity/lbry-sdk
Merge pull request #2773 from lbryio/fix_video_analysis_error
fix video analysis error
This commit is contained in:
commit
b7103c29dd
2 changed files with 6 additions and 5 deletions
|
@ -25,7 +25,7 @@ class VideoFileAnalyzer:
|
||||||
process = await asyncio.create_subprocess_exec(self._conf.ffmpeg_folder + command, *args,
|
process = await asyncio.create_subprocess_exec(self._conf.ffmpeg_folder + command, *args,
|
||||||
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
||||||
stdout, stderr = await process.communicate() # returns when the streams are closed
|
stdout, stderr = await process.communicate() # returns when the streams are closed
|
||||||
return stdout.decode() + stderr.decode(), process.returncode
|
return stdout.decode(errors='replace') + stderr.decode(errors='replace'), process.returncode
|
||||||
|
|
||||||
async def _verify_executable(self, name):
|
async def _verify_executable(self, name):
|
||||||
try:
|
try:
|
||||||
|
@ -119,10 +119,9 @@ class VideoFileAnalyzer:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
result, _ = await self._execute("ffprobe", f'-v debug "{video_file}"')
|
result, _ = await self._execute("ffprobe", f'-v debug "{video_file}"')
|
||||||
iterator = re.finditer(r"\s+seeks:(\d+)\s+", result)
|
match = re.search(r"Before avformat_find_stream_info.+?\s+seeks:(\d+)\s+", result)
|
||||||
for match in iterator:
|
if match and int(match.group(1)) != 0:
|
||||||
if int(match.group(1)) != 0:
|
return "Video stream descriptors are not at the start of the file (the faststart flag was not used)."
|
||||||
return "Video stream descriptors are not at the start of the file (the faststart flag was not used)."
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -228,6 +228,7 @@ class BlockchainProcess(asyncio.SubprocessProtocol):
|
||||||
|
|
||||||
def process_exited(self):
|
def process_exited(self):
|
||||||
self.stopped.set()
|
self.stopped.set()
|
||||||
|
self.ready.set()
|
||||||
|
|
||||||
|
|
||||||
class BlockchainNode:
|
class BlockchainNode:
|
||||||
|
@ -315,6 +316,7 @@ class BlockchainNode:
|
||||||
BlockchainProcess, *command
|
BlockchainProcess, *command
|
||||||
)
|
)
|
||||||
await self.protocol.ready.wait()
|
await self.protocol.ready.wait()
|
||||||
|
assert not self.protocol.stopped.is_set()
|
||||||
|
|
||||||
async def stop(self, cleanup=True):
|
async def stop(self, cleanup=True):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue