Log in

View Full Version : Finding keyframes in an x264 MKV


Raptor455
17th May 2006, 20:53
hello for the good use of chapters linking i need to know where is the nearest keyframe of a certain timestamp. (in my final video file of course not the source) Is there some kind of way to do this? I use MeGUI to encode directly in MKV

My search in google didnt give me anything usefull on this subject

akupenguin
17th May 2006, 23:05
mkvinfo -v foo.mkv | perl -e '$/="+ Block"; while(<>){print if /track number 1/ && !/Reference/}' | grep timecode

Raptor455
18th May 2006, 09:25
thanks a lot ill check that tomorrow

Raptor455
18th May 2006, 19:21
Maybe im just stupid but i did this line in run:

I:\yatta\mkvtoolnix-unicode-1.6.5-build20060227-3\mkvinfo -v foo.mkv | perl -e '$/="+ Block"; while(<>){print if /track number 1/ && !/Reference/}' | grep timecode

I placed the video file in the same folder as mkvinfo and renamed it to foo.

A black screen appeared for a sec and then nothing happened. If i understand this some kind of timecode file should appear but it doesnt what am i doing wrong?

the mkvinfo documentation doesnt help much either excet to know that the -v is the verbosity level wich you technically never set as far as i understand

buzzqw
18th May 2006, 21:25
I:\yatta\mkvtoolnix-unicode-1.6.5-build20060227-3\mkvinfo -v foo.mkv | perl -e '$/="+ Block"; while(<>){print if /track number 1/ && !/Reference/}' | grep timecode

to run this you must have both perl interpreter installed and grep for win32....

try with mkvinfo -v foo.mkv >timecode.txt

then parse timecode.txt for your timecode...

but i think there must be a better and easy solution ;)

BHH

robU*4
19th May 2006, 08:27
Try printing the content of the Cue Entry wiht mkvinfo, it should contain all the keyframes of the video track.

Raptor455
23rd May 2006, 21:37
Ok i found what you meant bur just to make sure the cluster timecode would refer to the keyframes right?

so for example this :

(MKVInfo) |+ Cluster at 274900
(MKVInfo) | + Cluster timecode: 3.420s at 274907
(MKVInfo) | + Block group at 274912
(MKVInfo) | + Block (track number 1, 1 frame(s), timecode 3.420s = 00:00:03.420050000) at 274915
(MKVInfo) | + Frame with size 6120
(MKVInfo) | + Reference block: -208.550000ms at 281042
(MKVInfo) | + Block group at 281046
(MKVInfo) | + Block (track number 1, 1 frame(s), timecode 3.337s = 00:00:03.336650000) at 281049
(MKVInfo) | + Frame with size 2393
(MKVInfo) | + Reference block: 83.400000ms at 283449

jumping at 3.42005s would create no lag at all while jumping at 3:33665 would create some lag?

At first i was searching for frames without any reference block but there doesnt seem to be any of those except the first one