音频 DRM 主要是特定于格式的,因为大多数支持 DRM 的格式都可以通过其容器轻松识别,这通常反映在其扩展名中。这是为了让玩家知道它正在处理什么,而无需分析文件。一个常见的示例是您可以从 iTunes 购买的 AAC 文件。如果受 FairPlay DRM 保护,该文件将被命名为.m3p(与未受保护的 相比.m4a)。
没有什么可以阻止公司加密.mp3并保持扩展名不变 - 当用户切换到十亿个可用 MP3 播放器中的一个并且它不起作用时,这只会惹恼用户。
对于视频来说,情况可能会稍微复杂一些。某些视频容器格式支持 DRM,因此它们的扩展名不必更改。我建议尝试获取ffmpeg或themonospot分析每个文件。
这是我刚刚编写的一个小 bash 函数,可以从文件中获取编解码器:
function codec() {
ffmpeg -i "$1" 2>&1 | grep Stream | grep -Eo '(Audio|Video)\: [^ ,]+'
}
Run Code Online (Sandbox Code Playgroud)
行动中:
oli@bert:~/Desktop$ codec "The Beatles - 01 - Back In The U.S.S.R.mp3"
Audio: mp3
Run Code Online (Sandbox Code Playgroud)
您可以进一步削减它,但在一些已知的带有 DRM 的媒体上尝试一下,看看会发生什么。它要么会爆炸,要么会告诉您有关 DRM 的信息。
不管怎样,一旦你知道会发生什么,你可以批处理它,或者类似的东西来快速告诉你哪些文件有 DRM。
小智 2
要确定视频上的 DRM,您可以使用ffmpeg -i <filename>
例如,在从 Apple 购买的电影中,可以在输出中看到这一点:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc22d005600] ignoring 'frma' atom of 'mp4a', stream format is 'drms'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc22d005600] ignoring 'frma' atom of 'avc1', stream format is 'drmi'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc22d005600] ignoring 'frma' atom of 'ac-3', stream format is 'drms'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc22d005600] stream 0, timescale not set
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc22d005600] Could not find codec parameters for stream 1 (Video: none (drmi / 0x696D7264), none, 1920x1032, 5234 kb/s): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc22d005600] Could not find codec parameters for stream 2 (Audio: none (drms / 0x736D7264), 48000 Hz, 5.1(side), 384 kb/s): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc22d005600] Could not find codec parameters for stream 4 (Subtitle: none (p608 / 0x38303670), 1920x1032, 0 kb/s): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Run Code Online (Sandbox Code Playgroud)