运行ffmpeg而不输出配置信息?

发布于 2024-10-31 11:43:37 字数 3243 浏览 4 评论 0原文

我正在使用 ffmpeg 调用 ffmpeg python.org/py3k/library/subprocess.html#subprocess.Popen" rel="noreferrer">subprocess.Popen,并尝试捕获 stderr 输出并将其写入 日志记录

args = ['ffmpeg', '-i', path]
if start:
    args += ['-ss', start]
if end:
    args += ['-t', end]
args += [
    '-vcodec', 'copy',
    '-acodec', 'copy',
    '-scodec', 'copy',
    '-f', 'mpegts',
    '-y', '/dev/stdout']
self.child = subprocess.Popen(
    args,
    stdin=open(os.devnull, 'rb'),
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE)

ffmpeg 生成很多配置信息,如下所示:

FFmpeg 版本 0.6.2-4:0.6.2-1ubuntu1, 版权所有 (c) 2000-2010 Libav 开发商建于 2011 年 3 月 22 日 15:55:04 与 gcc 4.5.2
配置: --extra-version=4:0.6.2-1ubuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable- libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --启用-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static 警告:库配置 libavutil 配置不匹配: --extra-version=4:0.6.2-1ubuntu2 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable- libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-运行时CPUDetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdirac --enable-libfaad --启用libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libdc1394 --enable-shared --disable-static libavcodec配置: --extra-version=4:0.6.2-1ubuntu2 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable- libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-运行时CPUDetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdirac --enable-libfaad --启用libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libdc1394 --enable-shared --disable-static libavutil 50.15。 1 / 50.15。 1
libavcodec 52.72。 2 / 52.72。 2
libav 格式 52.64。 2 / 52.64。 2
libavdevice 52.2.0 / 52.2.0
libavfilter 1.19。 0 / 1.19。 0
libswscale 0.11。 0 / 0.11。 0
libpostproc 51.2.0 / 51.2.0

在最终输出我想要记录的内容之前:

似乎是流 0 编解码器帧速率 与容器帧速率不同: 47.95 (66893/1395) -> 23.98 (66893/2790) 至少一个输出文件 必须指定

是否有一个选项可以防止这种过多的输出?我应该采取不同的做法吗?

I'm invoking ffmpeg with subprocess.Popen, and trying to capture the stderr output and write it to logging.

args = ['ffmpeg', '-i', path]
if start:
    args += ['-ss', start]
if end:
    args += ['-t', end]
args += [
    '-vcodec', 'copy',
    '-acodec', 'copy',
    '-scodec', 'copy',
    '-f', 'mpegts',
    '-y', '/dev/stdout']
self.child = subprocess.Popen(
    args,
    stdin=open(os.devnull, 'rb'),
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE)

ffmpeg generates a lot of configuration information like the following:

FFmpeg version 0.6.2-4:0.6.2-1ubuntu1,
Copyright (c) 2000-2010 the Libav
developers built on Mar 22 2011
15:55:04 with gcc 4.5.2
configuration:
--extra-version=4:0.6.2-1ubuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static WARNING: library configuration
mismatch libavutil configuration:
--extra-version=4:0.6.2-1ubuntu2 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdirac --enable-libfaad --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libdc1394 --enable-shared --disable-static libavcodec configuration:
--extra-version=4:0.6.2-1ubuntu2 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdirac --enable-libfaad --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libdc1394 --enable-shared --disable-static libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0

Prior to finally outputting the stuff I'd like to log:

Seems stream 0 codec frame rate
differs from container frame rate:
47.95 (66893/1395) -> 23.98 (66893/2790) At least one output file
must be specified

Is there an option to prevent this excessive output? Should I be doing it differently?

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

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

发布评论

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

评论(4

没︽人懂的悲伤 2024-11-07 11:43:37

从 FFmpeg 2.2 开始,可以使用 -hide_banner 选项实现这一点。另请参阅相关的提交

This is now possible as of FFmpeg 2.2 with the -hide_banner option. See also the relevant commit and ticket.

情痴 2024-11-07 11:43:37

AFAIK没有办法,loglevel没有用。查看 ffmpeg.c:

init_opts();
show_banner();

和 cmdutils.c:

void show_banner(void)
{
    fprintf(stderr, "%s version " FFMPEG_VERSION ", Copyright (c) %d-%d the FFmpeg developers\n",
            program_name, program_birth_year, this_year);
    fprintf(stderr, "  built on %s %s with %s %s\n",
            __DATE__, __TIME__, CC_TYPE, CC_VERSION);
    fprintf(stderr, "  configuration: " FFMPEG_CONFIGURATION "\n");
    print_all_libs_info(stderr, INDENT|SHOW_CONFIG);
    print_all_libs_info(stderr, INDENT|SHOW_VERSION);
}

请参阅此处 尝试跳过它但不成功(我不明白 GPL 与此有什么关系)。我建议您提交错误并希望您有足够的说服力。

和其他许多人一样,我编译了 ffmpeg,并注释掉了 show_banner() ,这简直太烦人了。

AFAIK there is no way, loglevel is no use. Look at ffmpeg.c:

init_opts();
show_banner();

and cmdutils.c:

void show_banner(void)
{
    fprintf(stderr, "%s version " FFMPEG_VERSION ", Copyright (c) %d-%d the FFmpeg developers\n",
            program_name, program_birth_year, this_year);
    fprintf(stderr, "  built on %s %s with %s %s\n",
            __DATE__, __TIME__, CC_TYPE, CC_VERSION);
    fprintf(stderr, "  configuration: " FFMPEG_CONFIGURATION "\n");
    print_all_libs_info(stderr, INDENT|SHOW_CONFIG);
    print_all_libs_info(stderr, INDENT|SHOW_VERSION);
}

See here for an unsuccessful attempt of skipping it (I don't get what the GPL has to do with anything of this). I suggest you to file a bug and hope you are convicing enough.

As many others, I have ffmpeg compiled with show_banner() commented out, it's simply tiresome.

孤云独去闲 2024-11-07 11:43:37

查看 ffmpeg 的联机帮助页,尤其是 -loglevel 参数。

Take a look at ffmpeg's manpage, especially the -loglevel parameter.

哭泣的笑容 2024-11-07 11:43:37

FFmpeg != Libav

ffmpeg from FFmpeg with -loglevel 参数按预期工作。

FFmpeg != Libav

ffmpeg from FFmpeg with -loglevel parameter works as expected.

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