I have built the following pipeline:
appsrc->videoconvert->x264enc->h264parse->queue->mp4mux->filesink The goal is to record video from a non-v4l2 camera. I get the following error: `Could not multiplex streams` I have no problem streaming this h264 pipeline (if I replace the queue->mp4mux->filesink section with a rtph264pay and udpsink I receive video fine. [Pipeline image is here](https://imgur.com/D0sbFMx) As for implementing the appsrc, I am using the need-data callback as quite a few examples demonstrate: cb_need_data(GstElement *appsrc, guint unused_size, gpointer data) { GstMapInfo map; GstBuffer *buffer; guint pixel_size; GstFlowReturn ret; // setup the image buffer from the camera pixel_size = (size_t)camera->frame_cols * (size_t)camera->frame_rows; guint frame_bytes = pixel_size * sizeof(uint32_t); uint32_t* color_buffer = (uint32_t*)malloc(frame_bytes); buffer = gst_buffer_new_allocate (NULL, frame_bytes, NULL); //get the image from the camera bool status = false; status = MyCamera_GetImage(camera, color_buffer); if(status){ // map memory, write data to memory and unmap gst_buffer_map(buffer, &map, GST_MAP_WRITE); memcpy(map.data, (guchar*)color_buffer, frame_bytes); gst_buffer_unmap(buffer, &map); // send buffer out of appsrc g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret); gst_buffer_unref (buffer); } free(color_buffer); } I am using gstreamer 1.14.5 on ubuntu 18.04 arm64 (Jetson Nano) Any help or guidance would be appreciated on how I mux this stream into a video file. -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Here's an example of using a muxer, file attached.
test_mux.cpp <http://gstreamer-devel.966125.n4.nabble.com/file/t379531/test_mux.cpp> This is set to use mp4mux, but I actually normally use matroskamux because the file remains playable even if you don't finalize correctly (i.e. if program crashes, you can play what was recorded). This uses a videotestsrc, but I don't think that makes much of a difference, should be easy to integrate. -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
I have no problem using mp4mux with a v4l2src camera and writing to file.
The issue is using *appsrc* with *mp4mux*. I suspect it has something to do with adding timestamps (pts and dts). -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
You're probably right, I messed around a bit for my own education. Attached
is sample code, tested on the Jetson Nano. You can probably run it on anything; just change out the hardware-specific elements with software-based. appsrc_mux.cpp <http://gstreamer-devel.966125.n4.nabble.com/file/t379531/appsrc_mux.cpp> -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Thanks, your code is helpful. I'll see if this solves my issue.
-- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
It seems that adding this line in appsrc need-data callback:
`buffer->pts = GST_CLOCK_TIME_NONE;` seems to fix the problem with mp4mux. I guess if you leave buffer->pts unset mp4mux is unhappy. -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |