0
我想實時流編碼爲webm
,但ffmpeg
卡在現場的鎖5秒鐘後指出C++的ffmpeg「啓動新的羣集」錯誤
[webm @ 0x1d81940] Starting new cluster at offset 0 bytes, pts 5040dts 5040
我試圖增加相關AVFormatContext
PARAMS
av_opt_set_int(oc->priv_data, "chunk_duration", INT_MAX, 0);
av_opt_set_int(oc->priv_data, "cluster_time_limit", INT_MAX, 0);
av_opt_set_int(oc->priv_data, "cluster_size_limit", INT_MAX, 0);
其避免了誤差爲約30秒,但隨後又ffmpeg
掛起
[webm @ 0xbc9940] Starting new cluster due to timestamp
[webm @ 0xbc9940] Starting new cluster at offset 0 bytes, pts 32800dts 32800
該錯誤可能與官方的例子doc/examples/muxing.c
只是這樣
oc = avformat_alloc_context();
oc->oformat = av_guess_format("webm", NULL, NULL);
oc->oformat->flags |= AVFMT_NOFILE;
寫入緩衝區,而不是文件和實際寫作轉載
uint8_t *output_buf;
avio_open_dyn_buf(&oc->pb);
avformat_write_header(oc, &opt);
/* or */
av_interleaved_write_frame(fmt_ctx, pkt);
avio_close_dyn_buf(oc->pb, &output_buf);
av_free(output_buf);
我怎麼編碼WEBM成緩衝? (爲什麼它的文件?)