How to add empty audio track to video stream

Hi all,
I’m developing my application and I would like to add an empty audio track to my stream.

I use python to push frames, encoded with gstreamer, to my rtmp server using this code:

send_gst = "appsrc ! videoconvert ! omxh264enc bitrate=2000000 preset-level=0 ! video/x-h264 ! h264parse ! queue ! flvmux streamable=true ! rtmpsink location="+rtmpUrl
out_send = cv2.VideoWriter(send_gst, 0, int(stream_fps), (opt.width, opt.height))

any suggestion about how to create an empty audio track encoded with video track in h264?

Thanks

Hi,
Not sure how to do it in OpenCV code. In gstreamer pipeline, you can utilize audiotestsrc to generate silent sound track:

$ gst-launch-1.0 videotestsrc num-buffers=300 ! omxh264enc ! queue ! mux. <b>audiotestsrc wave=4</b> num-buffers=1000 ! voaacenc ! queue ! qtmux name=mux ! filesink location=a.mp4

Your code works but I need to add audio to frames read from a RTSP source.

So for anyone interested, this is the code:

send_gst = "appsrc ! videoconvert ! omxh264enc bitrate=2000000 preset-level=0 ! video/x-h264 ! h264parse ! mux. audiotestsrc wave=silence freq=200 ! voaacenc ! aacparse ! queue ! mux. flvmux streamable=true name=mux ! rtmpsink location="+rtmpUrl

Thanks for the sharing.

hello,my problem is similiar with u. i use ffmpeg push a rtsp streaming from a pipe.
command = [‘ffmpeg’,
‘-y’,
‘-f’, ‘rawvideo’,
‘-vcodec’, ‘rawvideo’,
‘-pix_fmt’, ‘bgr24’,
‘-s’, sizeStr,
‘-r’, ‘25’,
‘-i’, ‘-’,
‘-c:v’, ‘libx264’,
‘-pix_fmt’, ‘yuv420p’,
‘-preset’, ‘ultrafast’,
‘-tune:v’, ‘zerolatency’,
‘-f’, ‘flv’,
server_rtsp]
i don’t know how to receive this rtsp streaming and republish it by gst rtsp server. can u give me some suggestion? i try your commond by changing rtmpsink to rtspclientsink.But it don’t work.
“appsrc ! videoconvert ! omxh264enc bitrate=2000000 preset-level=0 ! video/x-h264 ! h264parse ! mux. audiotestsrc wave=silence freq=200 ! voaacenc ! aacparse ! queue ! mux. flvmux streamable=true name=mux ! rtspclientsink location=”+rtspUrl

Not sure about that, cause I haven’t tried, but have you altro tries these parameters?

rtspclientsink location=server_url user=user user-pw=password protocols=tcp async-handling=false

thank u, but it don’t work too