hlssink does not seperate ts segments when not going through encoder

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

hlssink does not seperate ts segments when not going through encoder

GStreamer-devel mailing list
Hi,
I have a RTSP source that I want to ingest which is already in H264 format.
So all I want to do is just mux it and then save it as hls segments without
doing any decoding or encoding. However my pipeline saves the ts file as one
large file and does not follow the parameters specified in hlssink.

For example the following pipeline does not generate ts segments at 5
seconds. It generates one large ts file.
```
*gst-launch-1.0 rtspsrc
location="rtsp://user:pass@10.0.0.23:554/cam/realmonitor?channel=1&subtype=0"
! rtph264depay ! h264parse !  mpegtsmux ! hlssink playlist-length=5
max-files=10 target-duration=5 playlist-root="http://localhost/hls/"
playlist-location="stream0.m3u8" location="fragment%05d.ts"*
```
But if I add decoder and encoder it generates ts segments at 5 second
intervals as specified in hlssink params.
```
*gst-launch-1.0 rtspsrc
location="rtsp://user:pass@10.0.0.23:554/cam/realmonitor?channel=1&subtype=0"
! rtph264depay ! h264parse ! decodebin ! videoscale ! x264enc ! mpegtsmux !
hlssink playlist-length=5 max-files=10 target-duration=5
playlist-root="http://localhost/hls/" playlist-location="stream0.m3u8"
location="fragment%05d.ts"*
```
I dont want to add a decode and encode as I want to just save it as
H264encoded file which I am already getting from my source.

Please help!
Thanks a lot
Guru



--
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: hlssink does not seperate ts segments when not going through encoder

GStreamer-devel mailing list
I answered my own question. hlssink2 takes input from h264parse and does not
need mpegtsmux.
That helps a lot in passing through the buffers directly to hlssink2 without
encoding or decoding.



--
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: hlssink does not seperate ts segments when not going through encoder

GStreamer-devel mailing list
In reply to this post by GStreamer-devel mailing list
Le mardi 15 juin 2021 à 00:48 -0500, gugovind via gstreamer-devel a écrit :
> Hi,
> I have a RTSP source that I want to ingest which is already in H264 format.
> So all I want to do is just mux it and then save it as hls segments without
> doing any decoding or encoding. However my pipeline saves the ts file as one
> large file and does not follow the parameters specified in hlssink.

hlssink does not request keyframe. So you have to configure the GOP size (key-
int-max in x264enc element) in order to periodically produce IDR. Then the muxer
will mark the packet and hlssink will split on the closest next IDR.

If you want a tighter cut, use hlssink2, this one will deal with the muxer
(using splitmuxsink) and will request keyframes upstream, allowing for open GOP
at the encoder level.

>
> For example the following pipeline does not generate ts segments at 5
> seconds. It generates one large ts file.
> ```
> *gst-launch-1.0 rtspsrc
> location="rtsp://user:pass@10.0.0.23:554/cam/realmonitor?channel=1&subtype=0"
> ! rtph264depay ! h264parse !  mpegtsmux ! hlssink playlist-length=5
> max-files=10 target-duration=5 playlist-root="http://localhost/hls/"
> playlist-location="stream0.m3u8" location="fragment%05d.ts"*
> ```
> But if I add decoder and encoder it generates ts segments at 5 second
> intervals as specified in hlssink params.
> ```
> *gst-launch-1.0 rtspsrc
> location="rtsp://user:pass@10.0.0.23:554/cam/realmonitor?channel=1&subtype=0"
> ! rtph264depay ! h264parse ! decodebin ! videoscale ! x264enc ! mpegtsmux !
> hlssink playlist-length=5 max-files=10 target-duration=5
> playlist-root="http://localhost/hls/" playlist-location="stream0.m3u8"
> location="fragment%05d.ts"*
> ```
> I dont want to add a decode and encode as I want to just save it as
> H264encoded file which I am already getting from my source.
>
> Please help!
> Thanks a lot
> Guru
>
>
>
> --
> 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