Simple approach to re-encoding? (NOT transcoding)
I've been playing around with DVD Shrink and, while I like the program, am not really satisfied with the quality. Needless to say, CCE and TMPGEnc do a far better job.
If I wanted to make a disc with just the movie on it, and no menus or extras, it would be simple to encode the video, remux with the audio and stick it on the disc. But menus and extras introduce a certain level of complexity, and I'd rather not reconstruct the entire DVD (minus subs and non-English language audio tracks) in an authoring program. I've spent the last few days first trying to find information on IFO and VOB files, and then trying to understand what I did find. I'm thinking what is required is this: 1. Locate the VTS or PGC you want to compress 2. Demux the video from the relevent VOB(s) into an .m2v 3. Re-encode the video to your new desired size 4. Mux the video back into the VOB, maintaining the same (wrt frame count) cell/program/PGC/PTTS structure as the original 5. Update the VOB and/or IFO to reflect the changes I've been downloading tool after tool and found none that can do the above, not even a combination of them, unless I'm missing something obvious. I'm considering writing a tool to do it -- kind of like DVD Shrink's "full disc" mode except that compression is increased through manual re-encoding instead of automatic transcoding. Does anyone here either know of tool that does this already, or know enough about the structure of VOB and IFO files to give me some pointers towards what would need to be updated in order to remux the video in this manner? UPDATE (warning, things get a bit technical from now on): I just discovered VOB files are MPEG-2 program streams, and I also happened across the full ISO 13818-1 program/transport stream specifications document. It runs to 160 pages, which I figure should give me a decent start on parsing a VOB ;). UPDATE: Looks like demuxing will be the easy part, though the structure of DVDs raises some interesting questions. What I envisage is the software presenting the user with a summary of the DVD's structure (at first the VTSs, the PGCs, the PTTSs, the PGs and the cells; will worry about the VMG later) and the user being able to extract (demux) any of those things. For example, on a disc containing several episodes of a TV show, each show in its own PGC within a VTS, one could extract the PGCs separately, thus pulling out the video and audio from each episode and without having to know the IDs of each cell within the PGC, as you do right now with IfoEdit. It could also dump that PGC's PTTSs (chapters) into a text file for later use, maybe. But here's one of those interesting questions I mentioned earlier: how does one deal with, for example, PGs with multiple angles? Which angle should be demuxed? Presumably the user would be allowed to choose. But what about cell commands? Should they be obeyed? In order to demux the PG "as it really is" one would have to take into account the fact that cell commands can cause a completely different path to be taken than simply moving to the next cell in the program. For example, I recently encountered a disc that used a cell command in the second-to-last cell to unconditionally skip playback of the last cell in the program, which was about 10 seconds of black. If the program blindly demuxed the entire program without regard to the cell commands, that excess blackness would be erroneously demuxed at the end of the video. And if one is demuxing an entire program chain, should one also follow the pre- and post-commands? I think this kind of "smart" demuxer would be a valuable tool, but there's lots of issues that need to be sorted out: following commands would involve parsing the IFO file as well as the VOBs, and writing a command interpreter. I hope those with at least some familiarity with the concepts I'm talking about will jump in and contribute. This is starting to sound like it might be a fairly complex project and I'm not sure I want to figure it all out on my own ;). |
Re: Simple approach to re-encoding? (NOT transcoding)
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
Hi SansGrip,
This sounds like a very complex project and I wish you luck in your task. Im sure there are many ppl here who would be more than happy to help out as there are many ppl here who do know a lot about audio/video structures. Like they say nothing is impossible if you put your mind to it, I look forward to seeing the development of this project. :) Best of luck to you buddy. :D |
Re: Simple approach to re-encoding? (NOT transcoding)
Quote:
What if the tool worked on a cell-by-cell basis, but when it demuxed them it combined them into one elementary stream? That one file would then be re-encoded, and split (with exact frame accuracy, of course) back into the separate cells. One would need to ensure that the cell boundaries began with an I frame, but if the GOP size is known in advance that's possible. Quote:
Quote:
Quote:
Quote:
Quote:
I think a good "smart" demuxer would allow cells to be demuxed individually, but also allow an entire PG, PTTS, PGC or VTS to be demuxed too. In the case of demuxing more than one cell, there are two ways of doing it: 1) The "dumb but safe" way, which is to demux all the cells in the PG, PTTS, PGC or VTS 2) The "smart but dangerous" way, which is to attempt to follow cell commands as part of the demuxing process. This is more difficult than it sounds, though. Imagine the following scenario, designed by a Bastard DVD Author From Hell to mess up this program: - The FP PGC runs the usual FBI warnings and trailers, but in one of the cell commands deep in the VMG it sets register 8 to 0 - The main menu is displayed, and the "Play Movie" button chosen. It links to VTS 3, PGC 2 - VTS 3, PGC 2 contains nothing except a black clip and a post-command which sets register 8 to 1, then jumps to VTS 3, PGC 1 - Cell 1 of PGC 1, which contains the movie and is the one we're trying to demux, contains cell commands which mess up the playback order if register 8 is 0, perhaps by running in a loop This kind of "copy protection" would be hard to circumvent, because it would require the program to begin processing at the FP PGC and run all the way through to the PGC or even PG that we want to demux. In the case above, this would even include prompting for user input upon reaching a menu. As you can see, there are difficulties with blindly following cell commands. I'm going to have a think on it, but I'd appreciate input from anyone who has any thoughts about this. Quote:
|
Quote:
|
Sansgrip,
you may want to drop Nic at doom9 a PM as I believe his next version of rejig was along the lines of what you are proposing. Not sure if its dead in the water but he may be able to give a few pointers on it, cheers, |
Re: Simple approach to re-encoding? (NOT transcoding)
Quote:
If you want to encode a movie in small part, that can be achieve only in a quality based encoding mode else the bitrate repartition is completly screwed up. Do you understand or may I developp ? Quote:
Quote:
Quote:
Quote:
Quote:
|
It would seem to me that instead of attempting to follow cell commands, one should allow the user to select the exact order in which cells are extracted from a program. This way if the cells are out of order for whatever reason the demuxed ES will still be correct.
Joining cells into one ES would be fairly straightforward, but the problem comes when splitting the re-encoded stream back into its component cells. Let's say we have three cells, the first 56 frames long, the second 28 frames long and the third 102 frames long. When muxed together this would produce a 186-frame ES, which could then be re-encoded. But it's essential to ensure that frames 57 and 85 are I-frames, and not P- or B-frames, so that the file can be split between frames 56/57 and 84/85. CCE apparently has a facility to do this, by setting chapter points, but I'm not sure how well it works. The other option is to attempt to pad each cell with extra frames, if necessary, to match the GOP size used by the encoder. This way we know the I-frame will fall on the frame we require, and can (presumably) remove the extra frames we added upon splitting the re-encoded ES back into cells... Is this viable? Is there a simpler way? |
Quote:
|
Quote:
Quote:
|
Re: Simple approach to re-encoding? (NOT transcoding)
Quote:
Quote:
Quote:
A menu is displayed to choose the episode you want to watch. The button for that episode sets a register (1 == 1st episode, 2 == 2nd, etc.), then jumps to the opening credits cell. This cell contains a command which checks the register and jumps to the correct cell to play the episode itself, which then (via a cell command) jumps to the end credits cell. I know that a cell can only contain one command, and those commands are limited to a subsection of the entire command set, so I don't know if the above is actually possible. I'd need to look at the command set in more detail to say for sure. Quote:
|
Quote:
Quote:
|
Re: Simple approach to re-encoding? (NOT transcoding)
Quote:
Quote:
Any Disney DVD (at least the ones sold in Europe) have a "pre-menu" where you select the language you want to read the disc. Then the next menu (root menu of the DVD) is displayed in the chosen language, and when you select "play" the movie is also palyed with that language. BTW, I suggest you to look into Disney production because they are often the trickiest DVD on the market :-) Quote:
Quote:
|
Re: Simple approach to re-encoding? (NOT transcoding)
Quote:
Quote:
|
Re: Simple approach to re-encoding? (NOT transcoding)
Quote:
I have "The lady and the tramp" in R1 and it has a language selection menu for using between en/fr/sp :-) (I didn't notice you are form Ontario. I'm all day long in contact with Ottawa as I work for Nortel Networks now ans my team is there :-)) |
I also think that the pre-menu is a R2 invention. I think I've got several DVDs that have a menu which asks for the menu language before it is shown, and most of these are Scandinavian releases (=basically Finland, Sweden, Norway and Denmark).
Good luck with the tool, just beware that it won't suck you dry too soon. We've seen too many tools abandoned because there just has been too much to fix and add :wink: |
Re: Simple approach to re-encoding? (NOT transcoding)
Quote:
Quote:
|
Quote:
One of the features I'd like to be able to add is the ability to "deauthor" a disc -- that is, demux every single bitmap, transparency, clip, sub, audio track, etc. etc., and record all the information necessary to recreate the DVD from the component parts. This would allow one to edit, for example, a single menu graphic, or a misspelled sub, or replace video with a re-encoded version, or whatever, and then automatically reauthor the entire thing. It would place no restrictions on what gets put back into the final package -- you could remove entire titlesets, strip audio tracks, even change the running time of video clips, and it would simply adjust the IFOs upon rebuild. It would be complicated to implement (pre-, post- and cell commands in particular need to be handled carefully) but I don't know of any other tool, free or commercial, which does the same thing... |
Your tool does sound like one I have sometimes needed. I've had some poorly mastered DVDs and sure would have liked to do my own version, the best example is probably the Scandinavian release of Citizen Kane. I've written some thoughts about it in the forum, and have to say that my version looks a lot better than the original :D
I might have done something with IfoEdit but it's way too complex for me to start learning it without any extra spare time. That is, a year or two :lol: Well, you probably know where you'll find all your beta testers. |
Quote:
|
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.