Howto Repaire or fix the duration of a mp4 video
I had the same problem. I solved that by removing the audio from video.
This is why the video seems frozen but it continues to play it, due to audio duration. 

For that reason, you may remove entire audio from video file using "-an" ffmpeg option. When it removed, no incorrect time in video exists. You may extract audio from the initial video file, match its duration time with the video duration, and then, you encode video and audio files together, resulting no frozen video frames play. 

eg. 

ffmpeg -i video_to_encode.MP4  -r 16 -crf 18  -vcodec libx264 -vb 10M -an  video_output.avi