【问题标题】:Perl FFMpeg print outputPerl FFMpeg 打印输出
【发布时间】:2012-01-31 13:29:19
【问题描述】:

你好,我使用下面的 perl 命令用 ffmpeg 转换文件:

system ("/usr/local/bin/ffmpeg -i $inputFile $outputFile");

我想知道是否可以打印 ffmpeg 输出?

干杯

更新

解决方案是使用反引号

my $output = qx{/usr/local/bin/ffmpeg -i $inputFile $outputFile 2>&1};
print $output

这会打印出以下内容:

FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers built on Jan 31 2012 12:30:35 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6) configuration: --enable-libmp3lame --disable-mmx --enable-shared libavutil 50.36. 0 / 50.36. 0 libavcore 0.16. 1 / 0.16. 1 libavcodec 52.108. 0 / 52.108. 0 libavformat 52.93. 0 / 52.93. 0 libavdevice 52. 2. 3 / 52. 2. 3 libavfilter 1.74. 0 / 1.74. 0 libswscale 0.12. 0 / 0.12. 0 [wav @ 0x8af94c0] max_analyze_duration reached Input #0, wav, from 'a.wav': Duration: 00:00:05.84, bitrate: 1537 kb/s Stream #0.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s Output #0, mp3, to 'a.mp3': Metadata: TSSE : Lavf52.93.0 Stream #0.0: Audio: libmp3lame, 48000 Hz, 2 channels, s16, 64 kb/s Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop encoding size= 42kB time=5.42 bitrate= 64.0kbits/s size= 46kB time=5.88 bitrate= 64.0kbits/s video:0kB audio:46kB global headers:0kB muxing overhead 0.070153%

【问题讨论】:

  • 不要编辑您的问题,而是提供您找到的解决方案,将其作为答案发布(是的,完全可以回答您自己的问题,甚至可以选择您的最佳答案)

标签: perl ffmpeg system


【解决方案1】:

提示:FFmpeg 将其输出抛出到 StandrdError 而不是 StandrdOutput

【讨论】:

    猜你喜欢
    • 2014-07-22
    • 1970-01-01
    • 2012-02-05
    • 2023-03-22
    • 1970-01-01
    • 1970-01-01
    • 2011-10-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多