Changes between Version 4 and Version 5 of gstreamer


Ignore:
Timestamp:
02/26/2020 09:12:26 PM (5 years ago)
Author:
Tim Harvey
Comment:

minimize use of hw:<card>,<device> for better clarity

Legend:

Unmodified
Added
Removed
Modified
  • gstreamer

    v4 v5  
    739739The 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.
    740740
    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,y notation (ie {{{hw:0,0}}} for first device, first subdevice)
     741The 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)
    742742
    743743If not specified via the {{{device}}} property, the device used for alsasrc and alsasink will depend on {{{/etc/asound.conf}}} and/or {{{~/.asoundrc}}}.
     
    755755
    756756Examples:
    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
     759gst-launch-1.0 audiotestsrc ! \
     760  alsasink device="sysdefault:CARD=sgtl5000audio"
    760761}}}
    761762
     
    768769
    769770Examples:
    770  * Capture 32kHz stereo 16bit audio from the 'hw:0,0' device and 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
     773gst-launch-1.0 alsasrc device="sysdefault:CARD=sgtl5000audio" ! "audio/x-raw,rate=32000,channels=2,depth=16" ! \
    773774  audioconvert ! avimux ! filesink location=./audio.avi
    774775}}}
     
    782783
    783784Examples:
    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
     787gst-launch-1.0 audiotestsrc ! \
     788  alsasink device="sysdefault:CARD=sgtl5000audio"
    787789}}}
    788790
     
    805807
    806808Examples:
    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.mp3
     809 * 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
     811gst-launch-1.0 alsasrc device="sysdefault:CARD=sgtl5000audio" ! audioconvert ! lamemp3enc ! filesink location=file.mp3
    810812}}}
    811813
     
    843845 * specify the sample-rate (32kHz), channels (2:stereo), and bit depth (16bit) and capture to an AVI file:
    844846{{{#!bash
    845 gst-launch-1.0 alsasrc device="hw:0,0" ! "audio/x-raw,rate=32000,channels=2,depth=16" ! \
     847gst-launch-1.0 audiotestsrc ! "audio/x-raw,rate=32000,channels=2,depth=16" ! \
    846848  audioconvert ! avimux ! filesink location=./audio.avi
    847849}}}
     
    857859}}}
    858860
    859 To send audio from the sgtl5000 (analog input) to the imxhdmisoc (HDMI output):
     861To 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
     864card=$(cat /proc/asound/cards | grep sgtl5000 | head -1 | awk '{print $1}')
     865amixer -c $card sset "Capture Mux" LINE_IN
     866amixer -c $card sset "Capture" 8 # 0-15
     867}}}
    860868 * using device/function numbers (ie from {{{aplay -l}}}):
    861869{{{#!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}}}):
     870gst-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}}}):
    865875{{{#!bash
    866876gst-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
    869881
    870882To send audio from the tda1997x HDMI receiver (digital input) to the imxhdmisoc (digital output):
     
    10431055}}}
    10441056
    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"
     1057The 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
     1059gst-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"
    10481060}}}
    10491061
     
    10581070  filesrc location=/media/open-media/tears_of_steel_1080p.webm do-timestamp=true typefind=true ! \
    10591071  matroskademux name=d \
    1060   d. ! queue ! ivorbisdec ! queue ! alsasink device=hw:1,0 \
     1072  d. ! queue ! ivorbisdec ! queue ! alsasink \
    10611073  d. ! queue ! decodebin  ! queue ! kmssink
    10621074}}}