Skip to content

Commit

Permalink
Update ffmpeg.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yinyajiang committed Dec 10, 2024
1 parent 4feac4f commit 7efaa68
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions yt_dlp/postprocessor/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def get_metadata_object(self, path, opts=[]):
try:
return self._get_metadata_object_by_ffmpeg(path)
except Exception as e:
self.report_warning(f'Failed to get metadata object with ffmpeg: {e}')
self.report_warning(f'{e}')

if self.probe_available:
self.report_warning('Only ffprobe is supported for metadata extraction')
Expand Down Expand Up @@ -443,7 +443,7 @@ def _concat_spec(cls, in_files, concat_opts=None):

def _get_metadata_object_by_ffmpeg(self, input_path):
if not self.available or self.basename != 'ffmpeg':
raise FFmpegPostProcessorError('ffmpeg not found. Please install or provide the path using --ffmpeg-location')
raise FFmpegPostProcessorError('Get metadata object by ffmpeg failed, ffmpeg not found. Please install or provide the path using --ffmpeg-location')
result = {
'streams': [],
'format': {
Expand Down Expand Up @@ -522,11 +522,11 @@ def _get_metadata_object_by_ffmpeg(self, input_path):

nb_streams = len(result['streams'])
if nb_streams == 0:
raise FFmpegPostProcessorError('ffmpeg cannot find streams')
raise FFmpegPostProcessorError('Get metadata object by ffmpeg failed, ffmpeg cannot find streams')
if not result['format']['format_name']:
raise FFmpegPostProcessorError('ffmpeg cannot find format_name')
raise FFmpegPostProcessorError('Get metadata object by ffmpeg failed, ffmpeg cannot find format_name')
if not result['format']['duration']:
raise FFmpegPostProcessorError('ffmpeg cannot find duration')
raise FFmpegPostProcessorError('Get metadata object by ffmpeg failed, ffmpeg cannot find duration')
result['format']['nb_streams'] = nb_streams
return result

Expand Down

0 comments on commit 7efaa68

Please sign in to comment.