This commit is contained in:
2025-10-03 17:07:17 +02:00
parent dfd0902256
commit b31704420f
3 changed files with 15 additions and 6 deletions

View File

@ -22,6 +22,12 @@ class Demuxer:
self.video_stream = self._find_stream(libav.AVMEDIA_TYPE_VIDEO)
self.audio_stream = self._find_stream(libav.AVMEDIA_TYPE_AUDIO)
@property
def nb_streams(self):
if not self._context:
return 0
return self._context.contents.nb_streams
def _find_stream(self, type):
index, codec_ref = libav.format_find_best_stream(self._context, type)
if index < 0 or not codec_ref: