mpeg-ts multifdsink

Krutskikh Ivan stein.hak at gmail.com
Fri Feb 26 06:37:46 UTC 2016


Hi all,

I want to serve mpeg-ts streams by http mainly for vlc clients in python. I
use gstreamer multifdsink for this. The main script for serving streams is

        if self.sink_type == 'multifdsink':
            pipe = os.pipe()
            client_id= pipe[1]
            self.sink.emit("add", client_id)
            new = os.fdopen(pipe[0],'r',0)
            try:
                while True:
                        data = new.read(1024)
                        wfile.write(data)
                        wfile.flush()

            except:
                print 'Except'
                self.sink.emit('remove',client_id)
                new.close()
                os.close(pipe[0])
                os.close(pipe[1])

So wfile should receive mpeg-ts stream. But when I use gstreamer pipeline

rtspsrc name=source latency=100  ! queue ! rtph264depay ! h264parse !
mpegtsmux name=mux ! multifdsink  name=sink

But on the clients I get a lot of errors and no video.

[00007f1f34c04468] ts demux error: libdvbpsi (PSI decoder): TS
discontinuity (received 15, expected 14) for PID 0
[00007f1f34c04468] ts demux error: libdvbpsi (PSI decoder): TS
discontinuity (received 15, expected 14) for PID 32
[00007f1f34c04468] ts demux error: libdvbpsi (PSI decoder): TS
discontinuity (received 13, expected 12) for PID 0
[00007f1f34c04468] ts demux error: libdvbpsi (PSI decoder): TS
discontinuity (received 13, expected 12) for PID 32
[00007f1f34c04468] ts demux error: libdvbpsi (PSI decoder): TS
discontinuity (received 11, expected 10) for PID 0
[00007f1f34c04468] ts demux error: libdvbpsi (PSI decoder): TS
discontinuity (received 11, expected 10) for PID 32

I've inspected the mpegtsmux element and found out that alignment property
can be the source of my issue. So for pipeline

rtspsrc name=source latency=100  ! queue ! rtph264depay ! h264parse !
mpegtsmux name=mux alignment=1024 ! multifdsink  name=sink

I can get video for the first client. I considered it a victory... Until
I've added a second player. Additional players just fail to show any video
without errors. They are receiving the data aright, but fail to output
video. With gstreamer client I get an eternal PREROLL.

It seams to be a time stamp issue and broken data stream due to read/write
dynamics on pipe. I was very frustrated until I tries mpegpsmux. Everything
is working for pipeline

rtspsrc name=source latency=100  ! queue ! rtph264depay ! h264parse !
mpegpsmux name=mux ! multifdsink  name=sink

But the timescale is all wrong and I get long time from initial connection
to the first frame (waiting for the key frame. multifdsink sync-method=1
does not fix the issue). I was wondering if I could either fix mpegtsmux or
the multifdsink dynamics for my app to work correctly.

Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160226/ae809c6c/attachment.html>


More information about the gstreamer-devel mailing list