help with clock synchronization on filesrc/multifilesrc

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

help with clock synchronization on filesrc/multifilesrc

GStreamer-devel mailing list
I'm trying to play a MPEG-TS file (with H264 encoded video) like this:

"multifilesrc loop=1 location=/home/msb/test.ts
caps=video/mpegts,framerate=30/1 ! "
"tsdemux : h264parse ! avdec_h264 ! video/x-raw,framerate=30/1 !
videoconvert ! ximagesink sync=0"

However, instead of playing at 30fps, the video is playing as fast as it can
('sync=0').
If I change to 'sync=1' in the 'ximagesink' it plays as expected.

Unfortunately it is not an option for me to use 'sync=1', since my real
pipeline is a lot more complex and this is just a simple way to show the
issue.

I would like to be able to get the same behavior I get with a live source,
fx:

"videotestsrc is-live=true ! video/x-raw,framerate=30/1,format=NV12 !
timeoverlay ! videoconvert ! ximagesink sync=0 "

So far I can make it work if I add a fakesink with 'sync=1' to the pipeline,
but that looks a bit too much like a hack:

"multifilesrc loop=1 location=/home/msb/test.ts
caps=video/mpegts,framerate=30/1 ! "
"tsdemux : h264parse ! avdec_h264 ! video/x-raw,framerate=30/1 ! tee name=t
! queue ! videoconvert ! ximagesink sync=0 t. ! queue ! fakesink sync=1"

Isn't there a better way to make 'multifilesrc' or 'filesrc' behave like a
livesrc?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: help with clock synchronization on filesrc/multifilesrc

GStreamer-devel mailing list
Also, the 'fakesink' hack doesn't work on the encoded data:

"multifilesrc loop=1 location=/home/msb/test.ts
caps=video/mpegts,framerate=30/1 ! tee name=t ! queue ! "
                 "tsdemux : h264parse ! avdec_h264 !
video/x-raw,framerate=30/1 ! videoconvert ! ximagesink sync=0 "
                 "t. ! queue ! fakesink sync=1 "

This also plays at max speed



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: help with clock synchronization on filesrc/multifilesrc

GStreamer-devel mailing list
Using an 'identity' with 'sync=1' on the decoded data works the same as
having a 'fakesink', it regulates the fps.

"multifilesrc loop=1 location=/home/msb/test.ts
caps=video/mpegts,framerate=30/1 ! "
"tsdemux : h264parse ! avdec_h264 ! video/x-raw,framerate=30/1 ! identity
sync=true ! videoconvert ! ximagesink sync=0 "

However it doesn't work if placed before the 'tsdemux'.

So I guess the problem is also the demux?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: help with clock synchronization on filesrc/multifilesrc

GStreamer-devel mailing list
In reply to this post by GStreamer-devel mailing list


Le mer. 26 mai 2021 04 h 45, Marianna S. Buschle via gstreamer-devel <[hidden email]> a écrit :
I'm trying to play a MPEG-TS file (with H264 encoded video) like this:

"multifilesrc loop=1 location=/home/msb/test.ts
caps=video/mpegts,framerate=30/1 ! "
"tsdemux : h264parse ! avdec_h264 ! video/x-raw,framerate=30/1 !
videoconvert ! ximagesink sync=0"

However, instead of playing at 30fps, the video is playing as fast as it can
('sync=0').
If I change to 'sync=1' in the 'ximagesink' it plays as expected.

Unfortunately it is not an option for me to use 'sync=1', since my real
pipeline is a lot more complex and this is just a simple way to show the
issue.

I would like to be able to get the same behavior I get with a live source,
fx:

"videotestsrc is-live=true ! video/x-raw,framerate=30/1,format=NV12 !
timeoverlay ! videoconvert ! ximagesink sync=0 "

So far I can make it work if I add a fakesink with 'sync=1' to the pipeline,
but that looks a bit too much like a hack:

"multifilesrc loop=1 location=/home/msb/test.ts
caps=video/mpegts,framerate=30/1 ! "
"tsdemux : h264parse ! avdec_h264 ! video/x-raw,framerate=30/1 ! tee name=t
! queue ! videoconvert ! ximagesink sync=0 t. ! queue ! fakesink sync=1"

Isn't there a better way to make 'multifilesrc' or 'filesrc' behave like a
livesrc?

You can use mpegtsparse, there is parameters you have to set (smoothing delays and add-timestamp, something near that) and the use identity sync=1

multifilesrc ! mpegtsparse add-timestamps=1 smooth... ! identity sync=1 ! ....




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: help with clock synchronization on filesrc/multifilesrc

GStreamer-devel mailing list
Doesn't seem to work properly

"multifilesrc loop=1 location=/home/msb/test.ts
caps=video/mpegts,framerate=30/1 ! tsparse set-timestamps=1
smoothing-latency=1000 ! identity sync=true ! "
"tsdemux : h264parse ! avdec_h264 ! videoconvert ! ximagesink sync=0 "

Plays in a very strange way: stalls and skips frames.

Also, I have been strongly advised against the 'tsparse':
http://gstreamer-devel.966125.n4.nabble.com/seek-on-filesrc-with-TS-file-tp4697440p4697464.html

It screws up duration queries and seeking...

My best results so far are:

"multifilesrc loop=1 location=/home/msb/test.ts
caps=video/mpegts,framerate=30/1 ! "
"tsdemux : identity sync=true ! h264parse ! avdec_h264 ! videoconvert !
ximagesink sync=0 "

which seems to do the necessary, but I would also like to be able to get the
same behavior before the tsdemux.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel