For the past two days I am trying to figure out why FFMPEG produces a glitchy video when transcoding h264 mp4 to HLS with xlib264. It happens to every video. The glitch looks like this :
This is the original mp4 file:
EDIT: Not the whole videos are like that, only some frames and, sometimes a whole segment. This happens with every video that I try, from different sources. I am unsure what causes these. I have tested with numerous options, including inserting keyframes exactly every two seconds, playing around with crf setting, bitrate and maxrate, and even removing them completely. I always get these problems at random places in the encoded video.
Here is the current command used, which produces the same results:
/root/bin/ffmpeg -i "$f" -c:v libx264 -crf 26 -b:v 1200k -bufsize 2000k -strict -2 -vf "scale=trunc(oh*a/2)*2:480" -c:a aac -b:a 128k -profile:v main -level 4.1 -preset fast -g 48 -keyint_min 48 -pix_fmt yuv420p -flags -global_header -metadata "service_provider=XXX" -hls_time 10 -hls_playlist_type vod -hls_segment_filename /root/OUTPUT/"$URLENCODED"/480p/"$URLENCODED"_%03d.ts -threads 0 /root/OUTPUT/"$URLENCODED"/480p/playlist.m3u8
I am now a bit lost. Where do I look for errors? I am unable to use Apple's HLS analyzer tool because I do not have a new enough Apple computer. Other than that, all online tools that I have found do not report any errors.
EDIT: Issue persists across FFMPEG version N-93594-g09f8b2 and N-92724-g826655d (the latter built yesterday from ffmpeg.org)