Change matching pattern for detecting input vs output streams in FFmpeg.

This commit is contained in:
SergeantPanda 2025-06-17 21:33:26 -05:00
parent 573ed96e82
commit ae88141c36

View file

@ -497,17 +497,19 @@ class StreamManager:
content_lower = content.lower()
# Check for stream info lines first and delegate to ChannelService
# Only parse INPUT streams (which have hex identifiers like [0x100]) not output streams
# Look for input streams using the decimal pattern ([num][num][num][num]) instead of hex
if "stream #" in content_lower and ("video:" in content_lower or "audio:" in content_lower):
# Check if this is an input stream by looking for the hex identifier pattern [0x...]
if "stream #0:" in content_lower and "[0x" in content_lower:
# Check if this is an input stream by looking for the decimal pattern ([27][0][0][0] / 0x...)
# This pattern contains decimal values in square brackets, not hexadecimal
decimal_pattern = r'\(\[[0-9]+\]\[[0-9]+\]\[[0-9]+\]\[[0-9]+\]'
if "stream #0:" in content_lower and re.search(decimal_pattern, content_lower):
from .services.channel_service import ChannelService
if "video:" in content_lower:
ChannelService.parse_and_store_stream_info(self.channel_id, content, "video")
elif "audio:" in content_lower:
ChannelService.parse_and_store_stream_info(self.channel_id, content, "audio")
else:
# This is likely an output stream (no hex identifier), don't parse it
# This is likely an output stream (no decimal pattern), don't parse it
logger.debug(f"Skipping output stream info: {content}")
# Determine log level based on content
if any(keyword in content_lower for keyword in ['error', 'failed', 'cannot', 'invalid', 'corrupt']):