need quick gstreamer application to test if qtdemux is working - gstreamer

Can someone give me a quick gstreamer application to test if qtdemux is working. It needs to output to a filesink not imagesink as this is on a server with no gui.
I seem to have it working via gst-launch, but when compiling an application it does not seem to work.
I have tried the following,
caps = gst_caps_new_simple("video/x-raw-yuv",
"format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'),
"width", G_TYPE_INT, 384,
"height", G_TYPE_INT, 216,
"framerate", GST_TYPE_FRACTION, 25, 1,
NULL);
Thx Art

You can test everything from gst-launch like so:
gst-launch filesrc location=test.mov ! qtdemux name=demux demux.audio_00 ! decodebin ! audioconvert ! audioresample ! autoaudiosink demux.video_00 ! queue ! decodebin ! ffmpegcolorspace ! videoscale ! autovideosink
More info on qtdemux

Related

GStreamer. Play raw h264 from udp

I'm getting raw h264 stream from some camera and i need to play that using the gst.
At first i tried to save the stream to the file (using my own application which just writes stream to a file) and pay using filesrc:
gst-launch-1.0 filesrc location="file path" ! video/x-h264 ! h264parse ! avdec_h264 ! videoconvert ! videorate ! video/x-raw,framerate=30/1 ! autovideosink
That works OK. Then i tried to play from the udpsrc:
gst-launch-1.0 udpsrc port=1234 ! video/x-h264 ! h264parse ! avdec_h264 ! videoconvert ! videorate ! video/x-raw,framerate=30/1 ! autovideosink
And got next error (after start stream from camera):
ERROR: from element /GstPipeline:pipeline0/GstCapsFilter:capsfilter0: Filter caps do not completely specify the output format
Additional debug info:
gstcapsfilter.c(453): gst_capsfilter_prepare_buf (): /GstPipeline:pipeline0/GstCapsFilter:capsfilter0:
Output caps are unfixed: video/x-h264, width=(int)[ 1, 8192 ], height=(int)[ 1, 8192 ], framerate=(fraction){ 30/1, [ 0/1, 2147483647/1 ] }
Execution ended after 0:00:04.234834646
I'm new in GST.
Please, help me)))
The solution:
gst-launch-1.0 -v udpsrc port=5000 ! h264parse ! avdec_h264 ! videoconvert ! videorate ! video/x-raw,framerate=30/1 ! autovideosink
For real-time stream:
gst-launch-1.0 -v udpsrc port=5000 ! h264parse ! avdec_h264 ! videoconvert ! autovideosink

gstreamer rtpdepay error "Segment with non-TIME format not supported"

I've have a gstreamer pipeline that is playing back RTP stream received from udpsrc:
udpsrc port=6000 caps=\"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265, payload=(int)96, seqnum-offset=(uint)5331, timestamp-offset=(uint)2500093283, ssrc=(uint)2046637718, a-framerate=(string)1\" ! rtph265depay ! avdec_h265 ! videoconvert ! autovideosink sync=false
That works fine, however if I replace udpsrc with appsrc, it stops working. The only error I'm seeing is:
... Segment with non-TIME format not supported
non-working pipeline with appsrc:
appsrc name=appsrc caps=\"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265, payload=(int)96, seqnum-offset=(uint)5331, timestamp-offset=(uint)2500093283, ssrc=(uint)2046637718, a-framerate=(string)1\" ! rtph265depay ! avdec_h265 ! videoconvert ! autovideosink sync=false
Turns out that appsrc needs to have its format property set to time.
Here is the fixed pipeline:
appsrc name=appsrc format=time caps=\"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265, payload=(int)96, seqnum-offset=(uint)5331, timestamp-offset=(uint)2500093283, ssrc=(uint)2046637718, a-framerate=(string)1\" ! rtph265depay ! avdec_h265 ! videoconvert ! autovideosink sync=false

I need some help in relation to caps in GStreamer

