wzyy2 / gstreamer-opencv

opencv + gstreamer simple demo
130 stars 43 forks source link

gst_app_src_push_buffer successfully but can no show video #4

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi , I have a problem of running your code demo about appsrc / appsink Here is my main pipleline

filesrc location=/usr/local/1080P.mp4 ! decodebin name=dec ! videoconvert ! appsink name="myappsink"
appsrc name="myappsrc" ! autovideosink

And I can make it work directly by filesrc location=/usr/local/1080P.mp4 ! decodebin name=dec ! videoconvert ! autovideosink But when running the code in

bool GstAppSrcPipeline::SendBUF(GstBuffer* buffer)
{
    boost::mutex::scoped_lock(pushBufferFlagMutex);
    if (!needsData) {
        std::cout << "CHANGED\n";
        return false;
    }

    if (buffer) {
        if (needsData){
            GstFlowReturn ret = gst_app_src_push_buffer((GstAppSrc*)appsrc, buffer); // buffer released automatically
            if(ret != GST_FLOW_OK){
                std::cout << "GstFlowReturn no OK";
            }
        }

    }

    return true;
}

It show me that everytime I have successfully push buffer to the appsrc . But I can no visual the video . Any help would be appreciate ! Thanks .

wzyy2 commented 6 years ago

autovideosink换成具体的sink测试吧

ghost commented 6 years ago

具体的sink依然不行

ghost commented 6 years ago

在autovideosink前加一个videoconvert就可以了。感谢