#!/usr/bin/env python3

# Define function ...
def return_video_height(fname, /, *, debug = False, playlist = -1, timeout = 60.0):
    # Import sub-functions ...
    from .__ffprobe__ import __ffprobe__
    from .ffprobe import ffprobe
    from .return_video_rotation import return_video_rotation

    # Make sure that this fname/playlist combination is in the global dictionary ...
    if fname not in __ffprobe__:
        __ffprobe__[fname] = {}
    if playlist not in __ffprobe__[fname]:
        if debug:
            print(f"INFO: Running ffprobe(\"{fname}\", {playlist:d}) ...")
        __ffprobe__[fname][playlist] = ffprobe(fname, playlist = playlist, timeout = timeout)

    # Loop over streams ...
    for stream in __ffprobe__[fname][playlist]["streams"]:
        # Skip stream if it is not video ...
        if stream["codec_type"].strip().lower() != "video":
            continue

        # Check the rotation ...
        if return_video_rotation(fname, debug = debug, playlist = playlist, timeout = timeout) in [0, 180]:
            # Return height ...
            return int(stream["height"])                                        # [px]
        if return_video_rotation(fname, debug = debug, playlist = playlist, timeout = timeout) in [90, 270]:
            # Return width ...
            return int(stream["width"])                                         # [px]

    # Return error ...
    return -1                                                                   # [px]

3aa563053a910a59cf014271bbc65f9b1ca8a2e6
<mask token>

def return_video_height(fname, /, *, debug=False, playlist=-1, timeout=60.0):
    from .__ffprobe__ import __ffprobe__
    from .ffprobe import ffprobe
    from .return_video_rotation import return_video_rotation
    if fname not in __ffprobe__:
        __ffprobe__[fname] = {}
    if playlist not in __ffprobe__[fname]:
        if debug:
            print(f'INFO: Running ffprobe("{fname}", {playlist:d}) ...')
        __ffprobe__[fname][playlist] = ffprobe(fname, playlist=playlist,
            timeout=timeout)
    for stream in __ffprobe__[fname][playlist]['streams']:
        if stream['codec_type'].strip().lower() != 'video':
            continue
        if return_video_rotation(fname, debug=debug, playlist=playlist,
            timeout=timeout) in [0, 180]:
            return int(stream['height'])
        if return_video_rotation(fname, debug=debug, playlist=playlist,
            timeout=timeout) in [90, 270]:
            return int(stream['width'])
    return -1

#!/usr/bin/env python3

# Define function ...
def return_video_height(fname, /, *, debug = False, playlist = -1, timeout = 60.0):
    # Import sub-functions ...
    from .__ffprobe__ import __ffprobe__
    from .ffprobe import ffprobe
    from .return_video_rotation import return_video_rotation

    # Make sure that this fname/playlist combination is in the global dictionary ...
    if fname not in __ffprobe__:
        __ffprobe__[fname] = {}
    if playlist not in __ffprobe__[fname]:
        if debug:
            print(f"INFO: Running ffprobe(\"{fname}\", {playlist:d}) ...")
        __ffprobe__[fname][playlist] = ffprobe(fname, playlist = playlist, timeout = timeout)

    # Loop over streams ...
    for stream in __ffprobe__[fname][playlist]["streams"]:
        # Skip stream if it is not video ...
        if stream["codec_type"].strip().lower() != "video":
            continue

        # Check the rotation ...
        if return_video_rotation(fname, debug = debug, playlist = playlist, timeout = timeout) in [0, 180]:
            # Return height ...
            return int(stream["height"])                                        # [px]
        if return_video_rotation(fname, debug = debug, playlist = playlist, timeout = timeout) in [90, 270]:
            # Return width ...
            return int(stream["width"])                                         # [px]

    # Return error ...
    return -1                                                                   # [px]
