Page 1 of 1

GStreamer: record camera stream and sound in one container

Posted: Sat Mar 21, 2020 5:10 am
by alnaseh
Hi,

I'm trying to get a pipeline that record the camera output and sound into one container. i tried many pipelines with success. the sound module is the one here:
https://www.raspiaudio.com/raspiaudio-aiy

following are some failed pipelines i got it from googling:

Code: Select all

raspivid -n -ih -fl -t 0 -stm -g 30 -ex sports -w 640 -h 480 -fps 30 -cd H264 -pf high -o - | gst-launch-1.0 -v fdsrc ! h264parse ! queue ! smux. alsasrc ! audio/x-raw,channels=1 ! opusenc ! opusparse ! queue ! smux. mpegtsmux name=smux ! queue ! filesink location=video.ts
it generates a file without sound. the same if i use avenc_aac instead of opusenc.

trying to use splitmuxsink:

Code: Select all

raspivid -n -ih -fl -t 0 -stm -g 30 -ex sports -w 640 -h 480 -fps 30 -cd H264 -pf high -o - | gst-launch-1.0 -v fdsrc ! h264parse ! queue ! smux.video alsasrc ! audio/x-raw,channels=1 ! avenc_aac ! aacparse ! queue ! smux.audio_0 ! splitmuxsink name=smux location=video%02d.ts max-size-time=10000000000 max-size-bytes=10000000 muxer=mpegtsmux 
WARNING: erroneous pipeline: syntax error

if i tried only audio stream, it works fine e.g.

Code: Select all

gst-launch-1.0 alsasrc ! audio/x-raw,channels=1 ! opusenc frame-size=2.5 audio-type=voice bitrate=32000 bitrate-type=vbr ! .audio_%u splitmuxsink location=qqqqaaa%03d.ogg max-size-time=5000000000 muxer=oggmux

OR

gst-launch-1.0 alsasrc ! audio/x-raw,channels=1 ! opusenc ! oggmux ! filesink location=dd.ogg
now my issue with recording both of them at the same time. any support is appreciate