Video and Audio Recording and Muxing Issue in C++ GStreamer Pipeline

Stephane Cerveau scerveau at gmail.com
Thu Sep 14 08:27:22 UTC 2023


Dear Sulthan,

After reviewing your code, I found a couple of issues to avoid the loss 
of data in your muxing. Indeed your code was not exactly copying your 
gstreamer pipeline. Should be better now.

In the future, it would help to have a cleaner snippet of code and 
conditions for your test such as the machine used to get better and 
faster support.

Best regards.

Stéphane


On 13/9/23 17:25, Sulthan Amanu via gstreamer-devel wrote:
> 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](/uploads/0a048213b2125af003de6a6ac29cd290/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:<audio-source-actual-src-puls> 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:<audio-source-actual-src-puls> create DISCONT of 236817 samples at sample 282681
> 0:00:06.891032791 30618 0x55bacd3db630 WARN            audiobasesrc 
> gstaudiobasesrc.c:849:gst_audio_base_src_create:<audio-source-actual-src-puls> warning: Can't record audio fast enough
> 0:00:06.891049693 30618 0x55bacd3db630 WARN            audiobasesrc 
> gstaudiobasesrc.c:849:gst_audio_base_src_create:<audio-source-actual-src-puls> 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:<audio-source-actual-src-puls> create DISCONT of 16317 samples at sample 299880
> 0:00:07.281063662 30618 0x55bacd3db630 WARN            audiobasesrc 
> gstaudiobasesrc.c:849:gst_audio_base_src_create:<audio-source-actual-src-puls> warning: Can't record audio fast enough
> 0:00:07.281072629 30618 0x55bacd3db630 WARN            audiobasesrc 
> gstaudiobasesrc.c:849:gst_audio_base_src_create:<audio-source-actual-src-puls> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: my_gst_app.cpp
Type: text/x-c++src
Size: 4755 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230914/c8d02e9b/attachment.cpp>


More information about the gstreamer-devel mailing list