|
发表于 2024-3-23 14:06:26
只看该作者
6#
本帖最后由 nboxcn 于 2024-3-23 14:39 编辑
另外,如果用FileWriter写视频软件,内容来自rga层那么就会丢失fps,写出来的视频文件就不是按原来的fps播放,以极快的速度播放,加file_writer->setSynchronize(make_shared<Synchronize>(SynchronizeType(SYNCHRONIZETYPE_VIDEO))); 也不奏效,应该如何处理?谢谢!
编码大概如下:
- input_para = dec->getOutputImagePara();
- output_para = input_para;
- output_para.width = input_para.width;
- output_para.height = input_para.height;
- output_para.hstride = output_para.width;
- output_para.vstride = output_para.height;
- output_para.v4l2Fmt = V4L2_PIX_FMT_NV12;
- shared_ptr<ModuleRga> rga2 = make_shared<ModuleRga>(output_para, RGA_ROTATE_NONE);
- // The producer of the rga module is the same as the inference module producer.
- rga2->setProductor(rga);
- ret = rga2->init();
- if (ret < 0) {
- ff_error("rga init failed\n");
- }
- // // 2.3 encode
- input_para = rga2->getOutputImagePara();
- shared_ptr<ModuleMppEnc> enc = make_shared<ModuleMppEnc>(ENCODE_TYPE_H265, input_para, 30, 30);
- enc->setProductor(rga2);
- enc->setBufferCount(8);
- enc->setDuration(0); // Use the input source timestamp
- ret = enc->init();
- if (ret < 0) {
- ff_error("Enc init failed\n");
- }
- // write file
- file_writer = make_shared<ModuleFileWriter>("/srv/src/storage/out.mp4");
- file_writer->setProductor(enc);
- ret = file_writer->init();
- if (ret < 0) {
- ff_error("ModuleFileWriter init failed\n");
- }
复制代码
出错信息如下:
- WARN: 12ModuleMppEnc: waitAllForConsume: wait for consumer ModuleFileWriter [0] timeout
- WARN: 12ModuleMppEnc: waitAllForConsume: ModuleFileWriter lost a frame
- WARN: 12ModuleMppEnc: waitAllForConsume: input queue empty: 0
- ERROR: 16ModuleRtspServer: work: wait for productor ModuleMppEnc timeout
- WARN: 9ModuleRga: waitAllForConsume: wait for consumer ModuleMppEnc [0] timeout
- WARN: 9ModuleRga: waitAllForConsume: ModuleMppEnc lost a frame
- WARN: 9ModuleRga: waitAllForConsume: input queue empty: 0
- WARN: 16ModuleFileReader: waitAllForConsume: wait for consumer ModuleMppDec [0] timeout
- WARN: 16ModuleFileReader: waitAllForConsume: ModuleMppDec lost a frame
- WARN: 16ModuleFileReader: waitAllForConsume: input queue empty: 0
复制代码
|
|