コード例 #1
0
ファイル: HydrusVideoHandling.py プロジェクト: wlerin/hydrus
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 )
コード例 #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)
コード例 #3
0
ファイル: HydrusVideoHandling.py プロジェクト: wlerin/hydrus
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()
コード例 #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()
コード例 #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
コード例 #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