[FFmpeg-devel] [PATCH] hlsenc: intialize only on ref_pkt (v2)

Miroslav Slugeň thunder.m at email.cz
Tue Feb 14 10:30:33 EET 2017


Dne 14.2.2017 v 04:59 Steven Liu napsal(a):
> 2017-02-13 21:15 GMT+08:00 Miroslav Slugeň <thunder.m at email.cz>:
>
>> This patch will fix cutting hls segments into exactly same length. Because
>> it will intialize only on first ref_packet, which is video frame, not audio
>> frame (old behavior)
>>
>> Now it should be possible to create segments at exactly same length if we
>> use new -force_key_frames hls:time_in_seconds parameter.
>>
>> This is required to support adaptive HLS.
>>
>> This patch was splitted to two parts, this is first independent part
>>
>> --
>> Miroslav Slugeň
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>>
> Patch can compile passed, but i cannot reproduce the problem before your
> patch, can you send a reproduce step and test file?
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
I can provide you with sample. But this explanation should be enough:

When you use -copyts for long time audio/video sync when transcoding 
from MPEGTS stream, audio comes always sooner than video (it is around 
1-2 s), so hlsenc is initialized with audio packet PTS instead of video 
packet PTS. That is not correct if you wan't to have all segments with 
same length -forced_keyframes to force keyframe at video position. Every 
other calculations of hls_time is done only on ref_packets which is 
video. This scenario is problematic when encoder is also inserting 
keyframes by its own decision (libx264 default behavior).

M.


More information about the ffmpeg-devel mailing list