Combine audio and video in pipeline

I’m streaming my computer’s desktop through HLS to local host with Gstreamer, and everything is working fine. However, I am not able to add audio to the pipeline, how would I incorporate audio and h264 video in a single hlssink pipeline?

The topic has steps for setting up HLS:
HLS Live streaming - #4 by DaneLLL

For adding audio, please try

$ gst-launch-1.0 videotestsrc num-buffers=300 is-live=1 ! 'video/x-raw,width=1280,height=720' ! x264enc ! mpegtsmux name=mux ! hlssink audiotestsrc num-buffers=500 is-live=1 ! voaacenc ! mux.

Thank you Dane, it works great with audiotestsrc. However, when I try to use to alsasrc, there’s no audio on the local host I’m streaming to. Btw, I have no sound dongle installed. Could you help me with this issue real quick?

You may check if the audio source is good.

  1. Execute $ arecord -l to list the devices
  2. Run the command by configuring correct device: $ gst-launch-1.0 alsasrc num-buffers=1000 device=“hw:2,0” ! voaacenc ! queue ! qtmux name=mux ! filesink location=a.mp4
  3. Check if a.mp4 is good

The command does not work for whatever reason, and the mp4 file has no audio.

Please make sure you set device=“hw:2,0” correctly. 2,0 would need to fit your audio device. You may check if the audio source is valid in running arecord command.

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