Hello. I have mp4/x264 video file which is quite big and I want to re-encode it (with x264 or x265 codec) at lower bitrate. But the problem is that new mp4 file freezes on seek, or seek takes very long time (several seconds). I use MediaPlayerClassic on Windows, and VLC on Android. Same result on both. I also tried to encode it with Nvidia H264 and Nvidia HEVC - still no luck. What is wrong? Original file seeks without a problem.
Here is an example of problematic video file http://www115.zippyshare.com/v/ii0fxg97/file.html (http://www115.zippyshare.com/v/ii0fxg97/file.html)
hevc sample video, with avidemux only plays. you can't move around within the video.
In vlc you can go forward/backward in that video.
QuoteNo next keyframe keyfr for frameTime
[DecodePictureUpToIntra] 04:46:18-727 Could not find decoded frame, wanted PTS :0 PTS=0 ms, 0 us
ReadIndex:13, WriteIndex:21
Edcache content[0]: PTS : 00:00:00,567 567 ms
Edcache content[1]: PTS : 00:00:00,600 600 ms
Edcache content[2]: PTS : 00:00:00,633 633 ms
Edcache content[3]: PTS : 00:00:00,667 667 ms
Edcache content[4]: PTS : 00:00:00,700 700 ms
Edcache content[5]: PTS : 00:00:00,467 467 ms
Edcache content[6]: PTS : 00:00:00,500 500 ms
Edcache content[7]: PTS : 00:00:00,533 533 ms
[seektoTime] 04:46:18-727 Cannot decode up to intra 0 at 0 ms
[switchToSegment] 04:46:18-727 Cannot seek to beginning of segment 0 at 0 ms
[rewind] 04:46:18-727 Rewinding
[switchToSegment] 04:46:18-727 Trying to switch to seg 0 with startTime in reference pic= 0 ms
[seektoTime] 04:46:18-727 First frame of the new segment is a keyframe at 0ms
[DecodePictureUpToIntra] 04:46:18-727 DecodeUpToInta 0 ref:0
[edCache] Flush
[switchToSegment] 04:46:18-729 Switched ok to segment 0 (dontdecode=0)
[start] 04:46:18-729 admPreview,starting
[convertLinearTimeToSeg] 04:46:18-729 Frame time=0, taking first segment
[convertLinearTimeToSeg] 04:46:18-730 Frame time=0, taking first segment
[updateLoaded] 04:46:18-730 conf updated
[AudioEncoder] Selected copy for index 0, tag 0x0
Paint event
[refresh] 04:46:18-732 [Vdpau]Rrefresh
Paint event
[refresh] 04:46:51-957 [Vdpau]Rrefresh
[HandleAction] 04:46:55-272 ************ NextKFrame **************
[nextKeyFrame] 04:46:55-272 Current PTS :0 ms
[convertLinearTimeToSeg] 04:46:55-272 Frame time=0, taking first segment
[getNKFramePTS] 04:46:55-272 No next keyframe keyfr for frameTime
[nextKeyFrame] 04:46:55-272 Cannot find next keyframe
Thank you for your response.
So how can I re-encode x264/x265 so that new file will be seekable in all video players, just like original mp4 file?
The sample contains of a single GOP. Obviously, Avidemux can't seek to the next keyframe because there is no other keyframe as the one at the beginning of the video. Navigating in 1, 2 and 4 seconds steps works but is slow, because it requires the video to be decoded to arrive there.
When reencoding with x264, you must ensure that the maximum GOP size is not too big, i.e. lower the GOP size (at the bottom of the "Frame" tab of the x264 configuration dialog) to e.g. 30 frames from the default value 250. Do not enable "Periodic Intra Refresh".
Now I understand. Thank you for clarification.