Gstreamer in Android. UDP stream

2019-05-26 16:44发布

问题:

I have setup my raspberry pi with the camera board. The code in rpi is:

raspivid -t 999999 -h 720 -w 1080 -fps 25 -b 2000000 -o - | gst-launch-0.10 -v fdsrc fd=0 ! h264parse ! rtph264pay ! udpsink host=192.168.2.1 port=5000

and then I run in my mac:

gst-launch-1.0 -v udpsrc port=5000 ! application/x-rtp,payload=96,media=video,clock-rate=90000,encoding-name=H264,sprop-parameter-sets=\"J2QAH6wrQCIC3y8A8SJq\\,KO4CXLA\\=\" ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

The video is showing just fine. Now I have the tutorial 3 of Android Gstreamer and my pipeline is (udpsink host modified in server to Android device ip):

data->pipeline = gst_parse_launch("udpsrc caps=\"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"J2QAFKwrQKD9APEiag\\=\\=\\,KO4fLA\\=\\=\", ssrc=(uint)2607831725, payload=(int)96, clock-base=(uint)1706962490, seqnum-base=(uint)15791\" port=5000 ! queue ! rtph264depay  ! queue ! ffdec_h264 ! autovideosink sync=false", &error);

But it shows could not set property "caps" in element "udpsrc0". I know that it is because sprop-parameter-sets, but how can I put the \"J2QAFKwrQKD9APEiag\\=\\=\\,KO4fLA\\=\\=\" string without gstreamer complains? (I've already tried a lot of modifications)

Info: Mac OSX 10.8.4, Eclipse Indigo SR2, android-ndk-r8d (tutorials didn't worked with other versions), gstreamer-sdk-android-arm-debug-2012.11 (tutorials didn't worked with other versions), Optimus Black p970 ICS.

Any sugestions?

回答1:

Well, I've been able to resolve the issue. The caps should be like this:

udpsrc port=5000 caps=\"application/x-rtp, media=video, clock-rate=90000, encoding-name=H264, sprop-parameter-sets=\\\"J2QAFKwrQLj/LwDxImo\\\\=\\\\,KO4fLA\\\\=\\\\=\\\"\", payload=96\" ! ...

The video is shown with almost no delay