重新编码 AVI 文件以适合给定的输出文件大小。

发布于 2024-07-10 00:12:59 字数 78 浏览 9 评论 0原文

我有一个 AVI 文件,我想对其重新编码以适合大小为 650 MB 的 CD。 如何编码以使文件大小不超过给定大小? 我可以使用哪个程序?

I have an AVI file, which I want to re-encode to fit on a CD of size 650 MB. How can I encode such that file size does not exceed the given size? Which program can I use ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

爱的十字路口 2024-07-17 00:12:59

我假设您想以编程方式执行此操作:

对于 Windows:

您可以使用 directshow 通过构建过滤器图表来对视频进行转码。

获取(如果您还没有)适用于 Windows 的平台 SDK。 然后浏览此处查看一些为转码构建过滤器图的 directshow 示例。

要构建您将需要基类。 您可以在此处构建它们:

C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\Multimedia\DirectShow\BaseClasses

然后查看此处的示例:

C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\Multimedia\DirectShow

您还可以手动创建过滤器图以了解它们的使用方式并了解这些东西的意义(例如您将在示例):

C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\graphedt.exe

一旦您了解了 directshow 的工作原理,您就可以使用一些数学知识来弄清楚如何对视频进行转码以适合您想要的大小。 为此,您可能需要查看输入视频的每秒帧数以及每帧有多大。

不同的编码器以不同的方式工作:

假设您要将 avi 文件转码为较小或质量较低的 avi 文件。 查看输入帧大小和 fps 以确定整个文件大小,然后使用一些代数来计算如何减小帧大小或减少每秒帧数(或两者的组合)以达到所需的大小(可以是您的输入变量)。

至于其他编码器,您可能想看看它们是如何工作的。 有损编码器(例如 mp4)执行估计以找出视频在帧与帧之间发生的变化,并将该信息存储在文件中以重建帧。 您必须阅读它们的工作原理 - 或者检查如何使用您的特定编码器以获取更多详细信息。

对于Linux(以及Windows):

您可以使用ffmpeg,这是一个全部- 合一用于视频转码和其他操作。 您甚至可以找到命令行应用程序的预构建 exe,尽管主页不托管它(只是源代码)。 该应用程序使用开源视频库来完成大量视频转码以及许多其他操作。 如果您能找到一个好的可靠的 exe 文件,如果您想要一些易于您的应用程序使用的东西,您可能应该检查一下。 在这里查看他们的主页。

我希望这能让你开始。

I assume you want to do this programmatically:

For Windows:

You can use directshow to transcode your video by building a filter graph.

Get (if you don't already have) the platform SDK for windows. Then browse here to check out some of the directshow examples which construct filter graphs for transcoding.

To build you will need the base classes. You can build them here:

C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\Multimedia\DirectShow\BaseClasses

Then check out the examples here:

C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\Multimedia\DirectShow

You can also manually create filter graphs to get a hang for how they are used and see how these things make sense (such as the enumeration of the encoders you will learn about in the examples):

C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\graphedt.exe

Once you have gone this far and understand how directshow works you can use some math to figure out how to transcode your video to fit in the size you want. To do this you may want to look at how many frames/sec your input video is and how big each frame is.

Different encoders work in different ways:

Lets assume you are transcoding avi file to a smaller or lesser quality avi file. Look at your input frame sizes and fps to determine the whole file size, then use some algebra to figure how to either reduce frame size or reduce # of frames per second (or a combination of both) to achieve the desired size (which can be your input variable).

As for other encoders you may want to see how they work. Lossy encoders such as mp4 perform estimations to find out what video has changed from frame to frame- and that information is stored in the file to reconstruct frames. You will have to read about how they work - or check to see how to use your particular encoder for more details.

For Linux (and also windows):

You can use ffmpeg which is an all-in-one for transcoding and other things to video. You can even find prebuilt exe of the command line application, although the main page does not host it (just the source). This application uses open source video libraries to do a lot of the video transcoding as well as many other things. If you can locate a good dependable exe file you should probably check this out if you want something that is easy to use for your application. Check out their homepage here.

I hope this gets you started.

家住魔仙堡 2024-07-17 00:12:59

为了使其适合特定的大小,您必须使用适当的比特率。

对于固定比特率视频,要获取目标比特率,您需要获取目标大小(以位为单位)和源长度(以秒为单位)。

target bit-rate = size / seconds

例如:

seconds = (90mins * 60) = 5400
size = ((650MB * 1024) * 8) = 5324800
target bit-rate = ~986 kilobytes per second

对于可变比特率,事情会变得更加复杂。 不太确定是否有办法准确地使输出文件达到设定的大小。 最简单的方法是使用上述方法计算最大比特率,

To make it fit a specific size, you must use an appropriate bit-rate.

For fixed bit-rate video, to get the target bit-rate you would take the target size, in bits, and the length of the source in seconds.

target bit-rate = size / seconds

For example:

seconds = (90mins * 60) = 5400
size = ((650MB * 1024) * 8) = 5324800
target bit-rate = ~986 kilobytes per second

With variable bit-rate, things are rather more complicated. Not quite sure if there's a way to accurately make the output file a set size. The easiest way is to calculate the maximum bit-rate using the above method,

妄司 2024-07-17 00:12:59

AutoGK 可以非常有效地做到这一点。 主要设计用于 DVD ****咳嗽**** 备份目的,但它也接受 AVI 作为源。 它更多的是具有协调 GUI 的开源程序的集合,因此当安装程序安装多个项目时不必担心。

AutoGK can do this very effectively. Primarily designed for DVD ****cough**** backup purposes, but it will also accept AVI as source. It's more of a collection of opensource programs with a co-ordinating GUI, so don't worry when the installer installs several items.

甜味超标? 2024-07-17 00:12:59

计算 AVI 的秒数。 然后,获取文件大小并除以长度。 转换为千比特每秒,并将其用作比特率中值。 (使用 Google 轻松进行数学计算和转换。)

您可以根据需要权衡视频和音频比特率。 通常 96 kbps 对于 AAC 来说就足够了,但您可能需要更多或更少。 实验。

Calculate the number of seconds the AVI is. Then, take the file size and divide by the length. Convert to kilobits per second, and use that as your bitrate median. (Use Google to do the math and conversion easily.)

You can weigh the video and audio bitrates as you desire. Usually 96 kbps is good enough with AAC, but you may want more or less. Experiment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文