向大文件添加标头的最佳方法 [英] best way to add a header to a large file

查看:83
本文介绍了向大文件添加标头的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

如果文件大小为1-2GB左右,则向现有文件添加标头的最佳方法是什么

C ++

解决方案

1-2GB.资源?在一个文件中? :WTF:

我认为您需要担心的事情比向该文件添加任何内容(甚至是标头)要大得多.标头位于文件末尾.
否则,像mp3v2-header一样,您必须移动文件的所有内容以为标题腾出空间. mp3v2保留了一些额外的更改空间.这就是为什么您不能为标题中的细微更改而再次移动所有内容的原因. 问候.


将wav标头添加到这么大的文件中的问题是,任何播放器在播放文件时都会尝试将整个文件加载到内存中,从而使计算机完全瘫痪,我该怎么办?建议首先将文件分解为固定大小的块(假设为256MB,最后一个文件包含剩余的数据),然后将头分别添加到每个文件中……之后,您可以创建播放列表连续播放音频


Howdy

What ''s the best way to add a header to an existing file if the file size is around 1-2GB

C++

解决方案

1-2GB. Source? In one file? :WTF:

I think you have bigger things to worry about than adding anything, even a header, to that file...


You can do it like mp3 (v1) files do: append a fixed size header at the end of the file.
Otherwise like mp3v2-header you have to move all content of the file to make room for the header. mp3v2 reserves some extra space for changes. Thats why you must not move all the content again for minor changes in your header.
Regards.


the problem with adding the wav header to a file this big is that any player will attempt to load the entire file to memory when playing it, completely bogging down a computer, what I would suggest is first breaking up the file into fixed size blocks (lets say 256MB, with the last file containing whatever data''s left) and then add the header to each file individually... after all that, you can create a playlist to playback the audio continuously


这篇关于向大文件添加标头的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