Current status
- RTMP is FLV based, so RTMP is best performance on output FLV. (Just write, without modification)
- As I think, In Low-latency scenario,
RTMP=>FLV=>fMP4has overhead. How about RTMP directly push fMP4 to CDN?
Structure of fMP4
-
ISOBMFF is documented as [ISO/IEC 14496-12].
-
Mandatory structure is
ftypandmoov, that can be found in [Table 1 — Box types, structure, and cross-reference (Informative)]. -
Fragment need pair of
moofandmdat. -
ftypandmoovis commonly grouping and saying initial segment. -
moofandmdatcontain real video/audio data contain. -
moofhas offset of data that pointedmdat’s payload. -
tfhdin themoofhas base-data-offset that used to calculate data offset. -
tfhdhas a flag nameddefault‐base‐is‐moof, that means base-data-offset = 0 meaningmoofbox’s start offset.
Current status
- Basic fMP4 segment generation and HLS metadata creation work
- Stream by
ffmpeg -re -i <filename> -vcodec copy -acodec copy -f flv rtmp://<address>:<port>/<app>/<stream key>works well - Stream by OBS have a problem, no sound playable. OBS’s setting is correct that I checked by Recording.
- Maybe need to check AudioSpecificConfig related? Currently just skipped.
Conclusion
- I pivoted from
RTMP=>FLVtoRTMP=>fMP4, due to it seems overhead, no benefit, to minimize implementation range. - Write ISOBMFF I/O library that specifically support playable fragmented mp4, that support
ftyp,moovandmoof. - Currently has some unknown bugs, like non playable audio in specific scenario.
To do
- Fix audio play problem.
- Benchmark with nginx-rtmp-module
- Implement routing app(Data stream in-house passthough system?)
- Implement stream key management (Implement AP system? transaction(ACID)?)