以编程方式编码多媒体文件格式
我总是想知道在哪里可以找到以编程方式编码已知文件格式的规则,例如:.jpg、.png、.mpg。这些二进制格式怎么写呢?几年前,当我浏览 phpBB 脚本时,我发现它们不使用任何 gd 或 imagemagick,它们以二进制方式编写。不仅适用于php,还适用于其他语言?
I'm always wondered where to find rules to encode known file formats, for example: .jpg, .png, .mpg programmatically. How to write these binary formats? Some years ago, when I surfed phpBB scripts, I found that they for example don't use any gd or imagemagick, they write it in binary way. Not only for php, but for other languages as well?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
视频编码是一个完全不同的问题,而且要复杂得多......尽管我想人们已经可以花费大量时间来理解深入了解 JPEG 格式。
通常,在维基百科中查找所需格式的文章将为您提供格式定义或规范的链接。
Video encoding is a whole different issue, and orders of magnitude more complex... Although I imagine one can already spend a lot of time understanding the JPEG format in depth.
Usually, looking up the desired format's article in Wikipedia will either give you the format definition, or a link to the specification.
您是指“data:”URI 规范吗? http://en.wikipedia.org/wiki/Data_URI_scheme
简单base64 编码您的图像,设置正确的 mime 类型,然后享受乐趣。
请注意,这会破坏浏览器对图像的缓存,并且 base64 编码会导致所需数据传输的大小增加大约 4/3。所以这并不是一个明显的性能胜利。
Do you mean the "data:" URI specification? http://en.wikipedia.org/wiki/Data_URI_scheme
Simply base64 encode your image, set the correct mime type, and have fun.
Note that this defeats browser caching of images, and base64-encoding leads to roughly 4/3 size increase of the data transfer required. So it's not an obvious performance win.