我运行avprobe是为了获取关于JSON中一个视频的流信息.
avprobe -loglevel quiet -show_format -show_streams file.m4v -of json
这基本上与ffprobe或ffmpeg -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
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
{
...发布于 2018-04-19 03:42:07
您看到的是STDOUT和STDERR的输出。如果您想过滤掉Unsupported codec with id 94213 for input stream 2,例如,您可以通过将它重定向到/dev/null来筛选出STDERR输出,就像bash中的这样:
avprobe -loglevel quiet -show_format -show_streams file.m4v -of json 2>/dev/null
https://stackoverflow.com/questions/15914874
复制相似问题