CompressionLevel
是 Export 和 CreateArchive 的一个选项,指定压缩数据时使用的压缩率.
更多信息
- CompressionLevel 的常见设置包括:
-
Automatic 自动选择 val 0(更少压缩)和 1(更多压缩)之间的数字 - 当设置为 CompressionLevelAutomatic 时,通常选择在速度和数据大小之间保持平衡 .
范例
打开所有单元 关闭所有单元基本范例 (1)
audio = AudioGenerator["Sin"]FileSize@Export["file.mp3", audio]FileSize@Export["file.mp3", audio, CompressionLevel -> 1]FileSize@Export["file.mp3", audio, CompressionLevel -> 0]范围 (5)
图像压缩 (2)
image = ExampleData[{"TestImage", "Apples"}];FileSize@Export["file.jpeg", image]FileSize@Export["file.jpeg", image, CompressionLevel -> 1]FileSize@Export["file.jpeg", image, CompressionLevel -> 0]FileByteCount[file = FileNameJoin[{$InstallationDirectory, "Documentation", "English", "System", "ExampleData", "coneflower.jpg"}]]FileByteCount[archive = CreateArchive[file]]DeleteFile[archive]FileByteCount[archive = CreateArchive[file, CompressionLevel -> 0]]DeleteFile[archive]FileByteCount[archive = CreateArchive[file, CompressionLevel -> 1]]DeleteFile[archive]音频压缩 (1)
audio = AudioGenerator["Sin"]FileSize@Export["file.mp3", audio]FileSize@Export["file.mp3", audio, CompressionLevel -> 1]FileSize@Export["file.mp3", audio, CompressionLevel -> 0]视频压缩 (2)
使用 CompressionLevel 选项控制视频操作的文件大小:
v = VideoGenerator[ResourceData["Sample Image: White Dog on a Beach"], 5];a = ExampleData[{"Audio", "PianoScale"}];i = ResourceData["Sample Image: White Dog on a Beach"];
videos = Table[VideoCombine[{v, a}, CompressionLevel -> c], {c, 0, 1, .2}]FileSize[Information[#, "ResourcePath"]]& /@ videosv = Video["ExampleData/Caminandes.mp4"];FileSize[FindFile[Information[v, "ResourcePath"]]]FileSize[FindFile[Information[VideoTrim[v, 10], "ResourcePath"]]]FileSize[Information[VideoTrim[v, 10, CompressionLevel -> 1], "ResourcePath"]]Information[v, "VideoTracks"]FileSize[Information[VideoTrim[v, 10, VideoEncoding -> "LIBVPX-VP9"], "ResourcePath"]]FileSize[Information[VideoTrim[v, 10, VideoEncoding -> "LIBVPX-VP9", CompressionLevel -> 1], "ResourcePath"]]相关指南
-
▪
- 音频格式
文本
Wolfram Research (2020),CompressionLevel,Wolfram 语言函数,https://reference.wolfram.com/language/ref/CompressionLevel.html.
CMS
Wolfram 语言. 2020. "CompressionLevel." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/CompressionLevel.html.
APA
Wolfram 语言. (2020). CompressionLevel. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/CompressionLevel.html 年
BibTeX
@misc{reference.wolfram_2026_compressionlevel, author="Wolfram Research", title="{CompressionLevel}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/CompressionLevel.html}", note=[Accessed: 16-October-2026]}
BibLaTeX
@online{reference.wolfram_2026_compressionlevel, organization={Wolfram Research}, title={CompressionLevel}, year={2020}, url={https://reference.wolfram.com/language/ref/CompressionLevel.html}, note=[Accessed: 16-October-2026]}