Hi Hibiki, We can help walk you through this, and I'm happy to help you with some demo code if you'd like. I don't know of any existing program that meets your needs.
It might help if you explained what the overarching goal is. The problem is that MPEG-2 may be more interdependent than you realize. In general, GOPs (groups of pictures) are "open" -- meaning the first B-pictures in a GOP generally depend on reference frames coded within the previous GOP. Thus, in general, there is no place you can split an MPEG-2 video bitstream have the two segments each be independent. The earliest few pictures in the second part will depend on the latest reference frame coded in the first part. DVDs do have chapters, and chapters generally start with a "closed" GOP so the DVD player can seek directly to them and start playing immediately. So you could split a DVD on the chapter boundaries in the manner you're describing. If that's good enough for you (splitting every 20 minutes or so, or however the DVD chapters are divided up), then we can help you write a program that splits the video bitstream everywhere it finds a "closed" GOP. This is easy and under 50 lines of C. The audio and video partitions won't match exactly, since audio and video frames don't coincide. But if we split a program stream everywhere we see the start of a closed GOP, for example, you'll be splitting the audio at places close by, and if you reassemble the fragments, it will match up again. Let me know if this is what you had in mind (splitting only on closed GOPs, or basically just at chapter boundaries) and I can help you with it further. If you want to start re-encoding frames around the edges while still producing a conforming MPEG-2 program stream with the VBV and all that, well, that's a lot harder. Best, Keith On Thu, 26 Feb 2009, Hibiki Kanzaki wrote: > I am interested in taking a DVD, or lets say an MPEG-PS VOB > file from a DVD, and splitting it up into as many separate > video segment files as I can (as few fields/frames/pictures > per file) without splitting interdependent pictures... > essentially without losing any information. > > As I am doing that, I would like to write a log of how many > frames are in each segment, and what the framerate in it is, > so I have a running total of the elapsed time, which I can > use for synchronizing those segments with everything else. > > Or I guess I could wait to do the actual splitting and just > write the log file along with corresponding byte offsets > into the stream, and have something separate which can use > the log file as an index to do splitting or extracting a > set of frames based on the byte offset. > > I want to make sure I get all the information I need to > line up all the streams in the program (video, audio, > subtitles, etc), and make as precise incisions as I can > without having to re-encode the video. I do expect for > a select few segments I will actually split them into > individual frames and have to re-encode them. > > As trivial as I expect this would be for somebody familiar > with the low level details, I am having trouble finding > a set of programs which provide it out of the box. Is > something equivalent to this already available using the > existing tools (like mpeg2dec), or trivial to build on > libmpeg2? Or maybe there is something like the transcode > tcprobe and avisplit stuff which can already do this? > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Libmpeg2-devel mailing list > Libmpeg2-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/libmpeg2-devel > ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Libmpeg2-devel mailing list Libmpeg2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmpeg2-devel