how to set time or PTS DTS for "appsrc ! videorate ! x264enc !... "

diyin qgq1991 at 163.com
Thu May 16 13:19:34 UTC 2019


I want to combine h264 in gst-app with "appsrc name=mysrc ! videorate !
x264enc  ! mp4mux ! filesink location=out.mp4".
If "videorate" in the pipeline ,the output of filesink is 0kb;
If I remove the "videorate" element ,the size of output file is normal。
So the problem is between appsrc and videorate.
How to set “videorate” correctly,is it related to time or PTS or DTS?

                GstBuffer *buffer_src;
                GstMapInfo info_src;
                static GstClockTime timestamp = 0;
                int size = info.size;
                buffer_src = gst_buffer_new_allocate(NULL, size, NULL);
                gst_buffer_map(buffer_src, &info_src, GST_MAP_WRITE);
                memmove(info_src.data, info.data, size);
                GST_BUFFER_PTS (buffer_src) = timestamp;
                GST_BUFFER_DURATION (buffer_src) = gst_util_uint64_scale_int
(1, GST_SECOND, 2);
                timestamp += GST_BUFFER_DURATION (buffer_src);
                gst_buffer_unmap(buffer_src, &info_src);
                gst_app_src_push_buffer(GST_APP_SRC(appsrc_), buffer_src);



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list