如何将 ffmpeg 的 -progress 选项输出重定向到 stderr? [英] How to redirect -progress option output of ffmpeg to stderr?

查看:73
本文介绍了如何将 ffmpeg 的 -progress 选项输出重定向到 stderr?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在正在 Python 3.7.2 上为 ffmpeg 编写自己的包装,并希望使用它的-progress"选项来读取当前进度,因为它具有高度的机器可读性.问题是 ffmpeg 的-progress"选项仅接受作为其参数文件名和 url.但我不想创建额外的文件,而不是为此目的设置整个网络服务器.

I'm writing my own wraping for ffmpeg on Python 3.7.2 now and want to use it's "-progress" option to read current progress since it's highly machine-readable. The problem is "-progress" option of ffmpeg accepts as its parameter file names and urls only. But I don't want to create additional files not to setup the whole web-server for this purpose.

我在谷歌上搜索了很多,但所有ffmpeg 进度条"项目仅依赖于 ffmpeg 的通用 stderr 输出.Stackoverflow 和 Superuser 上的其他答案仅对-v quiet -stats"感到满意,因为progress"对于谷歌的参数名称来说并不是很方便.

I've google a lot about it, but all the "progress bars for ffmpeg" projects rely on generic stderr output of ffmpeg only. Other answers here on Stackoverflow and on Superuser are being satisfied with just "-v quiet -stats", since "progress" is not very convenient name for parameter to google exactly it's cases.

最好的解决方案是强制 ffmpeg 将它的-progress"输出写入单独的管道,因为 stderr 中还有一些关于文件被编码的有用数据,我不想用-v"扔掉它安静的".虽然如果有一种方法可以将-progress"输出重定向到 stderr,它也会很酷!实际上,任何管道都可以,我只是不知道如何让 ffmpeg 将其写入-progress"而不是在 Windows 中归档.我试过ffmpeg -progress stderr ...",但它只是用这个名字创建了文件.

The best solution would be to force ffmpeg write it's "-progress" output to separate pipe, since there is some useful data in stderr as well regarding file being encoded and I don't want to throw it away with "-v quiet". Though if there is a way to redirect "-progress" output to stderr, it would be cool as well! Any pipe would be ok actually, I just can't figure out how to make ffmpeg write it's "-progress" not to file in Windows. I tried "ffmpeg -progress stderr ...", but it just create the file with this name.

推荐答案

-progress pipe:1 将写出到 stdout,pipe:2 到 stderr.如果您不是从 ffmpeg 流式传输,请使用 stdout.

-progress pipe:1 will write out to stdout, pipe:2 to stderr. If you aren't streaming from ffmpeg, use stdout.

这篇关于如何将 ffmpeg 的 -progress 选项输出重定向到 stderr?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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