<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I am developing a C++ video inspection program that creates
MP4/H264/MP3 files and needs to play them back with the video
stream processed by various gstreamer elements and audio
separately.</p>
<p>In general this has been working fine when just video was being
recorded/played back, but I am just adding audio to the mix. Some
MP4 files will contain only a video stream and some will contain
both video and audio streams.</p>
<p>I need some way to handle the playback of these MP4 files that
may or may not have MP3 audio streams.<br>
</p>
<p>As a simple idea if I use something like (The real C++ code
constructs the gstreamer piple line and tees the video stream to
various gstreamer sub pipelines):<br>
</p>
<pre>gst-launch-1.0 -v filesrc location=temp.mp4 ! qtdemux name=demux</pre>
<pre> demux.video_0 ! queue ! h264parse ! openh264dec ! glimagesink</pre>
<pre> demux.audio_0 ! queue ! decodebin ! audioconvert ! pulsesink</pre>
<p>This plays back the video and audio streams fine (not sure how
well synchronised?) from an MP4 with video and audio streams, but
hangs if the MP4 only has a video stream.</p>
<p>So I think I need to:</p>
<p>1. Maybe there is some gstreamer element or attribute that can
ignore the audio stream if not present somehow ?</p>
<p>2. Check if the MP4 file has an audio stream before creating the
gstreamer pipeline in C++.</p>
<p>3. Create the basic C++ pipleline in C++ and interrogate pads or
something somehow and add the "demux.audio_0 ! queue ! decodebin !
audioconvert ! pulsesink" sub pipeline if it is seen an audio
stream is present.<br>
</p>
Any ideas on the simplest/most CPU efficient way of doing this with
gstreamer ?<br>
<p><br>
</p>
</body>
</html>