Is it possible to update the volume of a tee src?
for example gst-launch-1.0 interleave name=i audiotestsrc wave=0 freq=100 volume=0.4 ! decodebin ! audioconvert ! "audio/x-raw,format=S16BE,channels=1" ! tee name=t1 audiotestsrc wave=2 freq=100 volume=0.4 ! decodebin ! audioconvert ! "audio/x-raw,format=S16BE,channels=1" ! tee name=t2 t1. ! queue ! i. //make volume 1 here t2. ! queue ! i. //make volume 0.5 here t1. ! queue ! i. //make volume 0.8 here t2. ! queue ! i. //make volume 0.7 here i.src ! capssetter caps="audio/x-raw,format=S16BE,channels=4,channel-mask=(bitmask)0xf" ! audioconvert ! audioresample ! wavenc ! filesink location=test.wav I tried gst-launch-1.0 interleave name=i audiotestsrc wave=0 freq=100 volume=0.4 ! decodebin ! audioconvert ! "audio/x-raw,format=S16BE,channels=1" ! tee name=t1 audiotestsrc wave=2 freq=100 volume=0.4 ! decodebin ! audioconvert ! "audio/x-raw,format=S16BE,channels=1" ! tee name=t2 t1. ! queue ! audioconvert ! volume volume=1 ! i. //make volume 1 here t2. ! queue ! audioconvert ! volume volume=0.5 ! i. //make volume 0.5 here t1. ! queue ! audioconvert ! volume volume=0.8 ! i. //make volume 0.8 here t2. ! queue ! audioconvert ! volume volume=0.7 ! i. //make volume 0.7 here i.src ! capssetter caps="audio/x-raw,format=S16BE,channels=4,channel-mask=(bitmask)0xf" ! audioconvert ! audioresample ! wavenc ! filesink location=test.wav which runs but corrupts the audio, I think the audio convert is resetting the caps? Future use would be to give the new volume a name so that it can be updated dynamically with gst_parse_launch() and gst_bin_get_by_name() thanks in advance for the help. -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
I think you just have too many extra restrictions in your pipeline that are preventing things from running. You probably shouldn't be using capssetter, because that will just coerce the caps to be what you want, but if the underlying data isn't in that format, you'll end up with a corrupted output. A couple other little observations: - The wavenc element only uses little endian audio (S16LE). - You don't necessarily need to run audioresample if you're audio is already in the correct rate (I added rate=48000 to audiotestsrc below) - The volume element is a multiplier on the current volume level... 0.5 will cut the volume in half, while 2.0 is double the volume. - You shouldn't use decodebin, because your audio caps are already audio/x-raw, and there is nothing to decode... it's all uncompressed audio data. - Your original command line had a lot of extra audioconvert elements, but it's ok to have those because they'll just be a pass-through if there was nothing to convert. Here, I made some tweaks to your command line: gst-launch-1.0 interleave name=i \ audiotestsrc num-buffers=100 wave=0 freq=100 volume=0.4 ! \ audio/x-raw,format=S16LE,channels=1,rate=48000 ! tee name=t1 \ audiotestsrc num-buffers=100 wave=2 freq=100 volume=0.4 ! \ audio/x-raw,format=S16LE,channels=1,rate=48000 ! tee name=t2 \ t1. ! queue ! volume volume=1 ! i. \ t2. ! queue ! volume volume=0.5 ! i. \ t1. ! queue ! volume volume=0.8 ! i. \ t2. ! queue ! volume volume=0.7 ! i. \ i. ! audio/x-raw,format=S16LE,channels=4 \ ! audioconvert ! wavenc ! filesink location=test.wav --Chris On Thu, Jan 14, 2021 at 11:48 PM Nick_law <[hidden email]> wrote: Is it possible to update the volume of a tee src? _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
This post was updated on .
Thanks so much Chris!
Ok I think I misunderstood what capsetter actually does. But what you said makes sense. - I only use wavenc as a quick test, actually writing to a filesink FIFO - Resample, OK I think if I set the rate correctly at the src creation then I won't need to resample (usually set to 48010 to allow enough fifo data). -Volume: Seriously? So the "volume" property of audiotestsrc is 0-1 but an external volume is a multiplier? I should be able to add a name = vol1 for later volume update right? Kinda like a named pad? -decodebin: I used decodebin generically but may remove it for audiotestsrc, although think I need it for filesrc ! wavparse. And will still be implementing a raw filesrc fifo in the future. -Audioconvert: May have been trigger happy in the attempt to get the right audio out. Thanks again, Nick Chris Wine wrote > I think you just have too many extra restrictions in your pipeline that > are > preventing things from running. You probably shouldn't be using > capssetter, > because that will just coerce the caps to be what you want, but if the > underlying data isn't in that format, you'll end up with a corrupted > output. A couple other little observations: > > - The wavenc element only uses little endian audio (S16LE). > - You don't necessarily need to run audioresample if you're audio is > already in the correct rate (I added rate=48000 to audiotestsrc below) > - The volume element is a multiplier on the current volume level... 0.5 > will cut the volume in half, while 2.0 is double the volume. > - You shouldn't use decodebin, because your audio caps are already > audio/x-raw, and there is nothing to decode... it's all uncompressed audio > data. > - Your original command line had a lot of extra audioconvert elements, but > it's ok to have those because they'll just be a pass-through if there was > nothing to convert. > > Here, I made some tweaks to your command line: > > gst-launch-1.0 interleave name=i \ > audiotestsrc num-buffers=100 wave=0 freq=100 volume=0.4 ! \ > audio/x-raw,format=S16LE,channels=1,rate=48000 ! tee name=t1 \ > audiotestsrc num-buffers=100 wave=2 freq=100 volume=0.4 ! \ > audio/x-raw,format=S16LE,channels=1,rate=48000 ! tee name=t2 \ > t1. ! queue ! volume volume=1 ! i. \ > t2. ! queue ! volume volume=0.5 ! i. \ > t1. ! queue ! volume volume=0.8 ! i. \ > t2. ! queue ! volume volume=0.7 ! i. \ > i. ! audio/x-raw,format=S16LE,channels=4 \ > ! audioconvert ! wavenc ! filesink location=test.wav > > --Chris -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list gstreamer-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
You're welcome. On the volume element, yes it's a multiplier where 1 is 100% (no change), but the range is 0-10. Every half step is ~6 dB, so volume=0.5 will drop the level 6 dB and volume=0.25 will drop the level 12 dB. A volume=2 will increase the level 6 dB, and volume=4 will increase the level 12 dB. On audiotestsrc, I believe a volume of 1 will already be peak volume. On the sample rate, I can't say for sure because I don't know you're application, but you probably aren't going to want a non-standard rate of 48010. There are a few standard sample rates you'll see all the time in audio files, including 48000, 44100, and 22050. Maybe you're referring to the size of the audio buffers that audiotestsrc produces; for that, you can set the samplesperbuffer property on audiotestsrc. --Chris On Sun, Jan 17, 2021 at 9:31 PM Nick_law <[hidden email]> wrote: Thanks so much Chris! _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |