Gstreamer: Could not swtich codebooks: rtpvorbisdepay - gstreamer

I am trying to stream audio with the following GStreamer pipeline:
Server:
gst-launch-1.0 -v audiotestsrc ! audioconvert ! vorbisenc ! rtpvorbispay ! udpsink host=127.0.0.1 port=5000
Client:
gst-launch-1.0 udpsrc port=5000 ! "application/x-rtp, media=audio, clock-rate=44100, encoding-name=VORBIS, encoding-params=1, payload=96" ! rtpvorbisdepay ! vorbisdec ! audioconvert ! autoaudiosink
I get the following message from GStreamer:
WARNING: from element /GstPipeline:pipeline0/GstRtpVorbisDepay:rtpvorbisdepay0: Could not decode stream.
Additional debug info: gstrtpvorbisdepay.c(614): gst_rtp_vorbis_depay_process (): /GstPipeline:pipeline 0/GstRtpVorbisDepay:rtpvorbisdepay0: Could not switch codebooks
And I don't get any sound on the client. Can anyone help?
[EDIT:]
When I copy-paste the caps from the server side... It works! But among those caps there is a configuration parameter which looks really ugly (link here). I noticed that if I just delete this parameter it doesn't work anymore. Moreover I used gst-inspect on udpsrc and rtpvorbisdepay elements and there is nothing about this parameter. Can someone explain me what this parameter corresponds to? Is there a way to avoid it?

I think this is Theora Vorbis thing.. those are some configuration parameters for initialization of decoder if I understand that properly..
Theora makes the same controversial design decision that Vorbis made to
include the entire probability model for the DCT coecients and all the quan-
tization parameters in the bitstream headers. This is often several hundred
elds. It is therefore impossible to decode any frame in the stream without
having previously fetched the codec info and codec setup headers.
~ from here
some similar question

Related

Using Gstreamer, i can't ind a solution to send av1 video throught Udpsink in rtp packets

I'm currently working on Gstreamer and my goal is to take video from camera(coded natively in h264) decode it, then encode in AV1 and send it in udp to another computer on the network.
My pipelines currently are :
Server :
gst-launch-1.0 -v rtspsrc location= rtsp://192.168.33.104:8554/vis.0 latency=1 is-live=TRUE ! decodebin ! autovideoconvert ! x265enc tune=zerolatency bitrate=300 speed-preset=3 ! rtph265pay ! udpsink host=192.168.33.39 port=8123
Client :
gst-launch-1.0 udpsrc address=192.168.33.39 port=8123 ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H265,payload=96 ! rtph265depay ! avdec_h265 ! autovideosink
So with h265 it works but i cannot find how to do it with AV1 because i can't find a rtpav1pay (and depay).
Thanks in advance.
I tried to search for rtpav1pay but found nothing. I tried rtpgstpay(and depay) didn't work. The main goal is to use as little as possible the network without lag so maybe it's not the best solution. If you have any other idea please share it.
There are rtpav1pay and rtpav1depay plugins provided by gst-plugins-rs; they can be built along with GStreamer if you enable the Rust plugins option, but you could also build them separately from their own repo (instructions on the README).

Storing AAC Audio and Retrieving

I would like to store a file which has AAC audio frames,
For that i used the below pipeline,
gst-launch-1.0 filesrc location=Test_44100Hz_2ch_s16le.wav ! "audio/x-raw,rate=44100,format=s16le,channels=2" ! audioparse format=raw raw-format=s16le rate=44100 channels=2 ! faac ! aacparse ! queue ! filesink location=a1
While reading that file again to pulsesink using below pipeline,
gst-launch-1.0 filesrc location=a1 ! aacparse ! faad ! audioconvert ! audioresample ! pulsesink
I am Receiving below error, I used GST_DEBUG=3, but i am not able find the solution.
0:00:00.031924804 3379 0x2231d60 WARN basesrc gstbasesrc.c:3483:gst_base_src_start_complete:<filesrc0> pad not activated yet
Pipeline is PREROLLING ...
0:00:00.033044700 3379 0x2231050 WARN baseparse gstbaseparse.c:3255:gst_base_parse_loop:<aacparse0> error: No valid frames found before end of stream
ERROR: from element /GstPipeline:pipeline0/GstAacParse:aacparse0: No valid frames found before end of stream
Additional debug info:
gstbaseparse.c(3255): gst_base_parse_loop (): /GstPipeline:pipeline0/GstAacParse:aacparse0
ERROR: pipeline doesn't want to preroll.
Can anybody help me, To solve this? I need to store AAC audio frames and need to stream that file as AAC audio stream.
This is it, tested working:
gst-launch-1.0 filesrc location=WAV_44_16bit.wav ! decodebin ! audioconvert ! queue ! voaacenc ! aacparse ! queue ! mp4mux ! filesink location=aac.mp4
gst-launch-1.0 filesrc location=aac.mp4 ! decodebin ! audioconvert ! audioresample ! alsasink
In container there are metadata information stored.. without them the decoder does not know how to process the data.
AAC Audio streams require a container in order to be useful within gstreamer
For decoder initialization it is necessary to know sampling frequency and Audio Object. In gstreamer we are unable to pass this metadata directly to the parser or the decoder. The parser collects this data instead from the mp4 header then the encoder inherits the frame structure/size and sample rate. So this is a deficiency in either aacparse(parser) or avdec_aac/faad(decoder), none of which have exposed parameters to specify frame size of a raw file, the afore mentioned metadata. That being said, I haven't found a compelling reason why anyone would need to do this. I found myself trying to do it before I discovered the aac simply needed to be muxed into an MP4(mp4mux) or another container to work and be portable. The container/framing only adds a small amount of data to the stream.

