[Libav-user] EPERM when seeking in live HLS

Louis Letourneau lletourn49 at gmail.com
Thu Sep 26 03:54:57 EEST 2019

I'm trying to process a live HLS stream. The source encoding comes from
ffmpeg using -hls_playlist_type event so it's seekable.

most of the time there is no issue, but once in awhile when calling:
int ret = av_seek_frame(ic, videostream, timestamp, AVSEEK_FLAG_BACKWARD);
if(ret < 0) {
    char buf[2048];
    av_strerror(ret, buf, 2048);
    printf("Couldn't seek!!!!! Reason: %s\n", buf);

I get EPERM (Operation not permitted).

Then I just need to wait ~1s retry and it works.

When enabling full debug, there are 2 messages that popup when the error
no picture ooo
Frame num gap 1 14
Frame num gap 1 15

These both happen in libavcodec/h264_slice.c

Can anyone explain what could cause this? I don't 100% understand what
could cause this.

Oh and this never ever happens once the m3u8 is complete and is not live

Thank you

P.S. if it helps here's the full encoding syntax:
ffmpeg -re -i z.m3u8 -an -codec:v libx264 -crf 23 -preset fast -pix_fmt
yuv420p -force_key_frames "expr:gte(t,n_forced*5)" -bf 0 -hls_time 5
-hls_list_size 0 -hls_wrap 0 -hls_allow_cache 1 -hls_playlist_type event
-hls_segment_filename "w/w-1_%04d.ts" w/w-1.m3u8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20190925/6c73fe1a/attachment.html>

More information about the Libav-user mailing list