问题
If a m3u8 url references to a streming, there is no video size, however , If the m3u8 url references to a video, any way to figure out the video file size ?
I don' t want adding up all the http content-length
header of each video segment because it is a bit tedious.
I provide this m3u8 url as an example usage.
回答1:
The duration of a particular video stream within a M3U8 manifest file is not mandatory, but if a given video stream will typically have this information in the header of its own container.
For example, if the stream is a MP4 stream then you can get the duration from the header 'Moov" atom once it is read in at the start, rather than having to read each segment and add up its content length.
Its worth noting that for MP4 in particular you need to have the Moov atom at the start of the file - most MP4 videos that have been prepared for streaming will have had this done.
来源:https://stackoverflow.com/questions/41799396/figure-out-the-file-size-of-a-m3u8-url-referenced-video