Reputation: 507
I try to save RTSP h.264 stream to HLS mp4 files:
gst-launch-1.0 rtspsrc location="rtsp://....." ! rtph264depay ! h264parse ! matroskamux ! hlssink max-files=0 playlist-length=0 location="/home/user/ch%05d.mp4" playlist-location="/home/user/list.m3u8" target-duration=15
As a result - there is only one file ch00000.mp4, which includes the whole videostream (3min instead of 15sec in "target-duration").
If I save to mpegtsmux / ts files - all is ok for the same command.
What is wrong? Thanks in advance.
Upvotes: 4
Views: 5969
Reputation: 1
You can explore the dashmp4mux element, a newer addition to GStreamer found in its latest versions. This element facilitates the conversion of standard MP4 files into fragmented MP4 (fMP4) format. The fMP4 format is crucial for streaming applications as it breaks down the video content into smaller, more manageable segments, thus enabling smoother streaming experiences and enhancing support for adaptive bitrate technologies
Upvotes: 0
Reputation: 49
Do you have to use gstreamer? Otherwise I believe this ffmpeg command does what you want.
ffmpeg -i rtsp://... -c copy -hls_list_size 10 -hls_segment_type fmp4 output.m3u8
Upvotes: 1
Reputation: 7383
HLS consists of MPEG transport stream segments. So first: matroskamux
does not make sense here. You will need mpegtsmux
instead. To indicate what it really is you normally would name the files with a .ts
extension. It may still work for GStreamer as it is just a file name - players may reject playing it because the expect another sort of file format.
E.g.
gst-launch-1.0 rtspsrc location="rtsp://....." ! rtph264depay ! h264parse ! \
mpegtsmux ! hlssink max-files=0 playlist-length=0 location="/home/user/ch%05d.ts" \
playlist-location="/home/user/list.m3u8" target-duration=15
Upvotes: 5