record H264 stream use multifilesink

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

record H264 stream use multifilesink

Michelle Guo
Hi eveyone:
The pipeline I used like this:
gst-launch-1.0 rtpbin name=rtpbin latency=100 \
 udpsrc
caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96"
port=5000 ! queue ! rtpbin.recv_rtp_sink_0  rtpbin. ! rtph264depay \
! tee name=teevideo teevideo. ! queue ! vpudec ! overlaysink \
teevideo. ! queue !
"video/x-h264,width=1024,height=768,framerate=(fraction)25/1" ! matroskamux
name=mux mux. ! multifilesink location="/home/root/save%d.mkv" next-file=4
post-messages=TRUE max-files=300 max-file-size=10485760

I receive H264 stream from udpsrc, then play video and record H264 data into
several files.

The problem is described like this:
The pipeline works well, but, the files saved in the disk is not playable.
1. The first one save0.mkv can be played by VLC, but can not query duration,
so VLC can not fast forward and rewind.
2. The other files excepet the first one(save1.mkv, save2.mkv...) can not
play by VLC;

Can anybody give me some help?




--
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: record H264 stream use multifilesink

Vinod Kesti
Hi  Michelle Guo,

MKV file splitting not possible with multifilesink. Use splitmuxsink to
split the files.

Below should work for u..

gst-launch-1.0 rtpbin name=rtpbin latency=100 \
 udpsrc
caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96"
port=5000 ! queue ! rtpbin.recv_rtp_sink_0  rtpbin. ! rtph264depay \
! tee name=teevideo teevideo. ! queue ! vpudec ! overlaysink \
teevideo. ! queue !
"video/x-h264,width=1024,height=768,framerate=(fraction)25/1"  !
splitmuxsink location="/home/root/save%d.mkv" muxer=matroskamux
max-files=300 max-size-bytes=10485760



--
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: record H264 stream use multifilesink

Vinod Kesti
In reply to this post by Michelle Guo
Hi  Michelle Guo,

MKV file splitting not possible with multifilesink. Use splitmuxsink to
split the files.

Below should work for u..

gst-launch-1.0 rtpbin name=rtpbin latency=100 \
 udpsrc
caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96"
port=5000 ! queue ! rtpbin.recv_rtp_sink_0  rtpbin. ! rtph264depay \
! tee name=teevideo teevideo. ! queue ! vpudec ! overlaysink \
teevideo. ! queue !
"video/x-h264,width=1024,height=768,framerate=(fraction)25/1"  !
splitmuxsink location="/home/root/save%d.mkv" muxer=matroskamux
max-files=300 max-size-bytes=10485760



--
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: record H264 stream use multifilesink

Nicolas Dufresne-5
In reply to this post by Michelle Guo
Le mardi 10 octobre 2017 à 22:20 -0700, Michelle Guo a écrit :

> The pipeline I used like this:
> gst-launch-1.0 rtpbin name=rtpbin latency=100 \
>  udpsrc
> caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96"
> port=5000 ! queue ! rtpbin.recv_rtp_sink_0  rtpbin. ! rtph264depay \
> ! tee name=teevideo teevideo. ! queue ! vpudec ! overlaysink \
> teevideo. ! queue !
> "video/x-h264,width=1024,height=768,framerate=(fraction)25/1" ! matroskamux
> name=mux mux. ! multifilesink location="/home/root/save%d.mkv" next-file=4
> post-messages=TRUE max-files=300 max-file-size=10485760
>
> I receive H264 stream from udpsrc, then play video and record H264 data into
> several files.
>
> The problem is described like this:
> The pipeline works well, but, the files saved in the disk is not playable.
> 1. The first one save0.mkv can be played by VLC, but can not query duration,
> so VLC can not fast forward and rewind.
> 2. The other files excepet the first one(save1.mkv, save2.mkv...) can not
> play by VLC;
>
> Can anybody give me some help?
May I suggest you to have a look into splitmuxsink instead. This is a
muxer friendly stream splitter, that will let you split with fixed
duration. Each output file will be a valid stream. At least MKV and MOV
have been tested. To play the result in a gapless fashion with
GStreamer, you can use splitmuxsrc.

regards,
Nicolas

p.s. What you have in hand, is a "streamable" mkv, whithout an index.
These MKV are only playable from start to end, normal speed on most
player. In GStreamer, we implement binary search for this case, but
it's not very efficient, neither it is very precise. That's for the
first file, all the other file are randomly split, hence being detected
as corrupted files, unplayable by any player really.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: record H264 stream use multifilesink

Michelle Guo
In reply to this post by Vinod Kesti
Hi Vinod,

Thank you for you reply.

I use splitmuxsink, the files recorded are playable, but I encounted the new
problem.

In my pipeline, I use tee element to split the stream to two branches, one
is to play, the other is to record. If I use splitmuxsink in record branch,
both of these two branches can not work. However, if I remove play branch
and only have the record  branch, the files can be recorded successfully and
can be played by VLC.

So do you have any idea?
Thank you!

Michelle
 



--
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: record H264 stream use multifilesink

