ffmpeg_av_dump_format

av_dump_format 在 avformat.h 中声明,在libavformat/dump.c中实现,主要用来打印媒体信息。

dump 是转储,转存的意思。可以理解为将 AVFormatContext 中的媒体信息转存到输出。

官方声明如下:

/**
 * Print detailed information about the input or output format, such as
 * duration, bitrate, streams, container, programs, metadata, side data,
 * codec and time base.
 *
 * @param ic        the context to analyze
 * @param index     index of the stream to dump information about
 * @param url       the URL to print, such as source or destination file
 * @param is_output Select whether the specified context is an input(0) or output(1)
 */
void av_dump_format(AVFormatContext *ic,
                    int index,
                    const char *url,
                    int is_output);

参数 index 是指当前输入(url)的索引号,在源码里只有 av_log 直接调用。
参数 url 是指当前输入的 url 具体内容。在源码里只有 av_log 直接调用。

这两个参数只是给人看的。也就是你给他什么信息,它就打印成什么。

参数 is_output 是指 AVFormatContext 的类型是输入还是输出,决定了打印哪些信息。只有是输入才会打印时长、比特率等信息。

如果AVFormatContext实际是输入,却写成输出,会挂掉,这是因为会打印输出信息对应的 AVOutputFormat 为空。

随便指定 index 和 url 打印信息如下,由此可见index和url的作用。

av_dump_format(pFmtCtx,100,“DUMMY_URL”,0);
打印结果如下:

Input #100, mov,mp4,m4a,3gp,3g2,mj2, from 'DUMMY_URL':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isom
    creation_time   : 2011-11-10T02:12:11.000000Z
  Duration: 00:15:08.69, bitrate: N/A
    Stream #100:0(und): Video: h264 (avc1 / 0x31637661), none, 1024x432, 872 kb/s, 24 fps, 24 tbr, 24k tbn (default)
    Metadata:
      creation_time   : 2011-11-09T02:33:10.000000Z
      handler_name    : Imported with GPAC 0.4.6-DEV (internal rev. 5)
    Stream #100:1(chi): Audio: aac (mp4a / 0x6134706D), 44100 Hz, 2 channels, 33 kb/s (default)
    Metadata:
      creation_time   : 2011-11-09T02:33:54.000000Z
      handler_name    : GPAC ISO Audio Handler
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值