Hello there,
I am using GStreamer to stream live video / audio from a Pi3B with a picam module and USB microphone. My end goal is to use the audio from the one USB microphone in both the live video / audio stream AND as the input to a python script. I understand that this can be done with the ALSA dsnoop plugin and have been able to demonstrate it with this /etc/asound.conf config: pcm.myTest { type dsnoop ipc_key 2241234 slave { pcm "hw:1,0" channels 1 } } pcm.!default { type asym playback.pcm { type plug slave.pcm "hw:0,0" } capture.pcm { type plug slave.pcm "myTest" } } With the above ALSA config, the video / audio stream works perfectly using the following GStreamer settings, but i am unable to use the microphone in other applications (note the "hw:1,0"): #!/bin/bash gst-launch-1.0 -v rpicamsrc vflip=true hflip=false \ name=src preview=0 fullscreen=0 bitrate=10000000 \ annotation-mode=time annotation-text-size=20 \ ! video/x-h264,width=960,height=540,framerate=24/1 \ ! h264parse \ ! rtph264pay config-interval=1 pt=96 \ ! queue max-size-bytes=0 max-size-buffers=0 \ ! udpsink host=192.168.1.101 port=5001 \ alsasrc device=hw:1,0 \ ! audioconvert \ ! audioresample \ ! opusenc \ ! rtpopuspay \ ! queue max-size-bytes=0 max-size-buffers=0 \ ! udpsink host=192.168.1.101 port=5002 The following (which uses the dsnoop device) causes an issue in the video stream which looks like some kind of synchronization problem where instead of a nice smooth 24 frames per second I get one frame every ~2-3 seconds. The audio continues to work well and im able to use the USB mic simultaneously in other applications. #!/bin/bash gst-launch-1.0 -v rpicamsrc vflip=true hflip=false \ name=src preview=0 fullscreen=0 bitrate=10000000 \ annotation-mode=time annotation-text-size=20 \ ! video/x-h264,width=960,height=540,framerate=24/1 \ ! h264parse \ ! rtph264pay config-interval=1 pt=96 \ ! queue max-size-bytes=0 max-size-buffers=0 \ ! udpsink host=192.168.1.101 port=5001 \ alsasrc device=plug:myTest \ ! audioconvert \ ! audioresample \ ! opusenc \ ! rtpopuspay \ ! queue max-size-bytes=0 max-size-buffers=0 \ ! udpsink host=192.168.1.101 port=5002 I've tried a few things that I've found in some peripherally related forums to no avail and im feeling kinda stuck. Do any of you have any suggestions on getting the stream's video to play nicely with dsnoop so that I can avoid buying another microphone for this project? Thank you for what you do! -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Le mardi 13 avril 2021 à 18:03 -0500, StreaminBaby a écrit :
> Hello there, > > I am using GStreamer to stream live video / audio from a Pi3B with a picam > module and USB microphone. My end goal is to use the audio from the one USB > microphone in both the live video / audio stream AND as the input to a > python script. I understand that this can be done with the ALSA dsnoop > plugin and have been able to demonstrate it with this /etc/asound.conf > config: > > pcm.myTest { > type dsnoop > ipc_key 2241234 > slave { > pcm "hw:1,0" > channels 1 > } > } > > pcm.!default { > type asym > playback.pcm { > type plug > slave.pcm "hw:0,0" > } > capture.pcm { > type plug > slave.pcm "myTest" > } > } > > With the above ALSA config, the video / audio stream works perfectly using > the following GStreamer settings, but i am unable to use the microphone in > other applications (note the "hw:1,0"): > > #!/bin/bash > gst-launch-1.0 -v rpicamsrc vflip=true hflip=false \ > name=src preview=0 fullscreen=0 bitrate=10000000 \ > annotation-mode=time annotation-text-size=20 \ > ! video/x-h264,width=960,height=540,framerate=24/1 \ > ! h264parse \ > ! rtph264pay config-interval=1 pt=96 \ > ! queue max-size-bytes=0 max-size-buffers=0 \ > ! udpsink host=192.168.1.101 port=5001 \ > alsasrc device=hw:1,0 \ > ! audioconvert \ > ! audioresample \ > ! opusenc \ > ! rtpopuspay \ > ! queue max-size-bytes=0 max-size-buffers=0 \ > ! udpsink host=192.168.1.101 port=5002 > > > The following (which uses the dsnoop device) causes an issue in the video > stream which looks like some kind of synchronization problem where instead > of a nice smooth 24 frames per second I get one frame every ~2-3 seconds. > The audio continues to work well and im able to use the USB mic > simultaneously in other applications. Just some ideas to help give a clue, have you tried setting provide-clock=false on alsasrc ? Some of the ALSA lib software component do very bad time reporting. > > #!/bin/bash > gst-launch-1.0 -v rpicamsrc vflip=true hflip=false \ > name=src preview=0 fullscreen=0 bitrate=10000000 \ > annotation-mode=time annotation-text-size=20 \ > ! video/x-h264,width=960,height=540,framerate=24/1 \ > ! h264parse \ > ! rtph264pay config-interval=1 pt=96 \ > ! queue max-size-bytes=0 max-size-buffers=0 \ > ! udpsink host=192.168.1.101 port=5001 \ > alsasrc device=plug:myTest \ > ! audioconvert \ > ! audioresample \ > ! opusenc \ > ! rtpopuspay \ > ! queue max-size-bytes=0 max-size-buffers=0 \ > ! udpsink host=192.168.1.101 port=5002 > > I've tried a few things that I've found in some peripherally related forums > to no avail and im feeling kinda stuck. Do any of you have any suggestions > on getting the stream's video to play nicely with dsnoop so that I can avoid > buying another microphone for this project? > > Thank you for what you do! > > > > -- > Sent from: http://gstreamer-devel.966125.n4.nabble.com/ > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Thank you for the extremely helpful response!
Editing the alsasrc line to: alsasrc device=plug:myTest provide-clock=false \ was exactly what I needed! One minor side effect of this approach is that, as expected, the audio is out of sync with the video by about 0.5 seconds. Do you have any suggestions on getting the two to sync up a little better or is this just one of the inevitable tradeoffs when trying to use a dsnoop device with gstreamer? For my application, this asynchronicity is manageable, but just curious if you have any pointers. Thanks for all that you do! -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Le sam. 24 avr. 2021 21 h 45, StreaminBaby via gstreamer-devel <[hidden email]> a écrit : Thank you for the extremely helpful response! Most libalsa Plugins are terrible in providing feedback about their introduced latency. Best you can do is to reduce your audio patch latency. Try and reduce the buffer-time in alsasrc (as it's tied to the allowed drift, and same for the playback is any, as it's tied to the reported latency.
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |