ffmpeg.exe 笔记
2019獨角獸企業(yè)重金招聘Python工程師標準>>>
open_input_file:
avformat_open_input 打開了輸入文件
av_dict_get 獲取信息
setup_find_stream_info_opts
avformat_find_stream_info
codec = avcodec_find_decoder
open_output_file
avformat_alloc_output_context2(&oc, NULL, o->format, filename)
new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index)
avcodec_get_context_defaults3(st->codec, ost->enc);
init_input_stream:
有個if (ist->decoding_needed)判斷,需要解碼就 avcodec_open2;但是咱這里不需要,它只簡單的初始化了以下幾個:
ist->next_pts = AV_NOPTS_VALUE;
? ? ist->next_dts = AV_NOPTS_VALUE;
? ? ist->is_start = 1;
關(guān)于output_stream的初始化:
? ? /* open each encoder */
? ? for (i = 0; i < nb_output_streams; i++) {
? ? ? ? ost = output_streams[i];
? ? ? ? if (ost->encoding_needed) {
? .... ?咱這里并不需要編碼。
? } else {
? ? ?av_opt_set_dict(ost->st->codec, &ost->opts);
? }
?
在output_packet函數(shù)里判斷是否需要編碼:
if (ist->decoding_needed) { 如果需要編碼:decode_audio ? ?(ist, &avpkt, &got_output); decode_video ? ?(ist, &avpkt, &got_output);
否則do_streamcopy(最終調(diào)用av_interleaved_write_frame)
在transcode_init 函數(shù)里從 input_xxx 拷貝到 ouput_xxx里的信息:
ost->st->disposition
codec->bits_per_raw_sample
codec->chroma_sample_location
codec->codec_id
codec->codec_type
有一個if判斷的拷貝;
codec->bit_rate
codec->rc_max_rate
codec->rc_buffer_size
codec->field_order
codec->extradata ;這里分配內(nèi)存
codec->extradata_size
codec->bits_per_coded_sample
codec->time_base
有個switch分支內(nèi)拷貝:
?
轉(zhuǎn)載于:https://my.oschina.net/mingyuejingque/blog/494068
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的ffmpeg.exe 笔记的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《管理转型》——读书随笔
- 下一篇: 论基于candence的组装清单做法