Is it possible to edit this script:
So that searching/scrolling through the video is more accurate, like 2 seconds? (by default in the output file there are fragments with 10 seconds away from each other, and that's too much)Code:LoadPlugin("E:\AviSynth 2.5\plugins\ffms2.dll") A = FFAudioSource("E:\AviSynth 2.5\scripts\1.mkv") V = FFVideoSource("E:\AviSynth 2.5\scripts\1.mkv") AudioDub(V,A) AssumeFPS(24000,1001) orig=last orig.Trim(94,2465) ++ orig.Trim(3302,0)
I know in Handbrake you can do it using keyint=24 but what about AviSynth?
+ Reply to Thread
Results 1 to 11 of 11
-
-
keyint is an encoder parameter
http://mewiki.project357.com/wiki/X264_Settings#keyint
"Searching being more accurate" may also depend on the player. By default, many players probably jump to the nearest keyframe when navigating because it's fast. Navigating to a non-keyframe is likely to require decoding bunch of other frames in order to display the requested frame and that slows things down a little. I don't know how hardware players normally behave but MPC-HC, for example, lets you select the navigation method. View/Options/Tweak and unchecking "Fast seek" makes navigating frame accurate. If you navigate to a specific frame via the Navigate/GoTo menu it'll take you to the specified frame regardless of the fast seek setting.
Keep in mind reducing keyint can effect the ability to compress so for a given CRF value the file size will increase and for a given bitrate the quality will probably be reduced a little. The bitrate increase when using keyint 24 rather than keyint 250 for a given CRF value is probably 10% or more.
PS If you're using a low keyint, you might want to look at open-gop. It's disabled by default. All Bluray players (and probably most other hardware players) support it. I don't know how much it adversely effects seeking speed.
http://mewiki.project357.com/wiki/X264_Settings#open-gopLast edited by hello_hello; 9th Feb 2015 at 09:38.
-
Why does that happen anyway (10 second differences) when in the initial file there was no larger gap than 5 seconds before 2 searchable fragments?
-
How are you doing this? Did you mean the script preview? Searching is frame accurate with ffms2 in avisynth, because everything is decoded to uncompressed frames.
If you meant the encoded file, then see what hello_hello said above - it mostly depends primarily on the max keyframe interval you set for the encoding. Most x264 GUI's have it set at 250, so ~10 seconds for a 25fps source . If you want finer seeking in the encoded file, reduce the value . For a 24fps source, you would set it to 48 for 2 seconds
The initial file is meaningless, because it is decoded then re-encoded. Seeking in that file is dependent on whatever settings were used to encode that file. When it gets decoded, the notion of "GOP" is lost. Every frame is uncompressed, thus a true keyframe -
Ok, I found the GOP option in x264's advanced settings, but how do you calculate it? What would be ~5 seconds for 23.976 FPS?
-
keyint specifies the maximum number of frames (gop size), so keyint 24 would be one second at 24fps. That's why the default keyint 250 can place keyframes up to around 10 seconds apart (that's the maximum, but the encoder places keyframes on scene changes so generally they tend to be closer together).
poisondeathray beat me to it. -
Does assigning a low rate for maximum GOP (for example 48 instead of 250, which is "recommended") have some side effects, like worse quality or bigger file size?
-
If you're really keen, you can tell x264 where you require keyframes using a qp file (text file with a qpf extension). It's probably a bit useful for ensuring any chapters start on keyframes. In fact MeGUI's chapter creater will also create a qp file when extracting chapters from DVDs. Personally, I've rarely had the necessary level of enthusiasm to bother, but a simple qp file specifying keyframes might look like this:
0 K
8869 K
15017 K
22344 K
31680 K
41360 K
And you'd add it to the encoder command line like this:
--qpfile "D:\anyfilename.qpf"