GStreamer record video with audio on Raspberry Pi

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GStreamer record video with audio on Raspberry Pi

hongyuanlu
This post was updated on .
The recent work I am doing is to find a way to record video with audio using GStreamer on RPi. The following command worked with filesink using GStreamer 1.4, but after I update to 1.10.5 to use splitmuxsink, the following command does not work with splitmuxsink any more and throws error.

<code>
    pi@raspberrypi:~ $ sudo raspivid -t 9999999 -h 720 -w 1280 -fps 60
    -rot 180 -b 2000000 -o - | gst-launch-1.0 -ve fdsrc num-buffers=-1 !
     video/x-h264,width=1280,height=720,framerate=60/1 ! h264parse ! queue
     ! mpegtsmux0. alsasrc device=hw:1,0 ! audioconvert ! avenc_aac !
    aacparse ! queue ! mpegtsmux0. mpegtsmux ! splitmuxsink location=video%02d.mp4
    max-size-time=10000000000 max-size-bytes=10000000 muxer=mpegtsmux
    WARNING: erroneous pipeline: No sink-element named "(null)" - omitting link
<\code>

I am looking for any alternatives or changes to make this work, and hopefully it could bring others merits since Raspbian default Gstreamer is 1.4 and if you run those scripts online to install new Gstreamer, you might probably encounter the same problem if you want to use splitmuxsink on RPi.

Thank you in advance.
Reply | Threaded
Open this post in threaded view
|

Re: GStreamer record video with audio on Raspberry Pi

Gst-Geek
Ne need to add muxer in the pipline. Splitmuxsink will create/add muxer for given muxer object to splitmuxsink. Below pipeline should work for you.

raspivid -t 9999999 -h 720 -w 1280 -fps 60
    -rot 180 -b 2000000 -o - | gst-launch-1.0 -ve fdsrc num-buffers=-1 !
     video/x-h264,width=1280,height=720,framerate=60/1 ! h264parse ! queue
     ! smux.video alsasrc device=hw:1,0 ! audioconvert ! avenc_aac !
    aacparse ! queue ! smux.audio_0 ! splitmuxsink name=smux location=video%02d.mp4
    max-size-time=10000000000 max-size-bytes=10000000 muxer=mpegtsmux