def cpl_probe_asset(asset, essence, path): """ Probe an individual MXF asset. Args: asset (dict): Dictionary representation of Asset. essence (str): Type of Asset. path (str): Absolute path of Asset file. """ if not path.endswith('.mxf'): return try: is_stereoscopic = asset.get('Stereoscopic', False) asset['Probe'] = probe_mxf(path, stereoscopic=is_stereoscopic) is_encrypted = asset['Probe']['EncryptedEssence'] if essence == 'Sound' and not is_encrypted: asset['Probe']['AudioAnalyze'] = stat_mxf_audio( path, int(asset['Probe']['ChannelCount']), asset['EntryPoint'], asset['Duration']) except Exception as e: asset['ProbeError'] = str(e)
def test_subtitle_smpte(self): metadata = probe_mxf(self.get_path('subtitle_smpte.mxf')) self.assertTrue(metadata['LabelSetType'] == 'SMPTE') self.assertEqual(metadata['NamespaceName'], r'http://www.smpte-ra.org/schemas/428-7/2007/DCST')
def test_fake(self): with self.assertRaises(CommandException): probe_mxf('null')
def test_atmos(self): metadata = probe_mxf(self.get_path('atmos.mxf')) self.assertTrue(metadata['AtmosVersion'] == 1)
def test_audio_smpte(self): metadata = probe_mxf(self.get_path('audio_smpte.mxf')) self.assertTrue(metadata['AudioSamplingRate'] == 48000)
def test_video_bitrate(self): metadata = probe_mxf(self.get_path('picture_over_250_mb.mxf'), stereoscopic=False) self.assertTrue(metadata['LabelSetType'] == 'SMPTE') self.assertTrue(metadata['AverageBitRate'] > 250) self.assertTrue(metadata['MaxBitRate'] > 350)
def test_video_smpte(self): metadata = probe_mxf(self.get_path('picture_2D_smpte.mxf'), stereoscopic=False) self.assertTrue(metadata['EditRate'] == 24) self.assertTrue(metadata['LabelSetType'] == 'SMPTE')
def test_video_iop(self): metadata = probe_mxf(self.get_path('picture_2D_iop.mxf'), stereoscopic=False) self.assertTrue(metadata['EditRate'] == 24) self.assertTrue(metadata['LabelSetType'] == 'MXFInterop')