Audio problems using appsr and srtsink
Carles Albert Bolaños Garcia
carlesalbertbg at gmail.com
Fri Oct 28 08:57:23 UTC 2022
Hello
I'm a software programer from Barcelona and my company develops
professional video servers for broadcasting. We use propietary SDKs for
managing video and audio, like MatroxDSX, Medialooks, BlackMagicSDK, ...
For a recent project we are studying the possibility to use GStreamer
form sending an SRT stream, but the resulting stream in some receivers,
no all, like VLC, drops audio samples and I don't know the reason.
If I use this pipe, the resulting stream is Ok. Players like VLC are
able to connect them using srt://127.0.0.1:5011?mode=caller and the
works fine, with no errors and valid video and audio data
gst-launch-1.0 uridecodebin uri="file:///C:/temp/AT_0007 Corzo
emboscado.mxf" name=decode ! videoconvert ! x264enc ! queue ! mpegtsmux
name=mux ! queue ! srtsink uri=srt://127.0.0.1:5011?mode=listener
decode. ! audioconvert ! avenc_aac ! queue ! mux.
But if I use appsrc the problem appears in some players, like VLC, but
there are no errors in the log window
appsrc is-live=true do-timestamp=true ! videoconvert ! x264enc ! queue !
mpegtsmux name=mux ! queue ! srtsink
uri=srt://127.0.0.1:5011?mode=listener appsrc is-live=true
do-timestamp=true ! audioconvert ! avenc_aac ! queue ! mux.
I have done multiple tests with no success, removing queues, using UDP
instead of SRT, saving to disk the trasport stream and playing back
using VLC...
The "need-data" callbacks for audio and video are very easy The always
push a buffer of one frame for video and the corresponding audio data
for audio. The timestamps are ok.
If instead of send the data to a muxer we change the pipe to render the
incoming video and audio, there are no problems, and the audio sounds
ok. It really looks like a timestamp problem, but I can't find the solution
This is the "need-data code"
bool want_video = false;
void cb_need_video_data(GstElement *src, guint unused_size, gpointer
user_data)
{
want_video = true;
return;
}
void write_video_data(const void *data, int data_size)
{
if(!want_video) return false;
want_video = false;
// Fetch num den factors
GstStructure *s = gst_caps_get_structure(m_vCaps, 0);
gint num = 0, den = 0;
gst_structure_get_fraction(s, "framerate", &num, &den);
GstBuffer *buffer =
gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, (gpointer) data,
data_size, 0, data_size, NULL, NULL);
static GstClockTime timestamp = 0;
GST_BUFFER_PTS(buffer) = timestamp;
GST_BUFFER_DURATION(buffer) = gst_util_uint64_scale_int(GST_SECOND,
den, num);
// GST_BUFFER_DTS(buffer) = timestamp - GST_BUFFER_DURATION(buffer);
timestamp += GST_BUFFER_DURATION(buffer);
GstFlowReturn ret = gst_app_src_push_buffer((GstAppSrc *) vAppSrc,
buffer);
}
And the same for audio. The incoming data comes from our video server
Can anybody help me? I'm working on Windows with the last GStreamer version.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20221028/8e3d0315/attachment.htm>
More information about the gstreamer-devel
mailing list