Playbin recording with splitmuxsink
dgoiko
dario at dail-software.com
Tue Oct 23 22:13:54 UTC 2018
I'm kinda desperated, so any help will be wellcome now.
*My goal is to use gstreamer Python port and playbin to catch a live stream
audio and store it in LINEAR16 format .wav or FLAC in chunks of a prefixed
length. At this point, I'm happy if I have to record everything (even if has
to include video)* from the playbin and use another program to encode it
properly, I'm on a time rush. I'm trying to use splitmuxsink, however, it
doesnt accept wav. I tried mp4 just to get a working example, Playbin will
use //appsrc rather than urlsrc. The reason to use Playbin is that the
source media type can change a lot without prior notification, so I cant a
good coverage.
Using
gst-launch-1.0 -e audiotestsrc ! voaacenc ! aacparse ! mux.audio_0
splitmuxsink name=mux location=out_%d.mp4 max-size-time=10000000000
does the trick on command line with audio test source, so I tried:
def MainClass:
(...)
self.player = Gst.ElementFactory.make("playbin", "player")
# (set appsource, and other stuff in between)
tee_audio = self.createAudioTee(nombrebin="tee_audio")
fakesink = Gst.ElementFactory.make("fakesink", "fakesink")
self.player.set_property("video-sink", fakesink)
self.player.set_property("audio-sink", tee_audio)
(...)
def createAudioTee(self, nombrebin="audio-splitter"):
bin = Gst.Bin.new(nombrebin)
audiosink = Gst.parse_launch("voaacenc ! aacparse ! mux.audio_0
splitmuxsink name=mux location=out_%d.mp4 max-size-time=6000000000")
tee = Gst.ElementFactory.make("tee", "tee")
bin.add(tee)
# Prueba tees
pad = tee.get_static_pad("sink")
ghostpad = Gst.GhostPad.new("sink", pad)
bin.add_pad(ghostpad)
queuePlayer = Gst.ElementFactory.make("queue", "queue_player")
bin.add(queuePlayer)
tee.link(queuePlayer)
bin.add(audiosink)
queuePlayer.link(audiosink)
return bin
Using a simpler approach:
def MainClass:
(...)
self.player = Gst.ElementFactory.make("playbin", "player")
# (set appsource, and other stuff in between)
audiosink = Gst.parse_launch("voaacenc ! aacparse ! mux.audio_0
splitmuxsink name=mux location=out_%d.mp4 max-size-time=6000000000")
fakesink = Gst.ElementFactory.make("fakesink", "fakesink")
self.player.set_property("video-sink", fakesink)
self.player.set_property("audio-sink", audiosink)
(...)
Please I really need some advice.
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list