Changes between Version 4 and Version 5 of gstreamer
- Timestamp:
- 02/26/2020 09:12:26 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
gstreamer
v4 v5 739 739 The GStreamer {{{alsasrc}}} and {{{alsasink}}} provide audio capture and playback to Advanced Linux Sound Architecture (ALSA) devices. ALSA is the modern device-driver API for the Linux kernel. 740 740 741 The Gstreamer {{{alsasrc}}} and {{{alsasink}}} can be passed a {{{device}}} property which can represent either the device name (reported from {{{aplay -L}}} for playback, or {{{arecord -L}}} for record) (ie {{{sysdefault:CARD=sgtl5000audio}}}) or the hw:x,ynotation (ie {{{hw:0,0}}} for first device, first subdevice)741 The Gstreamer {{{alsasrc}}} and {{{alsasink}}} can be passed a {{{device}}} property which can represent either the 'device alias' (reported from {{{aplay -L}}} for playback, or {{{arecord -L}}} for record) (ie {{{sysdefault:CARD=sgtl5000audio}}}) or the 'hw:<card>,<device>' notation (ie {{{hw:0,0}}} for first device, first subdevice) 742 742 743 743 If not specified via the {{{device}}} property, the device used for alsasrc and alsasink will depend on {{{/etc/asound.conf}}} and/or {{{~/.asoundrc}}}. … … 755 755 756 756 Examples: 757 * Generate and play a 1kHz tone to the 'hw:0,0' device: 758 {{{#!bash 759 gst-launch-1.0 audiotestsrc ! alsasink device="hw:0,0" 757 * Generate and play a 1kHz tone to the analog audio output device on Ventana (sgtl5000audio): 758 {{{#!bash 759 gst-launch-1.0 audiotestsrc ! \ 760 alsasink device="sysdefault:CARD=sgtl5000audio" 760 761 }}} 761 762 … … 768 769 769 770 Examples: 770 * Capture 32kHz stereo 16bit audio from the 'hw:0,0' deviceand mux into into an AVI file:771 {{{#!bash 772 gst-launch-1.0 alsasrc device=" hw:0,0" ! "audio/x-raw,rate=32000,channels=2,depth=16" ! \771 * Capture 32kHz stereo 16bit audio from the Analog Audio input on Ventana (sgtl5000audio) and mux into into an AVI file: 772 {{{#!bash 773 gst-launch-1.0 alsasrc device="sysdefault:CARD=sgtl5000audio" ! "audio/x-raw,rate=32000,channels=2,depth=16" ! \ 773 774 audioconvert ! avimux ! filesink location=./audio.avi 774 775 }}} … … 782 783 783 784 Examples: 784 * Generate and play a 1kHz tone to the 'hw:0,0' device: 785 {{{#!bash 786 gst-launch-1.0 audiotestsrc ! alsasink device="hw:0,0" 785 * Generate and play a 1kHz tone to the analog audio output device on Ventana (sgtl5000audio): 786 {{{#!bash 787 gst-launch-1.0 audiotestsrc ! \ 788 alsasink device="sysdefault:CARD=sgtl5000audio" 787 789 }}} 788 790 … … 805 807 806 808 Examples: 807 * Capture audio from the 'hw:0,0' device, encode it using the MPEG Layer 3 audio codec and store it to a file:808 {{{#!bash 809 gst-launch-1.0 alsasrc device=" hw:0,0" ! audioconvert ! lamemp3enc ! filesink location=file.mp3809 * Capture audio from the Ventana Analog audio input (sgtl5000audio), encode it using the MPEG Layer 3 audio codec and store it to a file: 810 {{{#!bash 811 gst-launch-1.0 alsasrc device="sysdefault:CARD=sgtl5000audio" ! audioconvert ! lamemp3enc ! filesink location=file.mp3 810 812 }}} 811 813 … … 843 845 * specify the sample-rate (32kHz), channels (2:stereo), and bit depth (16bit) and capture to an AVI file: 844 846 {{{#!bash 845 gst-launch-1.0 a lsasrc device="hw:0,0"! "audio/x-raw,rate=32000,channels=2,depth=16" ! \847 gst-launch-1.0 audiotestsrc ! "audio/x-raw,rate=32000,channels=2,depth=16" ! \ 846 848 audioconvert ! avimux ! filesink location=./audio.avi 847 849 }}} … … 857 859 }}} 858 860 859 To send audio from the sgtl5000 (analog input) to the imxhdmisoc (HDMI output): 861 To send audio from the Ventana Analog input (sgtl5000audio) to the Ventana HDMI output (DWHDMI): 862 * first, enable Analog input Line in and set capture volume: 863 {{{#!bash 864 card=$(cat /proc/asound/cards | grep sgtl5000 | head -1 | awk '{print $1}') 865 amixer -c $card sset "Capture Mux" LINE_IN 866 amixer -c $card sset "Capture" 8 # 0-15 867 }}} 860 868 * using device/function numbers (ie from {{{aplay -l}}}): 861 869 {{{#!bash 862 gst-launch-1.0 alsasrc device="hw:0,0" ! alsasink device="hw:2,0" 863 }}} 864 * or, using names (ie from {{{aplay -L}}}): 870 gst-launch-1.0 alsasrc device="hw:2,0" ! \ 871 audioconvert ! \ 872 alsasink device="hw:0,0" 873 }}} 874 * or, using device aliases (ie from {{{aplay -L}}}): 865 875 {{{#!bash 866 876 gst-launch-1.0 alsasrc device="sysdefault:CARD=sgtl5000audio" ! \ 867 alsasink device="sysdefault:CARD=imxhdmisoc" 868 }}} 877 audioconvert ! \ 878 alsasink device="sysdefault:CARD=imxhdmisoc" 879 }}} 880 * Note the use of {{{audioconvert}}} above to handle any format conversions needed between input and output devices 869 881 870 882 To send audio from the tda1997x HDMI receiver (digital input) to the imxhdmisoc (digital output): … … 1043 1055 }}} 1044 1056 1045 The above pipeline will attempt to output to the first video device and first audio devices found. However, you can further specify this by :1046 {{{#!bash 1047 gst-launch-1.0 playbin uri=file:///media/open-media/big_buck_bunny_1080p_mp4v_ac3_5.1.avi audio-sink="alsasink device= hw:1,0"1057 The above pipeline will attempt to output to the first video device and first audio devices found. However, you can further specify this by providing a {{{video-sink}}} and {{{audio-sink}}} property for example to decode audio to the Analog audio output on Ventana: 1058 {{{#!bash 1059 gst-launch-1.0 playbin uri=file:///media/open-media/big_buck_bunny_1080p_mp4v_ac3_5.1.avi audio-sink="alsasink device=sysdefault:CARD=sgtl5000audio" 1048 1060 }}} 1049 1061 … … 1058 1070 filesrc location=/media/open-media/tears_of_steel_1080p.webm do-timestamp=true typefind=true ! \ 1059 1071 matroskademux name=d \ 1060 d. ! queue ! ivorbisdec ! queue ! alsasink device=hw:1,0\1072 d. ! queue ! ivorbisdec ! queue ! alsasink \ 1061 1073 d. ! queue ! decodebin ! queue ! kmssink 1062 1074 }}}