Log in

View Full Version : .FLG Files


DoctorM
16th June 2008, 02:02
Does anyone know the format or have any details on the .FLG files generated by DVD Rebuilder?

I'm working on something where I'd like to actually make changes to the .FLGs but every file looks similar (just different lengths). A bunch of "".

Specifically I'd like to change some chunks that are 29.97 hard telecined to either 23.976 with pulldown OR just set them so they don't do anything (if that is even possible) so I can manually add pulldown myself.

Any ideas? It's the final road block.

SpazzHH
16th June 2008, 03:00
You can't do anything that will change the source framerate without causing errors in DVD-RB

DoctorM
16th June 2008, 06:03
Or can I? Bwahahahaha.
The point being that I intend to alter the frame rate of the video during encoding and then tweak the flags to prevent problems from it.

Looking with a hex editor proves fairly interesting.
First, all those squares aren't necessarily the same.
29.97 video APPEARS to be all '02's. One character per frame of video. That would be easy to recreate if that were my goal. (So if anyone is looking to convert video to true 29.97, there you go.)

23.976 with pulldown consists of 07 04 05 06 patterns but at something like 50-80% the amount of characters as frames.
Also, there some random leading or trailing 02s in some files.
Very troubling. I really just wish I could disable Rebuilder using then at all during a rebuild.
Unfortunately, if you delete the FLG's or even blank them it causes an error (but that was to be expected).
I just have to figure what to use to replace the data that's created during the Prepare phase.
That or write a hack for Rebuilder that causes it to disregard FLG files.

jdobbs
16th June 2008, 13:12
It's no big mystery. (Bwahahahaha :)) I've always been open with how DVD-RB works. The FLG file holds the values for the MPEG PICTURE_CODING_EXTENSION flags. By keeping it from the original source, it allows me to do a standard type of encode -- and then reapply them at REBUILD. That's pretty much the only way you can handle hybrid sources correctly (and there are a lot more hybrid sources than you might imagine). There were a lot of discussions on this subject here on Doom9 back when Rebuilder was first developed (2004 - 2005).

Each byte represents a frame.
Bit zero is the RFF.
Bit one is the TFF.
Bit two is the PROGRESSIVE_FRAME flag.

Other bits are reserved.

You could do what you want, but you'd better have a good understanding of the format and what happens and when (like at VOB breaks, etc.). The biggest problem is that most people think they understand how pulldown works a lot more than the do. My experience is that many of the identified "hard telecined" sources aren't "hard telecined" at all. There's also a big, big problem if you are attempting to inverse telecine a hybrid stream... it pretty much can't be done without screwing it up. Also, I find a lot of people who are convinced they have a "combing problem" and try to inverse telecine a true interlaced source... which usually becomes a jumpy mess.

One way to do this might be to do an encode with inverse telecining filters implemented for each affected segment, run "pulldown.exe" against it, and then use the resulting flags in the PICTURE_CODING_EXTENSION of the stream to repopulate the FLG file between ENCODE and REBUILD. You'd also have to modify the settings for the segment in REBUILDER.INF to match what you've done (frame count, type of stream, etc.) This type of flexibility and ability to support creativity is exactly why three-click mode exists.

You could also do something similar for movie-only conversion of 23.976fps NTSC sources to PAL or PAL to NTSC (with resizing and using Neuron2's DGPULLDOWN application) -- as long has you know what to change in the REBUILDER.INF file... but frankly, I've always found it easier to simply reauthor if I wanted to do something like that. If you wrote a third party app that could also modify the IFOs, you might even be able to do a complete conversion.

Also -- please don't post trouble reports with sources that have been modified... I don't (can't) respond to self-inflicted injuries. ;)

DoctorM
16th June 2008, 16:31
Indeed, the video I'm working with is 100% hard telecined, no mistake about it, not just the occasional comb, and not from pulldown flags.
That just chews up bitrate during compression so I want it gone.
I used a command prompt to recursively add the telecine filters after the trim commands following the Prepare (though I suppose RB-Opt could have done it as well).

"Repopulating the FLG file".... that sounds like just what I want to do.
It's easy enough to add my own flags to the newly re-encoded .m2v files with dgpulldown and a one line command.
Any links or guidance you can give on how to build the replacement flgs?

I hadn't considered that the IFOs were reconstructed from the data in the Rebuilder.inf. I figured they were copied and updated (with a sort of IFOUpdate or VOBBlanker method).
If it's true that they are newly built from the frame count, stream type, etc., updating all of that would be a bit labor intensive without some sort of automation.
At that point it does become much easier to just pull apart the disc and do it by hand.

Anyway, cheers for such an awesomely well built proggie, but it doesn't leave much room for sneaky tweakin'.
Some options (even hidden) that allow for IVTC, and PAL to NTSC conversion would be awesome considering similar (and dissimilar) video conversion programs usually allow for that.