Search code examples
videoffmpegvideo-streamingvideo-processinglive-streaming

How to best set FFMPEG scenecut threshold


I am using FFMPEG to get live stream (from an ATSC receiver), and cut it into shots/scenes. Looks like there is a scenecut threshold (20 in my example) that specifies the sensitivity for scene change detection. What is the best value to set for best shot extraction? I need the outputs to be a single scene/shot with best accuracy possible.

ffmpeg -i http://hts:hts@<IP ADDRESS>:<PORT>/stream/service/<HASH ADDRESS> -y -c:v libx264 -profile:v high -prese6t:v fast -deinterlace -x264opts min-keyint=15:keyint=1000:scenecut=20 -b:v 2000k -c:a aac -b:a 128k -f segment -segment_format mp4 -segment_format_options movflags=empty_moov+frag_keyframe+default_base_moof+skip_trailer+faststart /home/1/output%%05d.mp4

Solution

  • Normally, values 0.2 to 0.5 give good results. Below that, you start getting duplicate frames from the same shot as shot changes and above this, you start missing shot changes. Again, this is very subjective to the type of video, but any value less than .15 produces a lot of unnecessary duplicate frames from the same shot.