RTSP to HLS with GStreamer

Alexey Kinev alexey.rudy at gmail.com
Tue Jul 17 14:06:13 UTC 2018


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
///
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20180717/74750103/attachment.html>


More information about the gstreamer-devel mailing list