RTSP to HLS with GStreamer

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

RTSP to HLS with GStreamer

rudyryk
Hello everyone,

I'm trying to capture RTSP (H264 / AAC) stream with GStreamer and save it to HLS. The command I'm trying to use is:

gst-launch-1.0 -v -e rtspsrc protocols=tcp  location=rtsp://${AXIS_CAMERA_ADDR}/axis-media/media.amp ! queue ! rtph264depay ! h264parse ! mpegtsmux ! hlssink location="%06d.ts" target-duration=5

At first glance everything looks fine: *.ts files and playlist are generated. But *.ts are invalid - no player can play them (VLC, Safari, MPV). Interestingly, that the very first 000000.ts file can be played.

I also tried to perform same job with FFMPEG:

ffmpeg -rtsp_flags prefer_tcp \
    -i rtsp://${AXIS_CAMERA_ADDR}/axis-media/media.amp \
    -acodec copy -vcodec copy -f ssegment \
    -segment_list ffmpeg.m3u8 \
    -segment_list_flags +live \
    -segment_time 5 \
    ffmpeg%06d.ts

- and it's working as expected.

What is wrong with my GStreamer command? Also I noticed that GStreamer and FFMPEG produces different *.ts files headers.

GStreamer TS-header: 4740 003a a600 ffff ffff ffff ffff ffff
ffff ffff ffff ...

FFMPEG TS-header: 4740 1110 0042 f03b 0001 c100 00ff 01ff
0001 fc80 2a48 2801 0646 466d 7065 671f
5365 7373 696f 6e20 7374 7265 616d 6564
2077 6974 6820 4753 7472 6561 6d65 7251
f383 85ff ffff ffff ffff ffff ffff ffff
ffff ffff ffff ffff

- looks like FFMPEG produces headers with more info.

Any help would be appreciated.

Alexey
///

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

Re: RTSP to HLS with GStreamer

Arjen Veenhuizen
You are missing the SPS/PPS/VPS headers in all segments except for the first
one. Try to set config-internal on h264parse to -1 to make sure they are
injected every IDR frame.

Link:
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad/html/gst-plugins-bad-plugins-h264parse.html#GstH264Parse--config-interval



--
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: RTSP to HLS with GStreamer

rudyryk
Hello Arjen,
that was exactly the problem, setting `h264parse  config-internal=-1` worked
like a charm. Thank you!
Alexey
///



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