Recording USB video/audio with playback through HDMI

Hi,

I have created the below pipeline to capture and save 2 1080p streams with separate audio in each stream with preview.

gst-launch-1.0 -e v4l2src device=/dev/video0 ! tee name=t1 t1. ! queue ! video/x-raw, width=1920, height=1080, framerate=60/1 ! videorate ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! queue ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mux. alsasrc device=“hw:2,0” ! queue ! audio/x-raw ! queue ! audioresample ! “audio/x-raw,rate=44100” ! queue ! voaacenc ! queue ! mp4mux name=mux ! filesink location=feed1mp1080HW1.mp4 v4l2src device=/dev/video1 ! tee name=t2 t2. ! queue ! video/x-raw, width=1920, height=1080, framerate=60/1 ! videorate ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! queue ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mux2. alsasrc device=“hw:3,0” ! queue ! audio/x-raw ! queue ! audioresample ! “audio/x-raw,rate=44100” ! queue ! voaacenc ! queue ! mp4mux name=mux2 ! filesink location=feed2mp1080HW1.mp4 videotestsrc pattern=black ! video/x-raw,width=320,height=240 ! nvvidconv ! queue ! comp.sink_0 t1. ! queue ! video/x-raw, width=1920, height=1080, framerate=60/1 ! videorate ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! queue ! “video/x-raw(memory:NVMM),width=960,height=540,format=NV12” ! queue ! comp.sink_1 t2. ! queue ! video/x-raw, width=1920, height=1080, framerate=60/1 ! videorate ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! queue ! ‘video/x-raw(memory:NVMM),width=960,height=540,format=NV12’ ! queue ! comp.sink_2 nvcompositor name=comp sink_0::width=1920 sink_0::height=1080 sink_1::xpos=0 sink_1::ypos=270 sink_1::width=960 sink_1::height=540 sink_2::xpos=960 sink_2::ypos=270 sink_2::width=960 sink_2::height=540 ! nvvidconv ! nvoverlaysink

In my application I have to do the following simultaneously

  1. Record 2 1080p streams with audio in each stream - done
  2. Preview the 2 streams -done
  3. Mix and play the audio streams through HDMI - not done

My requirement is to incoperate audio playback through HDMI to the above pipeline. What gstreamer method can be used here without affecting the recording ?

I was able to find the HDMI playback device via aplay -l

Thanks in advance

Hi,
You can use alsasink plugin. Please refer to this pipeline:
Audio playback while recording - #3 by DaneLLL

Hi @DaneLLL ,

Is it ok to playback from the files being recorded? Here there are 2 files with 2 separate audio tracks. Will there be sync issues? Since I have to do recording/previewing/playback_audio all at the same time.

Here I have 2 USB audio streams which I have to save in 2 separate files. The playback of these USB sources’ audio has to be played through HDMI mixing them

Thank you

Hi @DaneLLL ,

I was able to find a solution just had to add a tee element to the audio source and add the playback part at the end of the pipeline.

Thank You

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.