Commit Graph

134 Commits

Author SHA1 Message Date
aler9
0c6385f0e8 hls source: support MPEG-TS streams with metadata tracks 2022-12-27 12:00:00 +00:00
Alessandro Ros
c778c049ce
switch to gortsplib v2 (#1301)
Fixes #1103

gortsplib/v2 supports multiple formats inside a single track (media). This allows to apply the resizing algorithm to single formats inside medias.

For instance, if a media contains a a proprietary format and an H264 format, and the latter has oversized packets, they can now be resized.
2022-12-13 20:54:17 +01:00
Alessandro Ros
e605727c78
produce same absolute time in RTSP and HLS (#1249)
* add a NTP timestamp to each data unit
* use that NTP timestamp in all protocols
2022-11-28 09:00:05 +01:00
aler9
282d155a4f update gortsplib 2022-11-15 23:47:12 +01:00
Alessandro Ros
0943b269ab
Decode streams once and only when needed (#1218)
* split data into specialized structs

* move MPEG4-audio decoding into streamTrack

* restore video/audio synchronization in HLS muxer and RTMP server

* log decode errors

* move H264 decoding and re-encoding here from gortsplib

* add tests

* update gortsplib
2022-11-02 20:52:12 +01:00
aler9
a4363dfaa3 hls: use fields for each flag values 2022-11-02 10:24:58 +01:00
aler9
cc0d8f7dab hls client: ignore data from unrecognized tracks in MPEG-TS segments 2022-10-26 21:53:33 +02:00
aler9
0daf8a17b7 hls client: skip packets received before the 1st packet of the leading
track, for MPEG-TS segments too
2022-10-26 21:50:17 +02:00
aler9
7981522bf6 hls client: skip packets received before the 1st packet of the leading
track; make sure that the initial DTS is zero
2022-10-26 17:39:32 +02:00
aler9
96433e753b fix tests 2022-10-25 14:06:09 +02:00
aler9
dfef383311 hls muxer: fix compatibility with grafov/m3u8 2022-10-24 16:13:37 +02:00
aler9
841bbec959 hls client: allow segments with up to 200 parts 2022-10-24 16:10:13 +02:00
Alessandro Ros
e5ab731d14
Improve HLS client (#1179)
* hls source: support fMP4s video streams

* hls source: start reading live streams from (end of playlist - starting point)

* hls client: wait processing of current fMP4 segment before downloading another one

* hls client: support fmp4 trun boxes with default sample duration, flags and size

* hls client: merge fmp4 init file reader and writer

* hls client: merge fmp4 part reader and writer

* hls client: improve precision of go <-> mp4 time conversion

* hls client: fix esds generation in go-mp4

* hls client: support audio in separate playlist

* hls client: support an arbitrary number of tracks in fmp4 init files

* hls client: support EXT-X-BYTERANGE

* hls client: support fmp4 segments with multiple parts at once

* hls client: support an arbitrary number of mpeg-ts tracks

* hls client: synchronize tracks around a primary track

* update go-mp4

* hls: synchronize track reproduction around a leading one

* hls client: reset stream if playback is too late

* hls client: add limit on DTS-RTC difference

* hls client: support again streams that don't provide codecs in master playlist
2022-10-23 14:04:33 +02:00
aler9
847ca6c89d hls muxer: fix regression introduced in b5dd658 2022-10-20 10:20:38 +02:00
aler9
680b348902 hls muxer: change m3u8 Content-Type to application/x-mpegURL 2022-10-18 11:02:52 +02:00
aler9
31d9429c18 hls source: refactor client 2022-10-09 12:56:48 +02:00
aler9
3b8e2f0211 hls source: support streams that start with negative DTS 2022-10-09 12:16:29 +02:00
aler9
3e9d19e5e3 hls: split fmp4/mpegts muxer tests 2022-09-17 22:21:16 +02:00
aler9
f1fb00b80f update golangci-lint 2022-09-17 21:19:45 +02:00
aler9
42b6e1f922 hls: use segment IDs as segment names
when hlsVariant is mpegts, this prevents conflicts that were previously
caused by the fact that the timestamp was used as segment name.
2022-08-27 16:21:24 +02:00
aler9
4c0833664d hls: fix blocking playlists
when hlsVariant is lowLatency and hlsSegmentCount is not 7, segment IDs
where assigned erroneously.
2022-08-27 16:15:47 +02:00
aler9
a018f214bc hls: add fmp4 tests 2022-08-27 16:04:38 +02:00
aler9
43dc57716b speed up tests 2022-08-27 15:46:43 +02:00
aler9
71f927ecd5 hls: allow setting current time when writing packets 2022-08-27 15:43:25 +02:00
aler9
5ad2ea8924 hls: move mpegts writer into dedicated folder 2022-08-27 12:41:30 +02:00
aler9
b5dd658d29 fmp4: move avcc encoding into writer 2022-08-27 12:11:00 +02:00
aler9
f952ff25f6 remove useless append() 2022-08-14 13:14:08 +02:00
aler9
e146df9ed7 hls: move fMP4 generator into dedicated folder 2022-08-14 12:44:01 +02:00
aler9
a8822b9f15 hls muxer / source: route AAC units singularly
This aligns the HLS implementation with the rest of the server. In case
of HLS/MPEGTS, the server now generates an ADTS packet for each AU,
without grouping multiple AUs into a single ADTS packet.
2022-08-14 12:19:11 +02:00
aler9
af7a815f83 update gortsplib 2022-08-05 23:50:45 +02:00
aler9
4c2a4f9642 hls muxer: create only 7 initial gaps (#999)
instead of filling the entire segment list.
2022-07-05 23:52:11 +02:00
aler9
08ddc9f83d update gortsplib 2022-06-27 17:52:20 +02:00
aler9
41b08c9f50 update gortsplib 2022-06-24 17:00:28 +02:00
aler9
ec4c40b222 update gortsplib 2022-06-23 13:54:48 +02:00
aler9
3e5f62156d fix DTS error in case of H264 NALUs without POC 2022-06-15 10:50:59 +02:00
aler9
750743d1ed move mp4 writer into dedicated folder 2022-06-04 16:51:57 +02:00
aler9
cd93b70612 hls muxer: do not use EXT-X-GAP with fmp4 variant 2022-06-03 13:34:11 +02:00
aler9
2cd71785f4 hls muxer: cache init.mp4 content 2022-06-03 13:29:26 +02:00
aler9
9bd8b2cfb6 rtmp server, hls muxer: fix DTS in case of B-frames and remove PTS-DTS offset 2022-06-03 11:31:39 +02:00
aler9
4073013f68 hls muxer: stop normalizing PTS 2022-06-02 22:37:46 +02:00
aler9
acd788d632 update gortsplib 2022-06-02 20:58:48 +02:00
aler9
73a9444c8d hls muxer: remove useless pps storage 2022-06-02 13:40:30 +02:00
aler9
2ed1aa3d11 hls muxer, rtmp server: extract DTS from samples 2022-06-02 12:42:59 +02:00
aler9
e7f88bc12f move DTS extractor into gortsplib 2022-06-02 11:55:12 +02:00
aler9
93975552ac hls muxer: improve performance, decrease memory consumption 2022-06-01 10:13:37 +02:00
Alessandro Ros
e115983296
Implement Low-Latency HLS (#938)
* add hlsVariant parameter

* hls: split muxer into variants

* hls: implement fmp4 segments

* hls muxer: implement low latency mode

* hls muxer: support audio with fmp4 mode

* hls muxer: rewrite file router

* hls muxer: implement preload hint

* hls muxer: add various error codes

* hls muxer: use explicit flags

* hls muxer: fix error in aac pts

* hls muxer: fix sudden freezes with video+audio

* hls muxer: skip empty parts

* hls muxer: fix video FPS

* hls muxer: add parameter hlsPartDuration

* hls muxer: refactor fmp4 muxer

* hls muxer: fix CAN-SKIP-UNTIL

* hls muxer: refactor code

* hls muxer: show only parts of last 2 segments

* hls muxer: implementa playlist delta updates

* hls muxer: change playlist content type

* hls muxer: improve video dts precision

* hls muxer: fix video sample flags

* hls muxer: improve iphone audio support

* hls muxer: improve mp4 timestamp precision

* hls muxer: add offset between pts and dts

* hls muxer: close muxer in case of error

* hls muxer: stop logging requests with the info level

* hls muxer: rename entry into sample

* hls muxer: compensate video dts error over time

* hls muxer: change default segment count

* hls muxer: add starting gap

* hls muxer: set default part duration to 200ms

* hls muxer: fix audio-only streams on ios

* hls muxer: add playsinline attribute to video tag of default web page

* hls muxer: keep mpegts as the default hls variant

* hls muxer: implement encryption

* hls muxer: rewrite dts estimation

* hls muxer: improve DTS precision

* hls muxer: use right SPS/PPS for each sample

* hls muxer: adjust part duration dynamically

* add comments

* update readme

* hls muxer: fix memory leak

* hls muxer: decrease ram consumption
2022-05-31 19:17:26 +02:00
aler9
13fb24da39 fix rtmp -> rtsp audio conversion (#932) 2022-05-13 16:59:52 +02:00
aler9
ae23dde169 hls client: improve video / audio sync 2022-05-10 23:35:25 +02:00
aler9
901eae2f6b fix bias error in AAC timestamp 2022-05-10 13:29:32 +02:00
aler9
35b3541e4f hls client: add limit on AU size 2022-04-29 12:02:11 +02:00