I have the following pipeline:
pipeline_str =
g_strdup_printf ("rtspsrc name=source location=%s ! \
decodebin ! video/x-raw ! videoconvert ! \
textoverlay line-alignment=0 name=overlay font-desc=20 ! \
videoscale ! video/x-raw, width=%d, height=%d ! videorate ! \
x264enc name=encoder bitrate=%d key-int-max=4 ! \
video/x-h264 ! \
h264parse config-interval=1 ! \
video/x-h264, stream-format=byte-stream, alignment=au ! \
rtph264pay pt=96 ! udpsink host=%s port=%d",
_uri.c_str(), _width, _height, _bitrate, _address.c_str(), _port);
If I need to change the bitrate in the encoder I can do this:
GstElement *_encoder;
_encoder = gst_bin_get_by_name(GST_BIN(data.pipeline), "encoder");
g_object_set(G_OBJECT(_encoder), "bitrate", _bitrate, NULL);
However, if i need to change the width or the height on run-time, I cant insert the name in the capfilter: "video/x-raw name=resol, width=%d, height=%d"
ERROR: could not parse caps "video/x-raw name=resol, width=1920, height=1080"
Being in this way, which would be the equivalent of "gst_bin_get_by_name" for caps and how could I name the caps, when I create the pipeline
Use the capsfilter itself. The syntax you are using is for convenience as it quite often being used.
Check the example here:
https://gstreamer.freedesktop.org/documentation/coreelements/capsfilter.html?gi-language=c
On the first example you should also be able to set a name.

using gstreamer srtp for audio streaming

tried the below but cant hear audio
gst-launch-1.0 udpsrc port=6000 ! "application/x-srtp,media=(string)audio, clock-rate=(int)44100, encoding-name=(string)L16, channels=(int)2, payload=(int)96, srtp-key=(buffer)012345678901234567890123456789012345678901234567890123456789, srtp-cipher=(string)aes-128-icm, srtp-auth=(string)hmac-sha1-80, srtcp-cipher=(string)aes-128-icm, srtcp-auth=(string)hmac-sha1-80, roc=(uint)0" ! srtpdec ! rtpL16depay ! audioconvert ! alsasink
gst-launch-1.0 -v alsasrc ! audioconvert ! audio/x-raw,channels=2,depth=16,width=16,rate=44100 ! rtpL16pay ! srtpenc key="012345678901234567890123456789012345678901234567890123456789" ! udpsink host=3.204.26.22 port=6000
That is because you havent set ssrc, try the following pipelines
Sender pipeline as:
gst-launch-1.0 -v alsasrc ! audioconvert ! audio/x-raw,channels=2,depth=16,width=16,rate=44100 ! rtpL16pay ! 'application/x-rtp, ssrc=(uint)3412089386' ! srtpenc key="012345678901234567890123456789012345678901234567890123456789" ! udpsink host=3.204.26.22 port=6000
Receiver pipeline as:
gst-launch-1.0 udpsrc port=6000 ! "application/x-srtp,media=(string)audio, clock-rate=(int)44100, encoding-name=(string)L16, channels=(int)2, payload=(int)96,ssrc=(uint)3412089386, srtp-key=(buffer)012345678901234567890123456789012345678901234567890123456789, srtp-cipher=(string)aes-128-icm, srtp-auth=(string)hmac-sha1-80, srtcp-cipher=(string)aes-128-icm, srtcp-auth=(string)hmac-sha1-80, roc=(uint)0" ! srtpdec ! rtpL16depay ! audioconvert ! alsasink

Working example of rtpvrawpay in GStreamer

Can someone paste a working pair of gst-launch pipelines that use rtpvrawpay and rtpvrawdepay?
Here's my first stab at it:
gst-launch-1.0 videotestsrc ! videoconvert ! video/x-raw,width=128,height=128,format=BGR ! rtpvrawpay ! application/x-rtp,payload=96 ! udpsink host=... port=...
gst-launch-1.0 udpsrc port=9999 ! application/x-rtp,media=video,payload=96,clock-rate=90000,encoding-name=RAW,sampling=BGR,depth=16 ! rtpvrawdepay ! video/x-raw,width=128,height=128,format=BGR,framerate=30/1 ! videoconvert ! ximagesink
Pay: gst-launch-1.0 -v videotestsrc ! rtpvrawpay ! udpsink host="127.0.0.1" port="5000"
Depay: gst-launch-1.0 udpsrc port="5000" caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)RAW, sampling=(string)YCbCr-4:2:0, depth=(string)8, width=(string)320, height=(string)240, colorimetry=(string)BT601-5, payload=(int)96, ssrc=(uint)1103043224, timestamp-offset=(uint)1948293153, seqnum-offset=(uint)27904" ! rtpvrawdepay ! videoconvert ! queue ! xvimagesink sync=false
Check the caps on your pipeline again.