开发者

Changing mp4ize.py to work on Windows

Mp4ize (python) is a utility for converting video files to mp4 for use on iPhone and iPod. I'm trying to get it to run on Windows.

The python script relies on the library fcntl, and according to another question ( fcntl substitute on Windows ), the Windows equivalent is win32api. The other question also says:

If you provide more details about the fcntl calls people can find windows equivalents.

and since I've had no luck trying to rewrite the code myself, I thought I'd ask here.

How can I rewrite the following code for use on Windows?

fcntl.fcntl(
    p.stderr.fileno(),
    fcntl.F_SETFL,
    fcntl.fcntl(p.stderr.fileno(), fcntl.F_GETFL) | os.O_NONBLOCK,开发者_开发问答
)

See here for the full source code.


This command sets the NONBLOCK option of the standard error file descriptor. This lets it pass data through before the entirety of the data has been written to it.

The patch at http://pastebin.com/Zr5LN8Ui will work, with progress indicators, on Windows. However, it will sometimes report a bad encode even when the encode was good.

It uses the solution from Non-blocking read on a subprocess.PIPE in python to allow non blocking IO, and fixes the pad option (your version didn't work for my test file) and progress bar for a modern FFMpeg.

Note that it is hardcoded to use the linked method when FFMpeg gets passed 3 or more command line options, as it messes up the first call to FFMpeg which gets the resolution of the input file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