ffprobe或avprobe在JSON输出中返回纯文本错误

时间:2013-04-10 00:22:42

标签: ffmpeg ffprobe avconv avprobe

我正在运行avprobe以获取有关JSON中的视频的信息流...

avprobe -loglevel quiet -show_format -show_streams file.m4v -of json

这基本上与ffprobeffmpeg -i完全相同(我得到同样的错误。)

ffprobe -loglevel quiet -show_format -show_streams file.m4v -print_format json

该命令大部分时间都有效...但是,在视频中,我将有一个视频,其中有一个奇怪的流,“不支持”,我会得到这样的东西(缩写。)

Unsupported codec with id 94213 for input stream 2
{  "format" : {
    "filename" : "file.m4v",
    "nb_streams" : 3,
    "format_name" : "mov,mp4,m4a,3gp,3g2,mj2" ...

当我运行命令时,我回到JSON + plain text中的错误,这会导致结果无效JSON,我必须稍后“清理”。

从输出-loglevel quiet抑制错误,但错误仍然显示。

如何告诉avprobe/ffprobe不显示此错误,从而找回正确的JSON对象?


更长的输出示例

ffprobe,来自源代码,MacOS

ffprobe version 0.9.1-subsplash, Copyright (c) 2007-2012 the FFmpeg developers
  built on Feb  5 2012 01:35:36 with gcc 4.2.1 (Apple Inc. build 5664)
  configuration: --prefix=/Volumes/Ramdisk/sw --as=yasm --extra-version=subsplash --disable-shared --enable-static --disable-ffplay --disable-ffserver --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libfaac --enable-libvorbis --enable-libtheora --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --arch=x86_64 --enable-runtime-cpudetect --enable-nonfree
  libavutil    51. 32. 0 / 51. 32. 0
  libavcodec   53. 42. 4 / 53. 42. 4
  libavformat  53. 24. 2 / 53. 24. 2
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 53. 0 /  2. 53. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.m4v':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2012-01-01 06:38:43
    encoder         : HandBrake 0.9.5 2011010300
  Duration: 00:30:47.53, start: 0.000000, bitrate: 1558 kb/s
    Chapter #0.0: start -0.066733, end 17.784433
    Metadata:
      title           : Chapter  1

...

    Stream #0:2(und): Subtitle: mov_text (text / 0x74786574)
    Metadata:
      creation_time   : 2012-01-01 06:38:43
      handler_name    : 
Unsupported codec with id 94213 for input stream 2
{

...

avprobe,来源,Ubuntu Linux

avprobe version 10_alpha1-6:10~~git20130307.4be368b-1~quantal1, Copyright (c) 2007-2013 the Libav developers
  built on Mar  7 2013 22:12:44 with gcc 4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.m4v':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2012-01-01 06:38:43
    encoder         : HandBrake 0.9.5 2011010300
  Duration: 00:30:47.53, start: 0.000000, bitrate: 1558 kb/s
    Chapter #0.0: start -0.066733, end 17.784433
    Metadata:
      title           : Chapter  1

...

    Stream #0.2(und): Subtitle: text / 0x74786574
    Metadata:
      creation_time   : 2012-01-01 06:38:43
Unsupported codec with id 94213 for input stream 2
{

...

1 个答案:

答案 0 :(得分:0)

你看到的是STDOUT和STDERR的输出。如果你想过滤掉Unsupported codec with id 94213 for input stream 2,你可以通过在bash中将它重定向到/ dev / null来过滤掉STDERR输出:

avprobe -loglevel quiet -show_format -show_streams file.m4v -of json 2>/dev/null