Encode/decode VP8 or VP9 with Gstreamer?

I'm trying to find a way to use VP8 or VP9 compressed video, a part of Googles WebM project with Gstreamer.
Is there a already a module that can handle VP8? If so, can I get some simple example of how to use it in a broadcast/receive over RTP?
So far there is nothing on the Gstreamer official documentation. They have Matroska support but that seems only be for demuxing the container.
Edit
There obviously are ways
Server:
gst-launch-0.10 -v v4l2src ! video/x-raw-yuv,width=640,height=480 ! vp8enc ! rtpvp8pay ! udpsink host=127.0.0.1 port=9001
Client:
gst-launch-0.10 udpsrc port=9001 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)VP8-DRAFT-IETF-01, payload=(int)96, ssrc=(uint)2990747501, clock-base=(uint)275641083, seqnum-base=(uint)34810" ! rtpvp8depay ! vp8dec ! ffmpegcolorspace ! Autovideosink
But the latency is higher than I expected.
Yes VP8 is already supported..
VP9 is missing de/payloader more to that below (not really - gst 1.8 added support - details at bottom)
They are contained in vpx module.
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-plugin-vpx.html
VP8:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-vp8enc.html
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-vp8dec.html
check with gst-inspect-1.0 vp8enc if you have it
For RTP you can use webmmux, rtpvp8depay, rtpvp8pay, vp8enc/dec etc..
However, as Burak Arslan stated pay/depayloader for RTP are not ready for now (not even in 1.6.1 I checked)
For the examples - post some pipe with that and we can check it when its not working :)
EDIT
GStreamer 1.8 was released with support for VP9 - new elements rtpvp9pay/rtpvp9depay added

Using gst-launch to streaming video?

I want to stream a media file (video or audio). I used command:
gst-launch-0.10 filesrc location="/home/ms/GStreamerTest/test.ogg" ! vorbisenc \
! rtpvorbispay pt=96 ! udpsink host=127.0.0.1 port=5000
to stream the file test.ogg, but, I got an error:
"ERROR: from element /GstPipeline:pipeline0/GstVorbisEnc:vorbisenc0: Internal GStreamer error: negotiation problem. Please file a bug at http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer.
Additional debug info:
gstvorbisenc.c(1227): gst_vorbis_enc_chain (): /GstPipeline:pipeline0/GstVorbisEnc:vorbisenc0:
encoder not initialized (input is not audio?)
ERROR: pipeline doesn't want to preroll.
Please help me solve this problem, thanks.
You plugged an encoded and muxed bitstream into an audio encoder. That cannot possibly work.
In your case filesrc ! udpsink would send your file across the network and on the other side you have to receive it udpsrc, demux it oggdemux, decode it theoradec or vorbisdec, and pipe it into a sink autovideosink or autoaudiosink

Streaming using GStreamer

I have got one HD video "ed_hd.avi" on System#1. Would like to stream it over network and play the content from System#2. I am using GStreamer on Ubuntu 11.04, tried a lot on this. Variety of errors makes this objective difficult to diagnose. Will be thankful for getting a working command for the System#1-end and System#2-end.
What I have tried is as follows:
System #1:
gst-launch filesrc location=ed_hd.avi ! decodedin ! x263enc ! video/x-h264 ! rtph264pay ! udpsink host=127.0.0.1 port=5000
System #2:
gst-launch udpsrc port=5000 ! rtph264depay ! decodebin ! xvimagesink
Objective is : Convert avi file to raw video. Stream it from the second System#2.
Thank You.
Could you try the following
gst-launch filesrc location=ed_hd.avi ! decodebin ! ffenc_mpeg4 ! rtpmp4vpay ! udpsink host=127.0.0.1 port=5000
If that doesn't work then proceed:
Did you try the following? You need to replace his audio bins with video bins
http://delog.wordpress.com/2011/06/01/stream-raw-vorbis-audio-over-udp-or-tcp-with-gstreamer/
Also take a look at
http://pastebin.com/PtD21Bx7
Here replace v4l2src with your video src
Also
https://metalab.at/wiki/Gstreamer_One_Liners
I think your problem is the 127.0.0.1 portion. That is a loopback address (check ifconfig lo0 to see the Link encap:Local Loopback for the 127.0.0.1 address). This won't work across two systems, though it might work fine on a single system.
Instead, use the address that is publicly visible for the second machine; check ip addr show or ifconfig output to find the address. Write the actual address for System #2 in the command line on System #1.