[FFmpeg-trac] #6868(ffmpeg:new): HLS segmenter doesn't cut properly with AVC Baseline level 3.0
FFmpeg
trac at avcodec.org
Sat Nov 25 21:10:58 EET 2017
#6868: HLS segmenter doesn't cut properly with AVC Baseline level 3.0
--------------------------------+--------------------------------------
Reporter: beloko | Type: defect
Status: new | Priority: normal
Component: ffmpeg | Version: git-master
Keywords: HLS | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
--------------------------------+--------------------------------------
For a better Apple HLS compatibility with older devices, it's better to
provide LD and SD quality streams into MPEG2-TS AVC Baseline Level 3.0.
And it requires less CPU charge to decode with an old mobile processor.
[[Image(https://developer.apple.com/library/content/technotes/tn2224/Art/tn2224_hw_limitations.jpg)]]
Source :
https://developer.apple.com/library/content/technotes/tn2224/_index.html
So I would like to produce HLS streams compliant with the Baseline 3.0
profile using FFMPEG.
In my FFMPEG command line, I use ''-vprofile baseline'' and ''-vlevel
3.0'' arguments to provide this specification to the libx264. Like this :
{{{
ffmpeg.exe -i "D:\Video Samples\Sony_Alpha_7R_II_video-test-4K.mp4"
-loglevel verbose -threads 0 -c:a libfdk_aac -sn -vcodec libx264 -vprofile
baseline -vlevel 3.0 -force_key_frames "expr:gte(t,n_forced*4)" -r 25 -f
hls -hls_time 4 -hls_list_size 99999 -start_number 1 -hls_segment_type
mpegts "C:\Users\Beloko\Desktop\Sony_Alpha_7R_II_video-test-4K.m3u8"
}}}
To be sure the HLS segmenter works properly and create perfect TS files, I
use the ''-force_key_frame'' parameter and I fix the framerate. Each TS
file should be exactly 4 second long.
But unfortunately the first TS, and only the first TS hasn't the good time
length. Here is the .M3U8 content.
{{{
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:5
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:4.042667,
Sony_Alpha_7R_II_video-test-4K1.ts
#EXTINF:4.000000,
Sony_Alpha_7R_II_video-test-4K2.ts
#EXTINF:4.000000,
Sony_Alpha_7R_II_video-test-4K3.ts
#EXTINF:4.000000,
Sony_Alpha_7R_II_video-test-4K4.ts
#EXTINF:4.000000,
Sony_Alpha_7R_II_video-test-4K5.ts
#EXTINF:4.000000,
Sony_Alpha_7R_II_video-test-4K6.ts
...
}}}
The #EXT-X-TARGETDURATION: value should be 4 and not 5. And the first
#EXTINF: value should be 4.000000 and not 4.042667.
And FFPROBE detect a duration of 00:00:04.05 instead of 00:00:04.00.
To solve this issue I found two ways :
. replace ''-c:a libfdk_aac'' by ''-an'' (this means no audio)
. or replace ''-vprofile baseline'' by ''-vprofile main'' (this means
enable BFrames)
But old HLS players don't support BFrames and separated audio tracks (like
multiple audio language).
I tested to encode audio with ''-c:a aac'' and ''-c:a'' libmp3lame with no
more luck. And I also tested with many other video files. It produce the
same issue.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/6868>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list