日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無先后,達者為師

網(wǎng)站首頁 編程語言 正文

ffmpeg開發(fā)打印音視頻meta信息

作者:reg183 更新時間: 2022-03-14 編程語言

新建ffmpeg_meta.c

#include<stdio.h>
#include<libavutil/avutil.h>
#include<libavformat/avformat.h>
int main(int argc,char* argv[]){
        int ret;
        av_register_all();
        AVFormatContext *fmt_ctx=NULL;
        av_log_set_level(AV_LOG_INFO);
        ret=avformat_open_input(&fmt_ctx,"./test.mp4",NULL,NULL);

        if(ret<0){
                av_log(NULL,AV_LOG_ERROR,"can not open file:%s\n",av_err2str(ret));
                goto __fail;
        }
        av_dump_format(fmt_ctx,0,"./test.mp4",0);
__fail:
        avformat_close_input(&fmt_ctx);
        return 0;
}

拷貝一個test.mp4文件到當(dāng)前目錄
編譯

[root@localhost c]# gcc -g -o ffmpeg_meta ffmpeg_meta.c `pkg-config --libs --cflags libavutil libavformat`

執(zhí)行完成沒有報錯證明編譯成功
查看是否生成了可執(zhí)行文件ffmpeg_meta

執(zhí)行下面的命令,執(zhí)行結(jié)果如下,表明程序執(zhí)行成功
在這里插入圖片描述
這里顯示了文件編碼協(xié)議,分辨率,碼率幀率,音頻的采樣率等信息

原文鏈接:https://blog.csdn.net/chendongpu/article/details/123248920

欄目分類
最近更新