Pipeline generates empty ogg video
Noe Nieto
noe.nieto at uabc.edu.mx
Thu Nov 30 23:59:29 UTC 2017
I wrote a script in python to generate a OGG video from a set of PNG files.
======================= >8 =======================
#!/usr/bin/env python3
import os
import argparse
import gi; gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst
def pipeline(png_path, ogg_path):
"""
Builds the pipeline
png_path is a directory path to the images, like '/home/fulano/images/'
ogg_path is the file path for the video, including the name, like
'/home/fulano/video.ogg'
"""
pipeline = Gst.Pipeline.new("pipeline")
multifilesrc = Gst.ElementFactory.make('multifilesrc')
multifilesrc.set_properties(
location=os.path.join(png_path,'%03d.png'),
index=0,
caps=Gst.Caps.from_string("image/png,framerate=(fraction)12/1")
)
pipeline.add(multifilesrc)
pngdec = Gst.ElementFactory.make('pngdec')
pipeline.add(pngdec)
multifilesrc.link(pngdec)
videoconvert = Gst.ElementFactory.make('videoconvert', None)
pipeline.add(videoconvert)
pngdec.link(videoconvert)
videorate = Gst.ElementFactory.make('videorate', None)
pipeline.add(videorate)
videoconvert.link(videorate)
theoraenc = Gst.ElementFactory.make('theoraenc', None)
pipeline.add(theoraenc)
videorate.link(theoraenc)
oggmux = Gst.ElementFactory.make('oggmux', None)
pipeline.add(oggmux)
theoraenc.link(oggmux)
filesink = Gst.ElementFactory.make('filesink', None)
filesink.set_property('location', ogg_path)
pipeline.add(filesink)
oggmux.link(filesink)
return pipeline
if __name__=="__main__":
Gst.init(None)
pipe = pipeline('img', 'video.ogg')
pipe.set_state(Gst.State.PLAYING)
GObject.MainLoop()
======================= >8 =======================
When running the script I get the following information:
$ GST_DEBUG=3 ./ogg_tool
0:00:00.037269747 11891 0x55adbcd1ec00 FIXME default
gstutils.c:3902:gst_pad_create_stream_id_internal:<multifilesrc0:src>
Creating random stream-id, consider implementing a deterministic way of
creating a stream-id
0:00:00.037337706 11891 0x55adbcd1ec00 FIXME videodecoder
gstvideodecoder.c:928:gst_video_decoder_drain_out:<pngdec0> Sub-class
should implement drain()
0:00:00.039960129 11891 0x55adbcd1ec00 WARN videodecoder
gstvideodecoder.c:2438:gst_video_decoder_chain:<pngdec0> Received buffer
without a new-segment. Assuming timestamps start from 0.
0:00:00.040000881 11891 0x55adbcd1ec00 FIXME videodecoder
gstvideodecoder.c:928:gst_video_decoder_drain_out:<pngdec0> Sub-class
should implement drain()
0:00:00.047336315 11891 0x55adbcd1ec00 WARN videopool
gstvideopool.c:219:video_buffer_pool_set_config:<videobufferpool1> no caps
in config
$ ll
total 12
drwxrwxr-x. 2 nnieto nnieto 4096 nov 30 15:00 img
-rwxrwxr-x. 1 nnieto nnieto 1959 nov 30 15:50 ogg_tool
-rw-rw-r--. 1 nnieto nnieto 0 nov 30 15:55 video.ogg
video.ogg is 0 bytes long
I tried with gst-launch and it works:
$ gst-launch-1.0 multifilesrc location="img/%03d.png" index=0
caps="image/png,framerate=\(fraction\)12/1" ! pngdec ! videoconvert !
videorate ! theoraenc ! oggmux ! filesink location="video_gstlaunch.ogg"
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:01.932992495
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
$ ll
total 444
drwxrwxr-x. 2 nnieto nnieto 4096 nov 30 15:00 img
-rwxrwxr-x. 1 nnieto nnieto 1959 nov 30 15:50 ogg_tool
-rw-rw-r--. 1 nnieto nnieto 438882 nov 30 15:57 video_gstlaunch.ogg
-rw-rw-r--. 1 nnieto nnieto 0 nov 30 15:55 video.ogg
Any idea what I'm doing wrong?
--
Noe Nieto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20171130/daad7bf1/attachment.html>
More information about the gstreamer-devel
mailing list