我是靠谱客的博主 积极唇彩,这篇文章主要介绍Linux下开发ffmpeg(3),Ffmpeg版本的HelloWorld,现在分享给大家,希望可以做个参考。


目录


重要函数

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/** * @addtogroup lavu_log * * @{ * * @defgroup lavu_log_constants Logging Constants * * @{ */ /** * Print no output. */ #define AV_LOG_QUIET -8 /** * Something went really wrong and we will crash now. */ #define AV_LOG_PANIC 0 /** * Something went wrong and recovery is not possible. * For example, no header was found for a format which depends * on headers or an illegal combination of parameters is used. */ #define AV_LOG_FATAL 8 /** * Something went wrong and cannot losslessly be recovered. * However, not all future data is affected. */ #define AV_LOG_ERROR 16 /** * Something somehow does not look correct. This may or may not * lead to problems. An example would be the use of '-vstrict -2'. */ #define AV_LOG_WARNING 24 /** * Standard information. */ #define AV_LOG_INFO 32 /** * Detailed information. */ #define AV_LOG_VERBOSE 40 /** * Stuff which is only useful for libav* developers. */ #define AV_LOG_DEBUG 48
复制代码
1
2
3
4
5
6
7
8
9
/** * Set the log level * * @see lavu_log_constants * * @param level Logging level */ void av_log_set_level(int level);
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/** * Send the specified message to the log if the level is less than or equal * to the current av_log_level. By default, all logging messages are sent to * stderr. This behavior can be altered by setting a different logging callback * function. * @see av_log_set_callback * * @param avcl A pointer to an arbitrary struct of which the first field is a * pointer to an AVClass struct or NULL if general log. * @param level The importance level of the message expressed using a @ref * lavu_log_constants "Logging Constant". * @param fmt The format string (printf-compatible) that specifies how * subsequent arguments are converted to output. */ void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);

在(1)(2)的基础上写一个ffmpeg版本的HelloWorld

mylog.c

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
#include <libavutil/log.h> #include <stdio.h> int main(int argc,char* argv[]){ //设置debug级别以上的日志都被打印 av_log_set_level(AV_LOG_DEBUG); av_log(NULL,AV_LOG_DEBUG,"Hello Worldn"); return 0; }

编译mylog

复制代码
1
2
gcc -g -o mylog mylog.c -I /usr/local/ffmpeg/include/ -L /usr/local/ffmpeg/lib/ -lavutil

运行

复制代码
1
2
3
4
root@zhangyu-virtual-machine:/home/zhangyu/test# gcc -g -o mylog mylog.c -I /usr/local/ffmpeg/include/ -L /usr/local/ffmpeg/lib/ -lavutil root@zhangyu-virtual-machine:/home/zhangyu/test# ./mylog Hello World

最后

以上就是积极唇彩最近收集整理的关于Linux下开发ffmpeg(3),Ffmpeg版本的HelloWorld的全部内容,更多相关Linux下开发ffmpeg(3),Ffmpeg版本内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(136)

评论列表共有 0 条评论

立即
投稿
返回
顶部