Opened 6 years ago
Last modified 6 years ago
#7341 new defect
hls mpegts segmentation is not consistent all the way through for audio only MP4s
Reported by: | Ronak Patel | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
Try to generate an HLS stream using an mpegts container using the following command:
~/bin/ffmpeg -i test.mp4 -codec copy -hls_time 0.975238095238095 -hls_segment_type mpegts -hls_flags single_file -hls_playlist_type vod test.m3u8
or
~/bin/ffmpeg -i test.mp4 -codec copy -hls_time 0.975238095238095 -hls_segment_type mpegts -hls_playlist_type vod test.m3u8
Open the m3u8 file, and see that the segmentation is all over the place, sometimes 1 AAC frame less, or a few AAC frames larger than 0.975238095238095 (21 AAC frames at 22050kHz or 42 frames at 44100kHz).
How to reproduce:
-bash-4.1$ ~/bin/ffmpeg -i test.mp4 -codec copy -hls_time 0.975238095238095 -hls_segment_type mpegts -hls_flags single_file+append_list -hls_playlist_type vod test.m3u8 ffmpeg version N-91512-ga5c17cf Copyright (c) 2000-2018 the FFmpeg developers built with gcc 4.4.6 (GCC) 20110731 (Red Hat 4.4.6-3) configuration: --prefix=/home/ronakp/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ronakp/ffmpeg_build/include --extra-ldflags=-L/home/ronakp/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/home/ronakp/bin --enable-gpl --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-nonfree libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 21.106 / 58. 21.106 libavformat 58. 17.101 / 58. 17.101 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 26.100 / 7. 26.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4': Metadata: major_brand : isom minor_version : 1 compatible_brands: isom creation_time : 2013-12-08T19:51:00.000000Z Duration: 00:11:24.11, start: 0.000000, bitrate: 31 kb/s Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 30 kb/s (default) Metadata: creation_time : 2013-12-08T19:51:00.000000Z handler_name : GPAC ISO Audio Handler [hls @ 0x22f4200] Opening 'test.ts' for writing [mpegts @ 0x22e4f00] frame size not set Output #0, hls, to 'test.m3u8': Metadata: major_brand : isom minor_version : 1 compatible_brands: isom encoder : Lavf58.17.101 Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 30 kb/s (default) Metadata: creation_time : 2013-12-08T19:51:00.000000Z handler_name : GPAC ISO Audio Handler Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help size=N/A time=00:11:24.05 bitrate=N/A speed=1.06e+04x video:0kB audio:2572kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.
Attachments (2)
Change History (12)
by , 6 years ago
comment:1 by , 6 years ago
comment:2 by , 6 years ago
Did you attach an output instead of an input file?
Is file input necessary or is the issue reproducible with sine
input?
comment:3 by , 6 years ago
I attached an output file so you can see what I'm talking about. I've seen this behavior happen with any audio file I pass in, it doesn't matter what the input audio file is.
comment:4 by , 6 years ago
My question was if file input is needed at all or if the issue is also reproducible with filter input.
comment:5 by , 6 years ago
Ok that wasn't clear. I don't know what sine is. I've only ever tried this with file input.
comment:6 by , 6 years ago
RTFM: “Make sure to require a closed GOP when encoding and to set the GOP size to fit your segment time constraint.”
by , 6 years ago
Attachment: | output_44_32_heaac.mp4 added |
---|
comment:8 by , 6 years ago
I've attached one of the source audio MP4s where this is happening. Please notice that this is an AUDIO ONLY MP4. There is NO VIDEO involved here. The hls_time parameter should be honored in this playlist, and should do so with the same number of frames in each mpeg-ts segment (not counting the last one).
comment:9 by , 6 years ago
Summary: | hls mpegts segmentation is not consistent all the way through → hls mpegts segmentation is not consistent all the way through for audio only MP4s |
---|
comment:10 by , 6 years ago
Hi, can anyone please show me where this code to segment audio files is located for mpegts?
It seems this code is different from the codepath for fmp4 since that segments perfectly.
I've attached an example of an m3u8 file that ffmpeg produces. I have a feeling the warning about "[mpegts @ 0x22e4f00] frame size not set" could be why this is happening?