Open zhzhjr opened 8 months ago
方便提供一下复现步骤吗
dump_graph:1构造graph->创建解码器->创建编码器->任意一个node AddCallback->run 代码如下: nlohmann::json graph_para = {{"dump_graph", 1}}; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para));
nlohmann::json decode_para = {
{"input_path", "../../files/big_bunny_10s_30fps.mp4"}};
auto video = graph.Decode(bmf_sdk::JsonParam(decode_para));
nlohmann::json encode_para = {{"output_path", output_file},
{"video_params",
{{"codec", "h264"},
{"width", 320},
{"height", 240},
{"crf", 23},
{"preset", "veryfast"}}},
{"audio_params",
{{"codec", "aac"},
{"bit_rate", 128000},
{"sample_rate", 44100},
{"channels", 2}}}};
auto node = graph.Encode(video["video"], video["audio"],
bmf_sdk::JsonParam(encode_para));
node.AddCallback(0, bmf::BMFCallback([](bmf_sdk::CBytes data)-> bmf_sdk::CBytes {
std::string strInfo;
strInfo.assign(reinterpret_cast<const char*>(data.buffer), data.size);
return data; }));
graph.Run();
dump_graph:1构造graph->创建解码器->创建编码器->任意一个node AddCallback->run 代码如下: nlohmann::json graph_para = {{"dump_graph", 1}}; auto graph = bmf::builder::Graph(bmf::builder::NormalMode, bmf_sdk::JsonParam(graph_para));
nlohmann::json decode_para = { {"input_path", "../../files/big_bunny_10s_30fps.mp4"}}; auto video = graph.Decode(bmf_sdk::JsonParam(decode_para)); nlohmann::json encode_para = {{"output_path", output_file}, {"video_params", {{"codec", "h264"}, {"width", 320}, {"height", 240}, {"crf", 23}, {"preset", "veryfast"}}}, {"audio_params", {{"codec", "aac"}, {"bit_rate", 128000}, {"sample_rate", 44100}, {"channels", 2}}}}; auto node = graph.Encode(video["video"], video["audio"], bmf_sdk::JsonParam(encode_para)); node.AddCallback(0, bmf::BMFCallback([](bmf_sdk::CBytes data)-> bmf_sdk::CBytes { std::string strInfo; strInfo.assign(reinterpret_cast<const char*>(data.buffer), data.size); return data; })); graph.Run();
看起来应是个bug或不完善的点,我们继续验证fix一下
cannot use operator[] with a numeric argument with 1、RealNode::NodeMetaInfo::Dump()中使用数值类型作为json的key抛出异常 另外还有个问题: 2、RealNode::NodeMetaInfo::Dump()的时候和NodeMetaInfo::to_json()里面callback_binding字段名不一致格式也不一致