PRPROJ文件解析:音频片段时间码计算异常求助
PRPROJ文件音频片段时间码提取逻辑困惑
我是入门阶段的Python自学者,正在对Adobe Premiere的PRPROJ文件(压缩XML格式)进行逆向工程,已完成文件解析并将多数属性存入对象,目标是打造读取PRPROJ文件的开源API。当前在提取时间线中音频片段的内部时间码时,遇到逻辑识别难题:Premiere可区分不同音频片段,但我无法找到XML中的判定依据。我先后假设差异源于是否嵌入时间码、文件格式(WAV/AIFF/MP3等),均不成立。我制作了包含多种音频片段的Premiere项目,尝试代码计算In/Out点,已成功处理3种样本,但第4个WAV文件(Sample 4)始终无法正确计算。各样本的XML片段及对应计算代码如下:
样本1(来自.mov视频文件的音频)
<MediaInPoint>0</MediaInPoint> <MediaOutPoint>23843635200000</MediaOutPoint> <MediaFrameRate>4233600000</MediaFrameRate>
计算代码:
cframerate = int(clip_loggings.find('MediaFrameRate').text) cinpoint = int(clip_loggings.find('MediaInPoint').text) cinpoint = round((media_outpoint / cframerate))
clip_timecode_in = round((clip_timecode_in / cframerate)) + cinpoint clip_timecode_out = round((clip_timecode_out - 1) / cframerate) + cinpoint - 1
样本2(MP3文件,时间码源于项目设置)
<MediaInPoint>0</MediaInPoint> <MediaOutPoint>52835328000000</MediaOutPoint> <MediaFrameRate>5760000</MediaFrameRate> VideoSettings' <FrameRate>8475667200</FrameRate>
计算代码:
proj_fr_ref = root.find('ProjectSettings/VideoSettings').get('ObjectRef') cinpoint = int(clip_loggings.find('MediaInPoint').text) cinpoint = round((media_outpoint / cframerate)) for proj_frs in root.findall ('VideoSettings'): if proj_frs.get('ObjectID') == proj_fr_ref: if clip_speed > 0: cframerate = int(proj_frs.find('FrameRate').text) clip_timecode_in = round((clip_timecode_in) / cframerate) + cinpoint # Seems to be linked to Project's VideoSetting's FrameRate, Why??? clip_timecode_out = round((clip_timecode_out - 1)/ cframerate) + cinpoint - 1
样本3(WAV文件,经验证需除以2000系数)
<MediaInPoint>472035821292000</MediaInPoint> <MediaOutPoint>8715173208084000</MediaOutPoint> <MediaFrameRate>5292000</MediaFrameRate> <TimecodeFormat>200</TimecodeFormat>
计算代码:
cinpoint = int(clip_loggings.find('MediaInPoint').text) cinpoint = round((media_outpoint / media_framerate / 2000)) clip_timecode_in = round((clip_timecode_in / cframerate / 2000)) + cinpoint clip_timecode_out = round((clip_timecode_out - 1) / cframerate / 2000) + cinpoint - 1
样本4(待确定判定逻辑)
<CaptureMode>1</CaptureMode> <ClipName>Sample 4.wav</ClipName> <MediaInPoint>0</MediaInPoint> <MediaOutPoint>186823687680000</MediaOutPoint> <MediaFrameRate>5292000</MediaFrameRate> <TimecodeFormat>200</TimecodeFormat>
恳请协助分析该WAV文件时间码计算失败的原因及解决方法。
内容的提问来源于stack exchange,提问作者SMan
相关产品推荐
相关产品推荐

