Hello VideoHelp community!
I have been looking into Fast Forward and Rewind in Mp4 videos.
I am using MediaCoder to encode and after a bit of reading I now know that the lower the valuer of GOP the faster the seeking is, so I keep it around 33.
This applies perfectly when I encode with NVENC and using the H264 format.
But when I try with the H265, fast forward becomes impossible regardless of how low the GOP is.
I have read a suggestion that with H265, the parameter open-GOP should be disabled,
but that's disabled in Mediacoder by default, right?
Does anyone know if there is anything else I can do to achieve fast seeking times in H265?
+ Reply to Thread
Results 1 to 23 of 23
there are two parameters if I'm not wrong - --min-keyint which is minimal interval between keyframes, and --keyint that is max interval between keyframes. First is usually equal to fps of video, the second parameter can be 3x fps even 20 x is possible. Of course it has impact on skipping of videos. Larger more demanding on computing. It has to calculate all frame from nearest keyframe to current position. On slower machines it can take long time. But there are (on sw players (on PC)) usually possibility for fast skip, so when you skip at anywhere on video, it will play not exactly from position which you selected, but from nearest (previous keyframe).
Last edited by Bernix; 24th Jan 2018 at 07:37. Reason: typo
@Bernix Thank you for replying. Yes this it true min-keyint and keyint do exactly that.
In Handbrake for example in the video tab, in "extra options" i add "keyint=33"min-keyint=16" and this gets me fast seek.
The problem is that this doesnt work when instead of H264 I switch to H265.
Also as I am trying to make all of this work in MediaCoder, (since mediacoder is utilizing the GPU instead of the CPU and it is incredibly fast) would you have to know how to force the keyint / min-keyint parameters in Mediacoder?
So far I had reached the conclusion that the GOP value is the keyint parameter.
you are using Nvenc HEVC? Not sure you can set min-keyint or keyint there, you can only do something with IDR frames, to force them, don't know if it helps at all. If you playing your video on PC, so I suggesting you set up player for fast skip.
Yes I am using NVENC in MediaCoder. The GOP value seemed to work for me (the lower the better) but it works only with h264 not H265.
Last edited by Ibizanhound; 24th Jan 2018 at 08:21.
Since keyint and open-gop were already mentioned:
1. Note that HEVC/H.265 decoding is usually slower than AVC/H.264 decoding. If possible use a fast decoder (e.g. LAV Video 64 in either software or hardware mode depending on your hardware)
2. You are not just seeking but fast forwarding? Maybe because of the GOP structure the player cannot skip any frames. Only not referenced frames can be skipped.
I just spent the whole day experimenting with different settings in Mediacoder, even though I can make the NVENC work with H264 format,
which means really fast encoding times and fast forward ability thanks to setting the value of GOP at 33 in the NVENC settings,
still I feel the quality of H265 is slightly better,
but unfortunately despite my efforts the GOP value doesn't seem to affect the H265 format in order to be able to seek fast enough to support a fast forward feature.
At least in windows media player...
I am suspecting it might have to do with the level of compression that H265 has as a format by default.
Could anyone guide me on how to set windows media player to use a fast decoder?
Windows media player is very limited, doubt it is possible there. But for sure possible in Potplayer and VLC, most probably in MPC-BE. With first two I can help you. IMHO Problem is also that you can't do too much about keyframes in NVENC HEVC. As mentioned just something about force IDR frames.
And AFAIK Potplayer, MPC-BE and VLC are far better than Windows Media Player.
Example how to do it in Potplayer. F5 you are in preferences, then click on Playback and choose tab Time Jump here in bottom part check Jump to keyframe.
Let me know, if it helped you.
Constraint on IRAP access unit
Since the HEVC standard does not allow encoding a trailing picture access unit before any leading
picture access unit that has an earlier display order than the trailing picture access unit, the following
constraint is imposed to satisfy the constraint on the GOP structure described above.
When a leading picture access unit appears in a bitstream, an IRAP picture access unit shall appear
only at the beginning of a CVS.
To have frequent random access points, multiple access units associated with a recovery point SEI
message may be present in a CVS. In this case, it is encouraged to encode a CVS in such a way that
recovery_poc_cnt and exact_match_flag of the recovery point SEI message can be set equal to 0
and 1, respectively.
Thank you Pandy and Bernix.
So do you have any program to recommend to achieve frequent random access points?
--keyint already achieves that. Don't overthink it. OpenGOP can increase compression a bit but that is currently not the problem you have.
Sneaker, i know about keyint, can you tell me though in which program i can encode in H265 format, using NVENC and setting my own custom keyint value? Thank you.
Slice Decision->GOP Length
Oh ok, I had found that already.
Basically I also have tried this already with Mediacoder and Handbrake always managing to find only the GOP parameter in the NVENC encoder.
Unfortunately like I 've mentioned above, even though the GOP value does make fast seek possible in H264 format, but it doesn't do the same for H265.
deleted Deleted DELETED
Last edited by Marsia Mariner; 26th Jan 2018 at 09:53. Reason: t.w.o.t.
Sorry but can't find anything in this NVENC HEVC ffmpeg support.
Encoder hevc_nvenc [NVIDIA NVENC hevc encoder]:
General capabilities: delay
Threading capabilities: none
Supported pixel formats: yuv420p nv12 p010le yuv444p yuv444p16le bgr0 rgb0 cuda
-preset <int> E..V.... Set the encoding preset (from 0 to 11) (default medium)
slow E..V.... hq 2 passes
medium E..V.... hq 1 pass
fast E..V.... hp 1 pass
ll E..V.... low latency
llhq E..V.... low latency hq
llhp E..V.... low latency hp
lossless E..V.... lossless
losslesshp E..V.... lossless hp
-profile <int> E..V.... Set the encoding profile (from 0 to 4) (default main)
-level <int> E..V.... Set the encoding level restriction (from 0 to 186) (default auto)
-tier <int> E..V.... Set the encoding tier (from 0 to 1) (default main)
-rc <int> E..V.... Override the preset rate-control (from -1 to INT_MAX) (default -1)
constqp E..V.... Constant QP mode
vbr E..V.... Variable bitrate mode
cbr E..V.... Constant bitrate mode
vbr_minqp E..V.... Variable bitrate mode with MinQP (deprecated)
ll_2pass_quality E..V.... Multi-pass optimized for image quality (deprecated)
ll_2pass_size E..V.... Multi-pass optimized for constant frame size (deprecated)
vbr_2pass E..V.... Multi-pass variable bitrate mode (deprecated)
cbr_ld_hq E..V.... Constant bitrate low delay high quality mode
cbr_hq E..V.... Constant bitrate high quality mode
vbr_hq E..V.... Variable bitrate high quality mode
-rc-lookahead <int> E..V.... Number of frames to look ahead for rate-control (from 0 to INT_MAX) (default 0)
-surfaces <int> E..V.... Number of concurrent surfaces (from 0 to 64) (default 0)
-cbr <boolean> E..V.... Use cbr encoding mode (default false)
-2pass <boolean> E..V.... Use 2pass encoding mode (default auto)
-gpu <int> E..V.... Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on. (from -2 to INT_MAX) (default any)
any E..V.... Pick the first device available
list E..V.... List the available devices
-delay <int> E..V.... Delay frame output by the given amount of frames (from 0 to INT_MAX) (default INT_MAX)
-no-scenecut <boolean> E..V.... When lookahead is enabled, set this to 1 to disable adaptive I-frame insertion at scene cuts (default false)
-forced-idr <boolean> E..V.... If forcing keyframes, force them as IDR frames. (default false)
-spatial_aq <boolean> E..V.... set to 1 to enable Spatial AQ (default false)
-temporal_aq <boolean> E..V.... set to 1 to enable Temporal AQ (default false)
-zerolatency <boolean> E..V.... Set 1 to indicate zero latency operation (no reordering delay) (default false)
-nonref_p <boolean> E..V.... Set this to 1 to enable automatic insertion of non-reference P-frames (default false)
-strict_gop <boolean> E..V.... Set 1 to minimize GOP-to-GOP rate fluctuations (default false)
-aq-strength <int> E..V.... When Spatial AQ is enabled, this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive) (from 1 to 15) (default 8)
-cq <float> E..V.... Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control (from 0 to 51) (default 0)
-aud <boolean> E..V.... Use access unit delimiters (default false)
-bluray-compat <boolean> E..V.... Bluray compatibility workarounds (default false)
-init_qpP <int> E..V.... Initial QP value for P frame (from -1 to 51) (default -1)
-init_qpB <int> E..V.... Initial QP value for B frame (from -1 to 51) (default -1)
-init_qpI <int> E..V.... Initial QP value for I frame (from -1 to 51) (default -1)
-qp <int> E..V.... Constant quantization parameter rate control method (from -1 to 51) (default -1)
-weighted_pred <int> E..V.... Set 1 to enable weighted prediction (from 0 to 1) (default 0)
So there is something like slices outside of this for NVENC HEVC or is it independently on NVENC capabilities?
-no-scenecut <boolean> E..V.... When lookahead is enabled, set this to 1 to disable adaptive I-frame insertion at scene cuts (default false) -zerolatency <boolean> E..V.... Set 1 to indicate zero latency operation (no reordering delay) (default false) -strict_gop <boolean> E..V.... Set 1 to minimize GOP-to-GOP rate fluctuations (default false) -aud <boolean> E..V.... Use access unit delimiters (default false) -bluray-compat
-forced-idr <boolean> E..V.... If forcing keyframes, force them as IDR frames. (default false)
sane/reasonable value ofCode:
-qp <int> E..V.... Constant quantization parameter rate control method (from -1 to 51) (default -1)Code:
-rc <int> E..V.... Override the preset rate-control (from -1 to INT_MAX) (default -1) constqp E..V.... Constant QP mode
Doesn't make sense to me.
-no-scenecut will keep the encoder from inserting additional key frames. Less key frames means slower seeking.
-zerolatency should disable b frames. Often b frames are encoded so they are discardable, i.e. they can be skipped when seeking. Again: that would slow down seeking if a player is smart. (But I don't know how this works exactly in NVENC(*).)
-strict_gop .. No idea why this would improve seeking. At least on average it shouldn't make any difference.
-aud shouldn't make any difference.
-blu-ray compat ???
-forced-idr shouldn't make any difference (unless muxer/demuxer is broken)
3 years and some months later,
while trying to solve a different issue,
I discovered this pack of codecs https://shark007.net/advanced.html and it completely fixed the extremely slow seak problem I had when using Windows Media Player and mp4 videos encoded with H265.
Hope you find this helpful as much as I did!