1234567891011121314151617181920212223242526272829 |
- #include "common/data.hpp"
- #include "common/meta.hpp"
- #include "nodes/record/RecordNode.hpp"
- namespace GNode
- {
- void RecordNode::handle_data(std::shared_ptr<meta::MetaData>& meta_data)
- {
- cv::Mat image = meta_data->draw_image;
- int width = image.cols;
- int height = image.rows;
- if (!writer_.isOpened())
- {
- writer_.open(gst_pipeline_, cv::CAP_GSTREAMER, 0, fps_, cv::Size(width, height), true);
- if (!writer_.isOpened())
- {
- PLOGE.printf("RecordNode : [%s] cannot open video writer", name_.c_str());
- stop();
- }
- }
- writer_ << image;
- }
- } // namespace GNode
- // appsrc ! videoconvert ! x264enc tune=zerolatency bitrate=500 speed-preset=ultrafast ! h264parse ! flvmux streamable=true ! queue ! rtmpsink location='rtmp://172.16.20.168:1935/live' sync=false async=false
|