I am trying to execute a gstreamer pipeline using php script. I was able to get a test pipeline to work without any errors. But when I try the below pipeline in php script, I get an error from the pulsesrc element.
$output = shell_exec('sudo /usr/bin/gst-launch-1.0 -e v4l2src device=/dev/video1 ! tee name=t1 t1. ! queue ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! queue ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mux. pulsesrc device="alsa_input.usb-VXIS_Inc_ezcap_U3_capture-02.analog-stereo" ! queue ! audio/x-raw,width=16,depth=16,rate=44100,channel=1 ! audioconvert ! voaacenc ! aacparse ! mpegtsmux name=mux ! filesink location=feed1TS.ts t1. ! queue ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! queue ! "video/x-raw(memory:NVMM),width=959,height=540,framerate=30/1,format=NV12" ! queue ! nvoverlaysink overlay-x=0 overlay-y=270 overlay-w=959 overlay-h=540 overlay=1 v4l2src device=/dev/video0 io-mode=2 do-timestamp=true ! tee name=t2 t2. ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! videorate ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,width=1920,height=1080,framerate=30/1 ! nvvidconv ! queue ! "video/x-raw(memory:NVMM),framerate=30/1,format=NV12" ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mpegtsmux ! filesink location=feed2TS.ts t2. ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,framerate=30/1 ! nvvidconv ! queue ! "video/x-raw(memory:NVMM),framerate=30/1,format=NV12" ! queue ! nvoverlaysink overlay-x=960 overlay-y=270 overlay-w=960 overlay-h=540 overlay=2 2>&1 &');
Below is the error
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE
Opening in BLOCKING MODE
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0: Failed to connect: Connection refused
Additional debug info:
pulsesrc.c(1015): gst_pulsesrc_open (): /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0
Opening in BLOCKING MODE
Setting pipeline to NULL ...
Freeing pipeline ...
So I tried the same pipeline without pulsesrc element then the pipeline is working perfectly
$output = shell_exec('sudo /usr/bin/gst-launch-1.0 -e v4l2src device=/dev/video1 ! tee name=t1 t1. ! queue ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! queue ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mpegtsmux ! filesink location=feed1TS.ts t1. ! queue ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! queue ! "video/x-raw(memory:NVMM),width=959,height=540,framerate=30/1,format=NV12" ! queue ! nvoverlaysink overlay-x=0 overlay-y=270 overlay-w=959 overlay-h=540 overlay=1 v4l2src device=/dev/video0 io-mode=2 do-timestamp=true ! tee name=t2 t2. ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! videorate ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,width=1920,height=1080,framerate=30/1 ! nvvidconv ! queue ! "video/x-raw(memory:NVMM),framerate=30/1,format=NV12" ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mpegtsmux ! filesink location=feed2TS.ts t2. ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,framerate=30/1 ! nvvidconv ! queue ! "video/x-raw(memory:NVMM),framerate=30/1,format=NV12" ! queue ! nvoverlaysink overlay-x=960 overlay-y=270 overlay-w=960 overlay-h=540 overlay=2 2>&1 &');
I also tried to use only pulsesrc pipeline to test as below.
$output = shell_exec('sudo /usr/bin/gst-launch-1.0 -e pulsesrc device=alsa_input.usb-VXIS_Inc_ezcap_U3_capture-02.analog-stereo ! queue ! audio/x-raw,width=16,depth=16,rate=44100,channel=1 ! audioconvert ! vorbisenc ! oggmux ! filesink location=HW1.ogg 2>&1 &');
It also is not working when called from php. Pipeline output is shown as below.
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0: Failed to connect: Connection refused
Additional debug info:
pulsesrc.c(1015): gst_pulsesrc_open (): /GstPipeline:pipeline0/GstPulseSrc:pulsesrc0
Setting pipeline to NULL ...
Freeing pipeline ...
What can be the issue for this and how can I resolve this error in pulsesrc?
All above pipelines are working perfectly in the commandline.