Video and Audio Recording and Muxing Issue in C++ GStreamer Pipeline
Dear Team,
I have successfully implemented the GStreamer pipeline provided below in raw command-line form. The pipeline captures both audio and video correctly:
Pipeline
gst-launch-1.0 -e v4l2src device="/dev/video0" ! videoconvert ! queue ! x264enc tune=zerolatency ! h264parse config-interval=-1 ! mux. autoaudiosrc ! queue ! audioconvert ! audioresample ! volume volume=0.5 mute=false ! voaacenc ! aacparse ! qtmux name=mux ! filesink location=test-autoaudiosrc.mp4 sync=false
However, when I converted this pipeline into C++ code, I encountered an issue where the audio is not recorded or muxed correctly. I have attempted to debug the problem using GST_DEBUG=2
, and I've attached the error log below.
CODE FILE = my_gst_app.cpp
Running Commend = g++ -o my_gst_app my_gst_app.cpp pkg-config --cflags --libs gstreamer-1.0
and GST_DEBUG=2 ./my_gst_app
Error Log:
GST_DEBUG=2 ./my_gst_app
Audio Elements could linked. Video Elements could linked. 0:00:00.461866220 30618 0x7f464c0040f0 WARN audiosrc gstaudiosrc.c:197:audioringbuffer_thread_func: failed to set thread priority 0:00:06.889138959 30618 0x7f4658004c50 ERROR GST_PADS gstpad.c:3352:gst_pad_query_latency_default:mux:src minimum latency bigger than maximum latency 0:00:06.890978046 30618 0x55bacd3db630 WARN audiobasesrc gstaudiobasesrc.c:844:gst_audio_base_src_create: create DISCONT of 236817 samples at sample 282681 0:00:06.891032791 30618 0x55bacd3db630 WARN audiobasesrc gstaudiobasesrc.c:849:gst_audio_base_src_create: warning: Can't record audio fast enough 0:00:06.891049693 30618 0x55bacd3db630 WARN audiobasesrc gstaudiobasesrc.c:849:gst_audio_base_src_create: warning: Dropped 236817 samples. This is most likely because downstream can't keep up and is consuming samples too slowly. 0:00:07.281026296 30618 0x55bacd3db630 WARN audiobasesrc gstaudiobasesrc.c:844:gst_audio_base_src_create: create DISCONT of 16317 samples at sample 299880 0:00:07.281063662 30618 0x55bacd3db630 WARN audiobasesrc gstaudiobasesrc.c:849:gst_audio_base_src_create: warning: Can't record audio fast enough 0:00:07.281072629 30618 0x55bacd3db630 WARN audiobasesrc gstaudiobasesrc.c:849:gst_audio_base_src_create: warning: Dropped 16317 samples. This is most likely because downstream can't keep up and is consuming samples too slowly.
I would like to request your assistance in fixing this bug and providing a proper C++ implementation of the pipeline that ensures both audio and video are recorded and muxed correctly. Your guidance and expertise would be greatly appreciated.
Thank you for your help.
Sincerely,
Sulthan Amanau