[FFmpeg-user] Generate single MPEGTS HLS segment based on fragmented input data

Jan Marlewski jan.marlewski at gmail.com
Wed Dec 16 23:47:38 EET 2020


Thank you for your response Lingjiang Fang. Unfortunately concatenating all
files before generating MPEG TS segments would require to download all data
from storage, which is not possible in my scenario!
When you say "padding and frame size requirement of encoder" do you mean
AAC encoder or MPEG TS encoder? Maybe there is a way to fulfill this
requirement by using segment length other than 10 seconds?

Regards,
Jan

pon., 14 gru 2020 o 04:56 Lingjiang Fang <vacingfang at foxmail.com>
napisaƂ(a):

> On Fri, 11 Dec 2020 18:15:01 +0100
> Jan Marlewski <jan.marlewski at gmail.com> wrote:
>
> >Hi,
> >
> >the problem I want to describe is similar to "Generate individual
> >HLS-compatible .ts segments on-demand by downloading as little bytes as
> >possible from a remote input file" described here
> >http://ffmpeg.org/pipermail/ffmpeg-user/2016-December/034513.html -
> >unfortunately no answers there.
> >
> >Initial assumptions are:
> >- need to provide streaming solution based on HLS-compatible MPEGTS
> >segments
> >- for now need to stream audio only (maybe audio+video in the future,
> >so generic solution would be the best for me)
> >- my data source is a group of WAV file segments, exactly 10 seconds
> >each - if you take all WAV segments and concatenate them you will get
> >a nice, seamless audio track (no glitches, gaps etc.)
> >- the cost of retrieving each WAV segment from my storage is
> >relatively high
> >
> >My approach:
> >- create m3u8 index file before any segments are actually available,
> >as I know how many segments I need to generate and I also know their
> >duration
> >- when a MPEGTS segment is requested, collect WAV data from storage and
> >generate MPEGTS file using FFmpeg:
> >
> >For first segment:
> >ffmpeg -i input_1.wav -acodec aac -output_ts_offset 0ms output_1.ts
> >
> >For second segment:
> >ffmpeg -i input_2.wav -acodec aac -output_ts_offset 10000ms output_2.ts
> >
> >etc...
> >
> >My problem:
> >- generated segments are not exactly 10 seconds long
> >- gaps can be heard between some audio segments (may this be caused by
> >above issue?)
>
> I think the problem was caused by separated encoding of independent
> files, because of the padding and frame size requirement of encoder.
>
> My suggestion is process all file at once, these links may help:
>
> https://stackoverflow.com/questions/7333232/how-to-concatenate-two-mp4-files-using-ffmpeg
> https://trac.ffmpeg.org/wiki/Concatenate
>
> >
> >Any ideas how to generate single MPEGTS segments that will not cause
> >glitches during playback?
> >
> >I need to expose the data through web API written in ASP.NET C#. Any
> >idea on how to solve this problem, even if it may not use FFmpeg at
> >all, would be appreciated.
> >
> >Thanks,
> >Jan
> >_______________________________________________
> >ffmpeg-user mailing list
> >ffmpeg-user at ffmpeg.org
> >https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> >To unsubscribe, visit link above, or email
> >ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>
> --
> Best regards,
> Lingjiang Fang
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list