How to record DMIC audio in GStreamer (device name?)
This is a follow up question to the thread "how to enable DMIC" [url]https://devtalk.nvidia.com/default/topic/1029906/how-to-enable-dmic-and-get-data-to-alsa/#5239439[/url] Thanks to Jon's advice, I'm able to record the sound using DMIC (connecting thru the CSI expansion connector). [code]amixer -c tegrasndt186ref sset "ADMAIF2 Mux" DMIC3 arecord -D hw:tegrasndt186ref,1 -r 48000 -c2 -f S16_LE cap.wav[/code] Now, when I tried to take the approach further to record MPEG video, I got no sound in the output. [code]gst-launch-1.0 nvcamerasrc sensor-id=1 ! 'video/x-raw(memory:NVMM), width=2592, height=1944, framerate=15/1, format=I420' ! nvvidconv flip-method=0 ! 'video/x-raw, width=960, height=960, framerate=15/1, format=I420' ! omxh264enc ! mpegtsmux name=mux alsasrc 'device=hw:tegrasndt186ref' ! audioresample ! audio/x-raw,rate=48000,channels=2 ! queue ! voaacenc bitrate=32000 ! queue ! mux. mux. ! filesink location=1cam_mix_audio.mpg sync=true async=false qos=true[/code] There was a Warning about the GStreamer clock latency problem, but the video was still generated despite of it, but without sound. Perhaps the way to define the ALSA source device was incorrect? Or there could be a better way to use GST for video+audio recording? Please share your insight. Many thanks in advance.
This is a follow up question to the thread "how to enable DMIC" https://devtalk.nvidia.com/default/topic/1029906/how-to-enable-dmic-and-get-data-to-alsa/#5239439

Thanks to Jon's advice, I'm able to record the sound using DMIC (connecting thru the CSI expansion connector).
amixer -c tegrasndt186ref sset "ADMAIF2 Mux" DMIC3
arecord -D hw:tegrasndt186ref,1 -r 48000 -c2 -f S16_LE cap.wav


Now, when I tried to take the approach further to record MPEG video, I got no sound in the output.
gst-launch-1.0 nvcamerasrc sensor-id=1 ! 'video/x-raw(memory:NVMM), width=2592, height=1944, framerate=15/1, format=I420' ! nvvidconv flip-method=0 ! 'video/x-raw, width=960, height=960, framerate=15/1, format=I420' ! omxh264enc ! mpegtsmux name=mux alsasrc 'device=hw:tegrasndt186ref' ! audioresample ! audio/x-raw,rate=48000,channels=2 ! queue ! voaacenc bitrate=32000 ! queue ! mux. mux.  ! filesink location=1cam_mix_audio.mpg sync=true async=false qos=true

There was a Warning about the GStreamer clock latency problem, but the video was still generated despite of it, but without sound.

Perhaps the way to define the ALSA source device was incorrect? Or there could be a better way to use GST for video+audio recording?

Please share your insight.
Many thanks in advance.

#1
Posted 02/14/2018 05:31 PM   
Alright, we finally figured it out. First, need to run the amixer command as Jon suggested above. Then run the gst command by setting the device as "device=hw:tegrasndt186ref,1". Now, I'd also like to mention that "pactl load-module module-alsa-sink device=hw:0,7" (for audio display on HDMI, but actually not needed) might cause you trouble in recording audio with gst (though arecord works fine). Or having the load-module setting in /etc/pulse/default.pa.hdmi could block the audio operation for some reason as I strugggled. Frankly, I am not 100% for sure about the relations between them. Just report a fact that to wipe the slate clean with L4T 28.2 would work well with DMIC recording.
Answer Accepted by Original Poster
Alright, we finally figured it out. First, need to run the amixer command as Jon suggested above.
Then run the gst command by setting the device as "device=hw:tegrasndt186ref,1".

Now, I'd also like to mention that "pactl load-module module-alsa-sink device=hw:0,7" (for audio display on HDMI, but actually not needed) might cause you trouble in recording audio with gst (though arecord works fine). Or having the load-module setting in /etc/pulse/default.pa.hdmi could block the audio operation for some reason as I strugggled. Frankly, I am not 100% for sure about the relations between them. Just report a fact that to wipe the slate clean with L4T 28.2 would work well with DMIC recording.

#2
Posted 02/16/2018 08:45 PM   
Scroll To Top

Add Reply