使用avconv将(数字排序的)位图文件转换为视频文件

时间:2022-08-21 08:59:44

I am attempting to convert a directory full of .bmp files into a .mp4 file (or similar format).

我试图将完整的.bmp文件转换为.mp4文件(或类似的格式)。

The bitmap files have the following name scheme:

位图文件具有以下名称方案:

output_N_1024.bmp

Where N is an integer in the range 0 to 1023. (No zero padding / fixed width.)

其中N是0到1023范围内的整数。(无填充/固定宽度。)

The command I am using is:

我使用的命令是:

avconv -r 25 -i output_{0..1023}_1024.bmp outputfile.mp4

avconv -r 25 -i output_ {0..1023} _1024.bmp outputfile.mp4

This appears to run okay, and takes about a minute to convert all 1024, 1024 by 1024 resolution - (confusing?) bitmap images into a new file, outputfile.mp4.

这似乎运行正常,大约需要一分钟将所有1024,1024×1024分辨率 - (令人困惑的?)位图图像转换为新文件outputfile.mp4。

However, when I attempt to open this file with VLC, a black window briefly flashes up and then closes. VLC then goes back to its mode where it waits for you to tell it which file to open next. No error or warning messages appear from VLC, which seems kind of strange since it seems to be refusing to play.

但是,当我尝试使用VLC打开此文件时,黑色窗口会短暂闪烁然后关闭。 VLC然后返回其模式,等待您告诉它下一个要打开的文件。 VLC没有出现任何错误或警告消息,这似乎很奇怪,因为它似乎拒绝播放。

What can I do to fix this? Perhaps my converting command is incorrect?

我该怎么做才能解决这个问题?也许我的转换命令不正确?

1 个解决方案

#1


0  

The problem most likely is that you haven't actually passed the command to encode these files to avconv. This has happened because your shell has expanded the filenames already.

最有可能的问题是您实际上没有通过命令将这些文件编码为avconv。发生这种情况是因为你的shell已经扩展了文件名。

The command i have just managed to get to work on my machine is:

我刚刚设法在我的机器上工作的命令是:

avconv -r 2 -i "%d.bmp" -s 600x400 -an out.ogv

Also for whatever reason it didn't want to work without explicitely giving it the size, but i don't think this is your problem.

也无论出于什么原因,它不想在没有明确给出它的大小的情况下工作,但我不认为这是你的问题。

In here quotes tell your shell not to touch this string. %d means digits from 1 to whatever the last file is (if you would want them to be 0-padded this would look like %000d to have maximum of three naughts in front).

在这里引号告诉你的shell不要触摸这个字符串。 %d表示从1到最后一个文件的数字(如果你希望它们是0-padded,这看起来像%000d,前面最多有三个naughts)。

VLC has then opened and ran my file just fine.

然后VLC打开并运行我的文件就好了。

#1


0  

The problem most likely is that you haven't actually passed the command to encode these files to avconv. This has happened because your shell has expanded the filenames already.

最有可能的问题是您实际上没有通过命令将这些文件编码为avconv。发生这种情况是因为你的shell已经扩展了文件名。

The command i have just managed to get to work on my machine is:

我刚刚设法在我的机器上工作的命令是:

avconv -r 2 -i "%d.bmp" -s 600x400 -an out.ogv

Also for whatever reason it didn't want to work without explicitely giving it the size, but i don't think this is your problem.

也无论出于什么原因,它不想在没有明确给出它的大小的情况下工作,但我不认为这是你的问题。

In here quotes tell your shell not to touch this string. %d means digits from 1 to whatever the last file is (if you would want them to be 0-padded this would look like %000d to have maximum of three naughts in front).

在这里引号告诉你的shell不要触摸这个字符串。 %d表示从1到最后一个文件的数字(如果你希望它们是0-padded,这看起来像%000d,前面最多有三个naughts)。

VLC has then opened and ran my file just fine.

然后VLC打开并运行我的文件就好了。