Search code examples
video-streaminggstreamerrtspvideo-encoding

GStreamer transcode audio to AAC


I have a RTSP stream that I am re-streaming to HLS using GStreamer like so:

gst-launch-1.0 -v -e rtspsrc protocols=tcp location=rtsp://admin:1234@192.168.1.20:554/Streaming/channels/101  ! queue ! rtph264depay ! h264parse ! mpegtsmux  ! hlssink location="D:\\wamp\\www\\stream\\%06d.ts" playlist-location="D:\\wamp\\www\\stream\\play.m3u8" target-duration=5

The RTSP stream has video encoded with H.264 and raw audio (pcm_ulaw). My goal is to encode the audio into AAC so that the HLS supports it. What would be the correct sequence to place ! audioconvert ! voaacenc commands into the pipeline to accomplish this goal?


Solution

  • Basically you have another branch between the RTSP source and the MPEGTS muxer. Something like this:

    gst-launch-1.0 -v -e rtspsrc protocols=tcp location=rtsp://admin:1234@192.168.1.20:554/Streaming/channels/101 name=rtsp ! queue ! rtph264depay ! h264parse ! mpegtsmux name=mux ! hlssink location="D:\\wamp\\www\\stream\\%06d.ts" playlist-location="D:\\wamp\\www\\stream\\play.m3u8" target-duration=5 rtsp. ! queue ! rtppcmudepay ! mulawdec ! audioconvert ! audioresample ! voaacenc ! aacparse ! mux.