Encode YUV420 buffer with appsrc
pchaurasia
pchaurasia at gameloreinc.com
Thu Oct 5 09:04:23 UTC 2017
Thanks for helping out BabyOctopus. After following your suggestion - I am
still not able to get the format right. Following is my code, this code is
generating a legal mkv bitstream but content is all junk. It seems there is
some issue in what I am feeding to encoder
GstVideoInfo info;
GstElement *appsrc;
GstElement *pipeline;
GstCaps *caps;
string aaDebugPipeline = "appsrc name=myappsrc !
autovideoconvert ! omxh265enc ! matroskamux ! filesink location=test.mkv ";
pipeline =
gst_parse_launch(aaDebugPipeline.c_str(),NULL);
g_assert (pipeline);
appsrc = gst_bin_get_by_name
(GST_BIN(pipeline), "myappsrc");
g_assert (appsrc);
gst_video_info_set_format(&info, GST_VIDEO_FORMAT_I420, 1920, 1080);
caps = gst_video_info_to_caps(&info);
gst_app_src_set_caps(GST_APP_SRC(appsrc), caps);
m_videoWriter.open(aaDebugPipeline,0, (double)30, cv::Size(1920, 1080),
false);
if (!m_videoWriter.isOpened()) {
REPORT_ERROR("can't create writer\n");
exit(1);
}
// THis is how I am calling m_videoWriter -
cv::Mat imgY = cv::Mat(1080 ,1920, CV_8UC1, framedata.dataY,2048);
cv::Mat imgU = cv::Mat(540 ,960, CV_8UC1, framedata.dataU,1024);
cv::Mat imgV = cv::Mat(540 ,960, CV_8UC1, framedata.dataV,1024);
m_videoWriter.write(imgY);
// I am able to successfully imshow (imgY)
Thanks
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list