class_docstr: StreamGear automates transcoding workflow for generating Ultra-Low Latency, High-Quality, Dynamic & Adaptive Streaming Formats (such as MPEG-DASH and HLS) in just few lines of python code.
  StreamGear provides a standalone, highly extensible, and flexible wrapper around FFmpeg multimedia framework for generating chunked-encoded media segments of the content.
  
  SteamGear easily transcodes source videos/audio files & real-time video-frames and breaks them into a sequence of multiple smaller chunks/segments of suitable length. These segments make it
  possible to stream videos at different quality levels (different bitrates or spatial resolutions) and can be switched in the middle of a video from one quality level to another – if bandwidth
  permits – on a per-segment basis. A user can serve these segments on a web server that makes it easier to download them through HTTP standard-compliant GET requests.
  
  SteamGear also creates a Manifest/Playlist file (such as MPD in-case of DASH and M3U8 in-case of HLS) besides segments that describe these segment information (timing, URL, media characteristics like video resolution and bit rates)
   and is provided to the client before the streaming session.
  
  SteamGear currently supports MPEG-DASH (Dynamic Adaptive Streaming over HTTP, ISO/IEC 23009-1) and Apple HLS (HTTP live streaming).
docstr: Internal function that Extracts, Evaluates & Validates user-defined streams
  
  Parameters:
      streams (dict): Indivisual streams formatted as list of dict.
      output_params (dict): Output FFmpeg parameters
docstr_tok: ["Internal","function","that","Extracts",",","Evaluates","&","Validates","user-defined","streams","Parameters",":","streams","(","dict",")",":","Indivisual","streams","formatted","as","list","of","dict",".","output_params","(","dict",")",":","Output","FFmpeg","parameters"]
code: def __evaluate_streams(self, streams, output_params, bpp):
      """
      Internal function that Extracts, Evaluates & Validates user-defined streams
  
      Parameters:
          streams (dict): Indivisual streams formatted as list of dict.
          output_params (dict): Output FFmpeg parameters
      """
      # temporary streams count variable
      output_params["stream_count"] = 1  # default is 1
  
      # check if streams are empty
      if not streams:
          logger.warning("No `-streams` are provided!")
          return output_params
  
      # check if streams are valid
      if isinstance(streams, list) and all(
          isinstance(x, dict) for x in streams
      ):
          stream_count = 1  # keep track of streams
          # calculate source aspect-ratio
          source_aspect_ratio = self.__inputwidth / self.__inputheight
          # log the process
          self.__logging and logger.debug(
              "Processing {} streams.".format(len(streams))
          )
          # iterate over given streams
          for stream in streams:
              stream_copy = stream.copy()  # make copy
              intermediate_dict = (
                  {}
              )  # handles intermediate stream data as dictionary
  
              # define and map stream to intermediate dict
              if self.__format != "hls":
                  intermediate_dict["-core{}".format(stream_count)] = [
                      "-map",
                      "0",
                  ]
              else:
                  intermediate_dict["-corev{}".format(stream_count)] = [
                      "-map",
                      "0:v",
                  ]
                  if "-acodec" in output_params:
                      intermediate_dict[
                          "-corea{}".format(stream_count)
                      ] = [
                          "-map",
                          "{}:a".format(
                              1 if "-core_audio" in output_params else 0
                          ),
                      ]
  
              # extract resolution & indivisual dimension of stream
              resolution = stream.pop("-resolution", "")
              dimensions = (
                  resolution.lower().split("x")
                  if (resolution and isinstance(resolution, str))
                  else []
              )
              # validate resolution
              if (
                  len(dimensions) == 2
                  and dimensions[0].isnumeric()
                  and dimensions[1].isnumeric()
              ):
                  # verify resolution is w.r.t source aspect-ratio
                  expected_width = math.floor(
                      int(dimensions[1]) * source_aspect_ratio
                  )
                  if int(dimensions[0]) != expected_width:
                      logger.warning(
                          "Given stream resolution `{}` is not in accordance with the Source Aspect-Ratio. Stream Output may appear Distorted!".format(
                              resolution
                          )
                      )
                  # assign stream resolution to intermediate dict
                  intermediate_dict[
                      "-s:v:{}".format(stream_count)
                  ] = resolution
              else:
                  # otherwise log error and skip stream
                  logger.error(
                      "Missing `-resolution` value, Stream `{}` Skipped!".format(
                          stream_copy
                      )
                  )
                  continue
  
              # verify given stream video-bitrate
              video_bitrate = stream.pop("-video_bitrate", "")
              if (
                  video_bitrate
                  and isinstance(video_bitrate, str)
                  and video_bitrate.endswith(("k", "M"))
              ):
                  # assign it
                  intermediate_dict[
                      "-b:v:{}".format(stream_count)
                  ] = video_bitrate
              else:
                  # otherwise calculate video-bitrate
                  fps = stream.pop("-framerate", 0.0)
                  if (
                      dimensions
                      and isinstance(fps, (float, int))
                      and fps > 0
                  ):
                      intermediate_dict[
                          "-b:v:{}".format(stream_count)
                      ] = "{}k".format(
                          get_video_bitrate(
                              int(dimensions[0]),
                              int(dimensions[1]),
                              fps,
                              bpp,
                          )
                      )
                  else:
                      # If everything fails, log and skip the stream!
                      logger.error(
                          "Unable to determine Video-Bitrate for the stream `{}`, Skipped!".format(
                              stream_copy
                          )
                      )
                      continue
              # verify given stream audio-bitrate
              audio_bitrate = stream.pop("-audio_bitrate", "")
              if "-acodec" in output_params:
                  if audio_bitrate and audio_bitrate.endswith(
                      ("k", "M")
                  ):
                      intermediate_dict[
                          "-b:a:{}".format(stream_count)
                      ] = audio_bitrate
                  else:
                      # otherwise calculate audio-bitrate
                      if dimensions:
                          aspect_width = int(dimensions[0])
                          intermediate_dict[
                              "-b:a:{}".format(stream_count)
                          ] = "{}k".format(
                              128 if (aspect_width > 800) else 96
                          )
              # update output parameters
              output_params.update(intermediate_dict)
              # clear intermediate dict
              intermediate_dict.clear()
              # clear stream copy
              stream_copy.clear()
              # increment to next stream
              stream_count += 1
          output_params["stream_count"] = stream_count
          self.__logging and logger.debug(
              "All streams processed successfully!"
          )
      else:
          logger.warning("Invalid type `-streams` skipped!")
  
      return output_params
  
imports: import os
  import time
  import math
  import platform
  import pathlib
  import difflib
  import logging
  import subprocess
  from tqdm import tqdm
  from fractions import Fraction
  from collections import OrderedDict
  from .helper import capPropId, dict2Args, delete_ext_safe, extract_time, is_valid_url, logger_handler, validate_audio, validate_video, check_WriteAccess, get_video_bitrate, get_valid_ffmpeg_path, logcurr_vidgear_ver
label_desc: Use image node_id 6 for calling the StreamGear obj's underlying member method code with example usage: obj.__evaluate_streams(streams, output_params, bpp) and returns: output_params, output_params