register all media file container muxers in ffmpeg
来源:互联网 发布:剑网3刘亦菲捏脸数据 编辑:程序博客网 时间:2024/06/06 01:25
register all media file container muxers in ffmpeg
1. muxers such mov and 3gp
libavformat/movenc.c:
#if CONFIG_MOV_MUXERMOV_CLASS(mov)AVOutputFormat ff_mov_muxer = { .name = "mov", .long_name = NULL_IF_CONFIG_SMALL("QuickTime / MOV"), .extensions = "mov", .priv_data_size = sizeof(MOVMuxContext), .audio_codec = AV_CODEC_ID_AAC, .video_codec = CONFIG_LIBX264_ENCODER ? AV_CODEC_ID_H264 : AV_CODEC_ID_MPEG4, .write_header = mov_write_header, .write_packet = mov_write_packet, .write_trailer = mov_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH | AVFMT_TS_NEGATIVE, .codec_tag = (const AVCodecTag* const []){ ff_codec_movvideo_tags, ff_codec_movaudio_tags, 0 }, .priv_class = &mov_muxer_class,};#endif#if CONFIG_TGP_MUXERMOV_CLASS(tgp)AVOutputFormat ff_tgp_muxer = { .name = "3gp", .long_name = NULL_IF_CONFIG_SMALL("3GP (3GPP file format)"), .extensions = "3gp", .priv_data_size = sizeof(MOVMuxContext), .audio_codec = AV_CODEC_ID_AMR_NB, .video_codec = AV_CODEC_ID_H263, .write_header = mov_write_header, .write_packet = mov_write_packet, .write_trailer = mov_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH | AVFMT_TS_NEGATIVE, .codec_tag = (const AVCodecTag* const []){ codec_3gp_tags, 0 }, .priv_class = &tgp_muxer_class,};#endif
2. so how to register these muxers such as mov and 3gp?
in libavformat/allformats.c:
#define REGISTER_MUXER(X, x) \ { \ extern AVOutputFormat ff_##x##_muxer; \ if (CONFIG_##X##_MUXER) \ av_register_output_format(&ff_##x##_muxer); \ }#define REGISTER_DEMUXER(X, x) \ { \ extern AVInputFormat ff_##x##_demuxer; \ if (CONFIG_##X##_DEMUXER) \ av_register_input_format(&ff_##x##_demuxer); \ }#define REGISTER_MUXDEMUX(X, x) REGISTER_MUXER(X, x); REGISTER_DEMUXER(X, x)
also in libavformat/allformats.c
void av_register_all(void){ static int initialized; if (initialized) return; initialized = 1; avcodec_register_all(); /* (de)muxers */ REGISTER_MUXER (A64, a64); REGISTER_DEMUXER (AAC, aac); REGISTER_MUXDEMUX(AC3, ac3);...... REGISTER_MUXDEMUX(MOV, mov); REGISTER_MUXER (MP2, mp2); REGISTER_MUXDEMUX(MP3, mp3); REGISTER_MUXER (MP4, mp4);
all the registered muxers are save in the below single linked list:
static AVOutputFormat *first_oformat = NULL;
linked by the below field of AVOutputFormat:
struct AVOutputFormat *next;
get the target AVOutputFormat(a muxer) according to muxer name, for example mov:
m_pFormatCtx->oformat = av_guess_format("mov", NULL, NULL);
AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type) /* Find the proper file type. */ fmt_found = NULL; score_max = 0; while ((fmt = av_oformat_next(fmt))) { score = 0; if (fmt->name && short_name && match_format(short_name, fmt->name)) score += 100; if (fmt->mime_type && mime_type && !strcmp(fmt->mime_type, mime_type)) score += 10; if (filename && fmt->extensions && av_match_ext(filename, fmt->extensions)) { score += 5; } if (score > score_max) { score_max = score; fmt_found = fmt; } } return fmt_found;
in the above example, only short_name is not null. both filename and mime_type are null
0 0
- register all media file container muxers in ffmpeg
- Unknown media type in type 'all/all'
- register controls in your web.config file
- Unknown media type in type 'all/all' 问题解决方案
- Unknown media type in type ‘all/all’ 的解决办法
- Consul & Registrator & Rails Service all together in separate Docker container
- Windows Media Player 11.0.5358 & Useful Codecs - All-In-One
- All About: File I/O in C++
- Delphi rename all file in a directory
- Recursion all file direction in a direction
- All about control file in Oracle Database
- Don't forget to register your MEF container itself in your Boostrapper:
- cann't create instance in all devModuleCode.Please check register info in table pub_eventlistener
- ControlTemplate in WPF —— Shared in all file
- 关于APKsmail中加入代码报错All register args must fit in 4 bits
- FFMPEG All in One Video & Audio Converter Interface
- @media all的含义
- <media="all"
- Android绘图系列(一)——自定义View基础
- Apache安装冲突
- uoj 279: 数据分块鸡 动态规划+可持久化线段树
- 洛谷 P1134 阶乘问题
- 编写一个程序,获取10个1-20的随机数,要求随机数不能重复
- register all media file container muxers in ffmpeg
- 【c++】类模板
- web架构网站演变过程
- JavaScript之函数
- C#关于类(2)
- 欧拉函数的求法
- java异常匹配原则
- JS继承
- sping配置声明式事务