Michelle Guo
In reply to this post by Nicolas Dufresne-5
Hi Nicolas,

Thank you for you reply.

I use splitmuxsink, the files recorded are playable, but I encounted the new
problem.

In my pipeline, I use tee element to split the stream to two branches, one
is to play, the other is to record. If I use splitmuxsink in record branch,
both of these two branches can not work. However, if I remove play branch
and only have the record  branch, the files can be recorded successfully and
can be played by VLC.

So do you have any idea?
Thank you!

regards,
Michelle



--
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: record H264 stream use multifilesink

Nicolas Dufresne-5
In reply to this post by Michelle Guo
Le jeudi 12 octobre 2017 à 08:01 -0700, Michelle Guo a écrit :

> I use splitmuxsink, the files recorded are playable, but I encounted the new
> problem.
>
> In my pipeline, I use tee element to split the stream to two branches, one
> is to play, the other is to record. If I use splitmuxsink in record branch,
> both of these two branches can not work. However, if I remove play branch
> and only have the record  branch, the files can be recorded successfully and
> can be played by VLC.
>
> So do you have any idea?
Did you forget to add queues after the tee ?

regards,
Nicolas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: record H264 stream use multifilesink

Michelle Guo
Hi Nicolas,

I use queue after tee.
My pipeline is like this:

gst-launch-1.0 rtpbin name=rtpbin \
 udpsrc
caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96"
port=5000 ! queue ! rtpbin.recv_rtp_sink_0  rtpbin. ! rtph264depay ! tee
name=teevideo teevideo. ! queue ! vpudec ! overlaysink \
teevideo. ! queue !
"video/x-h264,width=1024,height=768,framerate=(fraction)25/1" ! splitmuxsink
location="/../data/save%d.mkv" max-files=300 max-size-time=10000000000
muxer=matroskamux &

These two branches can not work well at the same time.

regards,
Michelle



--
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: record H264 stream use multifilesink

Nicolas Dufresne-5
Le jeudi 12 octobre 2017 à 18:37 -0700, Michelle Guo a écrit :

> I use queue after tee.
> My pipeline is like this:
>
> gst-launch-1.0 rtpbin name=rtpbin \
>  udpsrc
> caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96"
> port=5000 ! queue ! rtpbin.recv_rtp_sink_0  rtpbin. ! rtph264depay ! tee
> name=teevideo teevideo. ! queue ! vpudec ! overlaysink \
> teevideo. ! queue !
> "video/x-h264,width=1024,height=768,framerate=(fraction)25/1" ! splitmuxsink
> location="/../data/save%d.mkv" max-files=300 max-size-time=10000000000
> muxer=matroskamux &
>
> These two branches can not work well at the same time.

Maybe make the overlaysink "async=0", this way GStreamer won't wait for
something to reach the multifilesink because it renders to overlaysink.

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

AW: record H264 stream use multifilesink

Thornton, Keith
In reply to this post by Nicolas Dufresne-5
Hi, we solved this problem by creating a bin with a queue and a filesink and adding this bin to the splitmuxsink

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:[hidden email]] Im Auftrag von Nicolas Dufresne
Gesendet: Donnerstag, 12. Oktober 2017 20:24
An: Discussion of the development of and with GStreamer <[hidden email]>
Betreff: Re: record H264 stream use multifilesink

Le jeudi 12 octobre 2017 à 08:01 -0700, Michelle Guo a écrit :

> I use splitmuxsink, the files recorded are playable, but I encounted
> the new problem.
>
> In my pipeline, I use tee element to split the stream to two branches,
> one is to play, the other is to record. If I use splitmuxsink in
> record branch, both of these two branches can not work. However, if I
> remove play branch and only have the record  branch, the files can be
> recorded successfully and can be played by VLC.
>
> So do you have any idea?

Did you forget to add queues after the tee ?

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

Re: record H264 stream use multifilesink

Michelle Guo
In reply to this post by Nicolas Dufresne-5
Hi Nicolas;

Thank you for your advice and explaination.

I use "async=false" after overlaysink, the play branch and the record branch
can both work well. When I play the MKV files using VLC, mosaic appears on
the screen, so why the video can not be played successfully?

regards;
Michelle



--
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: AW: record H264 stream use multifilesink

Michelle Guo
In reply to this post by Thornton, Keith
Hi Thornton,

Thank you for your reply.

My pipeline is shown below:
gst-launch-1.0 rtpbin name=rtpbin \
>  udpsrc
> caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96"
> port=5000 ! queue ! rtpbin.recv_rtp_sink_0  rtpbin. ! rtph264depay ! tee
> name=teevideo teevideo. ! queue ! vpudec ! overlaysink async=false \
> teevideo. ! queue !
> "video/x-h264,width=1024,height=768,framerate=(fraction)25/1" !
> splitmuxsink
> location="/../data/save%d.mkv" max-files=300 max-size-time=10000000000
> muxer=matroskamux &

The play branch and record branch can both work well. However, when I play
MKV video using VLC, mosaic appears on the screen, so the video can not play
successfully.

Since I am a new learner on Gstreamer, could you explain you solution in
details?

Thank you

regards,
Michelle



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