def merge_video_files()

in awstreamer/utils/video.py [0:0]


def merge_video_files(files, destination_file):
    '''
    Returns merged file on success, otherwise None.
    '''
    # Nothing to do
    if len(files) <= 1:
        logger.info("Nothing to merge. Returning file: %s" % files)
        return files[0] if len(files) == 1 else None

    # Make list of full path components
    file_list = [i[0] for i in files]

    # Merge video files
    client().start({
        "pipeline": {
            "source": "splitmuxsrc",
            "parse": "h264parse",
            "mux": "matroskamux",
            "sink": "filesink"
        },
        "source": {
            "linkable": False,
            "signals": {
                "format-location": [callback, file_list]
            }
        },
        "sink": {
            "location": destination_file
        }
    })

    # Return merged file info
    if os.path.isfile(destination_file):
        dst_file = (destination_file, Path(destination_file).name, files[0][2])
        return dst_file

    return None