Exemplo n.º 1
0
def GetMatroskaOrWebMProperties( path ):
    
    tags = matroska.parse( path )
    
    segment = tags['Segment'][0]
    
    info = segment['Info'][0]
    duration = int( ( info['Duration'][0] * info['TimecodeScale'][0] / 1e9 ) * 1000 )
    
    tracks = segment['Tracks'][0]
    trackentries = tracks['TrackEntry']
    
    for trackentry in trackentries:
        
        if 'Video' in trackentry:
            
            video = trackentry['Video'][0]
            
            width = video[ 'PixelWidth' ][0]
            height = video[ 'PixelHeight' ][0]
            
            break
            
        
    
    num_frames = 0
    
    return ( ( width, height ), duration, num_frames )
Exemplo n.º 2
0
def GetMatroskaOrWebMProperties(path):

    tags = matroska.parse(path)

    segment = tags['Segment'][0]

    info = segment['Info'][0]
    duration = int(
        (info['Duration'][0] * info['TimecodeScale'][0] / 1e9) * 1000)

    tracks = segment['Tracks'][0]
    trackentries = tracks['TrackEntry']

    for trackentry in trackentries:

        if 'Video' in trackentry:

            video = trackentry['Video'][0]

            width = video['PixelWidth'][0]
            height = video['PixelHeight'][0]

            break

    num_frames = 0

    return ((width, height), duration, num_frames)
Exemplo n.º 3
0
def GetMatroskaOrWebm( path ):
    
    tags = matroska.parse( path )
    
    ebml = tags[ 'EBML' ][0]
    
    if ebml[ 'DocType' ][0] == 'matroska': return HC.VIDEO_MKV
    elif ebml[ 'DocType' ][0] == 'webm': return HC.VIDEO_WEBM
    
    raise Exception()
Exemplo n.º 4
0
def GetMatroskaOrWebm(path):

    tags = matroska.parse(path)

    ebml = tags['EBML'][0]

    if ebml['DocType'][0] == 'matroska': return HC.VIDEO_MKV
    elif ebml['DocType'][0] == 'webm': return HC.VIDEO_WEBM

    raise Exception()
Exemplo n.º 5
0
def GetMatroskaOrWebm(path):

    try:

        # a whole bunch of otherwise good webms aren't parseable by this, so default to 'I guess it is a webm, then.'

        tags = matroska.parse(path)

        ebml = tags['EBML'][0]

        if ebml['DocType'][0] == 'matroska':

            return HC.VIDEO_MKV

    except:

        pass

    return HC.VIDEO_WEBM
Exemplo n.º 6
0
def GetMatroskaOrWebm( path ):
    
    try:
        
        # a whole bunch of otherwise good webms aren't parseable by this, so default to 'I guess it is a webm, then.'
        
        tags = matroska.parse( path )
        
        ebml = tags[ 'EBML' ][0]
        
        if ebml[ 'DocType' ][0] == 'matroska':
            
            return HC.VIDEO_MKV
            
        
    except:
        
        pass
        
    
    return HC.VIDEO_WEBM