Recording pipeline which works on CMD does not in Python
dgoiko
dario at dail-software.com
Mon Nov 26 10:56:57 UTC 2018
This is the bin that actually works to display video/audio on screen for
debugging purposes:
def _bin_stdout(nombrebin="bin-stdout", ignorar_video=False):
bin_autosink = Gst.Bin.new(nombrebin)
if not ignorar_video:
cola = Gst.ElementFactory.make("queue", "cola-video-debug")
bin_autosink.add(cola)
ghostpad_video = Gst.GhostPad.new("video-sink",
cola.get_static_pad("sink"))
bin_autosink.add_pad(ghostpad_video)
videosink = Gst.ElementFactory.make("autovideosink")
bin_autosink.add(videosink)
cola.link(videosink)
cola2 = Gst.ElementFactory.make("queue", "cola-audio-debug")
bin_autosink.add(cola2)
ghostpad_audio = Gst.GhostPad.new("audio-sink",
cola2.get_static_pad("sink"))
bin_autosink.add_pad(ghostpad_audio)
audiosink = Gst.ElementFactory.make("autoaudiosink")
bin_autosink.add(audiosink)
cola2.link(audiosink)
return bin_autosink
It's made in the same way than the others, so I guess the problem is within
BIN creation, and not with the envelope. It's very similar to the playbin
python
tutorial:https://brettviren.github.io/pygst-tutorial-org/pygst-tutorial.pdf,
just using uridecodebin (pads are added properly!)
THIS manually created bin doesnt work either:
def _bin_record_v2(path, nombrebin="bin-grabacion", formato="mkv",
intervalo=600):
bin_record = Gst.Bin.new(nombrebin)
nanosegundos = intervalo * 1000000000 # Convertir los segundos en
nanosegs
# Creamos y preparamos el splitmuxsink.
# TODO: Lo ideal seria streamearlo direco a otro Gstreamer con
recepción, y que este lo grabe con tranquilidad en el disco duro.
#splitmuxsink = Gst.ElementFactory.make("splitmuxsink",
"splitmuxsink-grabacion")
splitmuxsink = Gst.ElementFactory.make("filesink",
"splitmuxsink-grabacion")
#splitmuxsink.set_property('max-size-time', nanosegundos)
extension_file = "mkv"
encoder_video = Gst.ElementFactory.make("x264enc")
encoder_audio = Gst.ElementFactory.make("opusenc")
muxer = Gst.ElementFactory.make("matroskamux")
splitmuxsink.set_property('location', path + "." + extension_file)
# Añadir el encoder al bin
if encoder_video is not None:
cola_video = Gst.ElementFactory.make("queue",
"cola-video-grabacion")
bin_record.add(cola_video)
ghostpad_video = Gst.GhostPad.new("video-sink",
cola_video.get_static_pad("sink"))
bin_record.add_pad(ghostpad_video)
videoconvert = Gst.ElementFactory.make("videoconvert",
"converter-video-grabacion")
bin_record.add(videoconvert)
cola_video.link(videoconvert)
bin_record.add(encoder_video)
videoconvert.link(encoder_video)
if encoder_audio is not None:
cola_audio = Gst.ElementFactory.make("queue",
"cola-audio-grabacion")
bin_record.add(cola_audio)
ghostpad_audio = Gst.GhostPad.new("audio-sink",
cola_audio.get_static_pad("sink"))
bin_record.add_pad(ghostpad_audio)
audioconvert = Gst.ElementFactory.make("audioconvert",
"converter-audio-grabacion")
bin_record.add(audioconvert)
cola_audio.link(audioconvert)
bin_record.add(encoder_audio)
audioconvert.link(encoder_audio)
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list