Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#2963 | Link |
German doom9/Gleitz SuMo
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 7,199
|
Not so trivial. In the sources (ffms2-git\src\core\indexing.cpp) I read that it is single-file zipped (like in UNIX zip .z or GNU zip .gz or .xz or similar, not PKZIP, I believe, see: ffms2-git\src\core\zipfile.cpp).
If I am not wrong, L-SMASH Source does not compress the index. Last edited by LigH; 17th February 2025 at 15:38. |
![]() |
![]() |
![]() |
#2964 | Link | |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 3,210
|
Correct, unlike the .ffindex files produced by FFVideoSource() and FFAudioSource(), the .lwi created by LWLibavVideoSource() and LWLibavAudioSource() is not compressed, it's human readable and it has an XML based structure.
Truncated example for reference: Quote:
|
|
![]() |
![]() |
![]() |
#2965 | Link | |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,641
|
Quote:
Luckily I've found a nice modernised stream buffer wrapper (zstr) for zlib, although it did need a tweak to allow to read "fast compressed" zlib as used by FFMS2 (the author was guided by a Stack Overflow post that omitted that kind of header). [Edit: zstr doesn't seem to work properly with ffindex files, bugging out after ~2500 bytes] Hopefully indexing.cpp can guide me through parsing an index. Thanks! Last edited by wonkey_monkey; 20th February 2025 at 01:26. |
|
![]() |
![]() |
![]() |
#2966 | Link | |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,464
|
Quote:
Code:
FFmpegSource2 indexing app Usage: ffmsindex [options] inputfile [outputfile] If no output filename is specified, inputfile.ffindex will be used. Options: -f Force overwriting of existing index file, if any (default: no) -v Set FFmpeg verbosity level. Can be repeated for more verbosity. (default: no messages printed) -p Disable progress reporting. (default: progress reporting on) -c Write timecodes for all video tracks to outputfile_track00.tc.txt (default: no) -k Write keyframes for all video tracks to outputfile_track00.kf.txt (default: no) -t N Set the audio indexing mask to N (-1 means index all tracks, 0 means index none, default: 0) -s N Set audio decoding error handling. See the documentation for details. (default: 0) -u N Set the progress update frequency in seconds. Set to 0 for every percent. (default: 1) -o string Set demuxer options to be used in the form of 'key=val:key=val'. (default: none) FFmpeg Demuxer Options: --enable_drefs --use_absolute_path |
|
![]() |
![]() |
![]() |
#2967 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,641
|
I've managed to get this far decoding the video track in the index (values are little endian):
Code:
PTS OriginalPTS Keyframe FilePos MarkedHidden OriginalPos PosInDecodingOrder RepeatPict SecondField 80|02|00|00|00|00|00|00 80|02|00|00|00|00|00|00 01 4c|01|00|00|00|00|00|00 00 ff|ff|ff|ff|ff|ff|ff|ff ff|ff|ff|ff|ff|ff|ff|ff 01|00|00|00 00 80|02|00|00|00|00|00|00 80|02|00|00|00|00|00|00 01 bc|4e|00|00|00|00|00|00 00 00|00|00|00|00|00|00|00 00|00|00|00|00|00|00|00 01|00|00|00 00 80|02|00|00|00|00|00|00 80|02|00|00|00|00|00|00 00 9e|4e|00|00|00|00|00|00 00 00|00|00|00|00|00|00|00 00|00|00|00|00|00|00|00 01|00|00|00 00 80|02|00|00|00|00|00|00 80|02|00|00|00|00|00|00 00 bb|30|00|00|00|00|00|00 00 00|00|00|00|00|00|00|00 00|00|00|00|00|00|00|00 01|00|00|00 00 So the frames VirtualDub reports as keyframes do all seem to be marked as keyframes in the index, but so are many other apparently non-keyframe frames ![]() Not sure what FilePos could mean either, since its value never goes very high (only up to about 300,000) compared to the filesize of 14Gb. The other fields never seem to change - PTS and OriginalPTS obviously relate to the constant framerate - except for the -1s for OriginalPos and PosInDecodingOrder on frame 0. Anyone got any idea what I'm missing with regard to keyframes? Last edited by wonkey_monkey; 19th February 2025 at 00:20. |
![]() |
![]() |
![]() |
#2968 | Link | |
Registered User
Join Date: Jul 2018
Posts: 557
|
Quote:
|
|
![]() |
![]() |
![]() |
#2969 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,641
|
I used track.cpp to determine what those fields delimited above are.
Could there be such a thing as a de facto keyframe? I.e. a frame labelled as P or B but which doesn't actually depend on the content of any other frames? If so, maybe ffmpeg is identifying them as keyframes. Last edited by wonkey_monkey; 19th February 2025 at 18:32. |
![]() |
![]() |
![]() |
#2970 | Link |
Registered User
Join Date: Jul 2018
Posts: 557
|
P and B frame never can be keyframe.
Key frames are only I type. The frame info in .ffindex is pretty much the same as what ffmpeg/ffprobe output. You can just do ffprobe -show_frames -select_streams 0 -i input.video | findstr "key_frame pict_type" > frame_info.txt Code:
key_frame=1 pict_type=I key_frame=0 pict_type=B key_frame=0 pict_type=B key_frame=0 pict_type=B key_frame=0 pict_type=P |
![]() |
![]() |
![]() |
#2971 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,641
|
Ah, now I get it: https://forum.doom9.net/showthread.php?p=1834568
VirtualDub differentiates between IDR frames [K] and regular I-frames [I]. Ideally I need to know which are IDR frames, but that doesn't seem to be specified in the ffindex. I can probably work with that, it just won't be quite as effective. |
![]() |
![]() |
![]() |
#2972 | Link |
Registered User
Join Date: Jul 2018
Posts: 557
|
https://github.com/FFMS/ffms2/blob/m...exing.cpp#L531
Here is stored in ffindex https://github.com/FFMS/ffms2/blob/m...exing.cpp#L567 |
![]() |
![]() |
![]() |
#2973 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,606
|
I don't know why you need to know keyframes but beware, FFmpeg has a lot of bugs. For example the huffyuv decoder reports no keyframes (lol) and while the keyframe flag should only be set for IDR-frames in h264 due to bugs in FFmpeg it will happily mark I-frames as "keyframes" in remuxed files.
Lots of fun bugs and corner cases even in common containers and formats.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
![]() |
![]() |
![]() |
#2976 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,606
|
May I interest you in our lord and savior BestSource?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
![]() |
![]() |
![]() |
#2977 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,641
|
Right now, if there's a finished and working Windows build (for Avisynth+), then sure. If I have to compile it myself, I'm still too traumatised from LSMASHSource.
Edit: Oh there is. Good. Testing now. More edit: Does over ten minutes (still waiting) to open a one hour 14Gb .mp4 sound right to you? ![]() Yet another edit: 30 mins total indexing time. It's going to take two solid days to index my sources ![]() ![]() More info: Once first load finished in VirtualDub, all the audio channels were present, but they were all silent. Opening the same .avs file in a new VirtuaDub window, the audio was all present, but the framerate was incorrectly determined to be 25.764fps instead of 25fps (same as with original load). SeekTester confirms frame accuracy, so that's nice. But that indexing speed is a killer (but worth it for the frame-accuracy guarantee). Last edited by wonkey_monkey; 21st February 2025 at 18:16. |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|