|
|
| fccHandler |
| Posted: Aug 24 2007, 04:16 AM |
 |
|
Administrator n00b
  
Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02

|
| QUOTE (neuron2 @ Aug 23 2007, 11:59 PM) | | What does DGIndex report? Just curious. |
DGIndex reports -128, but that's correct for DGIndex because you elect to remove part of the audio to compensate for the orphan frames you remove.
The sequence (in coding order) begins BBPBBIBBPBBP...
DGIndex removes 5 frames (I think) and pops up a warning about the opening GOP not being closed. VirtualDub-MPEG2 removes 7 frames, but doesn't remove any of the audio, so it reports a larger skew.
@rmanal: I've put a new build up: http://fcchandler.home.comcast.net/stable
This should give an accurate skew value in "File Information" for all of your VOBs. Let me know if it doesn't.
Keep in mind the bug I spoke to phaeron about (earlier in this thread), because that is not yet fixed in my version.
-------------------- May the FOURCC be with you... |
 |
| rmanal |
| Posted: Aug 24 2007, 11:47 AM |
 |
|
Advanced Member
  
Group: Members
Posts: 153
Member No.: 11636
Joined: 28-August 04

|
Very great job. SO as I have read, NAV block does not enter in delay calculation. Because I'm a newbee in MPEG2 specification, could you show me in VOBedit where are the PTS video and audio time parameter in PTS part, because I have understood, PTS part only exist for audio stream, exactly for private stream #1. Now I'm curious
I have tried to use DGIndex but I don't andertand where you have seen this -128ms value???? Furthermore I don't andesrtand what the meaning of a GOP not being closed.
I will try your new version, thank you very much for your effort.
|
 |
| neuron2 |
| Posted: Aug 24 2007, 12:14 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 1244
Member No.: 5294
Joined: 18-July 03

|
. |
 |
| fccHandler |
| Posted: Aug 24 2007, 06:02 PM |
 |
|
Administrator n00b
  
Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02

|
DTS and PTS must be sent periodically for all of the elementary audio and video streams in a program stream. They are described in the "Systems" part of the MPEG-2 specification:
http://www.neuron2.net/library/library.html (Scroll down to "Encoding/Decoding MPEG-2")
-------------------- May the FOURCC be with you... |
 |
| rmanal |
| Posted: Aug 28 2007, 07:57 AM |
 |
|
Advanced Member
  
Group: Members
Posts: 153
Member No.: 11636
Joined: 28-August 04

|
OK I have read a lot of informations about MPEG2 specification and, with your help, I have retrieved how you calculate audio-video delay, but this have implied another question: - How VDMPEG2 will remove orphan picture and audio pack? - Because B and P pictures are not generally in the presentation order in the stream, and because in some VOB files thay do not includes PTS informations, how is rebuilt the presentation order?
I have tried your new VDMPEG2 and it looks good. Thank you. |
 |
| fccHandler |
| Posted: Aug 28 2007, 06:43 PM |
 |
|
Administrator n00b
  
Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02

|
The presentation order is derived from the frame type, and the list of frames is sorted using a simple algorithm. In pseudo code:
| CODE | for (n = 1; n < number_of_frames; ++n) { if (frame[n] is a B-frame) { exchange frame[n] and frame[n - 1]; } } |
After the list is sorted into presentation order, any P- and B-frames at the beginning of the list are removed, so that the first frame in the list is always an I-frame.
VirtualDub-MPEG2 doesn't remove any audio.
-------------------- May the FOURCC be with you... |
 |
| phaeron |
| Posted: Aug 29 2007, 06:46 AM |
 |
|

Virtualdub Developer
  
Group: Administrator
Posts: 7773
Member No.: 61
Joined: 30-July 02

|
You can have B frames prior to the first I frame in presentation order and still have a valid first closed GOP, as long as the B frames only use backward prediction. Dunno about MPEG-2, but the MPEG-1 spec specifically calls this out as valid, and I've hit MPEG streams in the wild that had this. |
 |
| fccHandler |
| Posted: Aug 29 2007, 07:26 AM |
 |
|
Administrator n00b
  
Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02

|
I know, and it's the same with MPEG-2. But I fear that trying to handle that situation will make the code overly complicated. It's much easier to simply assume that B-frames generated by the MPEG encoder must depend on both forward and backward reference frames, and just remove them if those references are not present.
I am actually rethinking all of the Mpeg2.cpp code though, because I'm still not convinced that the reported "skew" is 100% reliable.
-------------------- May the FOURCC be with you... |
 |
| rmanal |
| Posted: Aug 30 2007, 08:42 AM |
 |
|
Advanced Member
  
Group: Members
Posts: 153
Member No.: 11636
Joined: 28-August 04

|
OK with my VOB files and with VOBedit I have retrieved manually the value given by your new version of VDMPEG2.
Two questions: - why do you think the reliability of your skew calculation are wrong? - why do you keep audio block before the first I picture. Are they useful, because this functionning introduce a larger delay in audio-video? |
 |
| fccHandler |
| Posted: Aug 30 2007, 06:15 PM |
 |
|
Administrator n00b
  
Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02

|
Two answers:
- It could be wrong if the first samples in the presentation are lacking PTS (particularly audio samples).
- As a general rule, I try to remove as little as possible, but I'm rethinking that in light of the above.
-------------------- May the FOURCC be with you... |
 |
| rmanal |
| Posted: Sep 6 2007, 11:54 AM |
 |
|
Advanced Member
  
Group: Members
Posts: 153
Member No.: 11636
Joined: 28-August 04

|
OK so I have rebuilt all my avi files from VOB files using your next version of VDMPEG2 and it works well. Nevertheless I have encountered a new problem: with 4 of the avi files I have created, I have made a unique file using the append command. No problem with the first avi file but with the other I see again a delay in audio in the unique avi file instead there is no delay in the four avi files: what'wrong?
I will add these files in my ftp server this evening. |
 |
| foxidrive |
| Posted: Sep 6 2007, 12:29 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 918
Member No.: 16996
Joined: 21-October 05

|
IIANM it's likely that the video and audio streams in one/all of the files is not the same length, hence the following stream gets shifted in time. A solution I have used in the past is to remove the last snippet in each file to even out the ends of the streams and then append them. |
 |
| fccHandler |
| Posted: Sep 7 2007, 07:14 AM |
 |
|
Administrator n00b
  
Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02

|
Sync isn't guaranteed if the appended files have compressed audio. It's a long story, but your best bet is to stick with uncompressed PCM audio when you're editing and/or appending video files, and only compress the audio when you're ready to render the final AVI.
In other news, I'm seeing a long freeze after parsing some large MPEG-2 files. It isn't fatal, just annoying. I'll fix this as soon as I can.
-------------------- May the FOURCC be with you... |
 |
| rmanal |
| Posted: Sep 7 2007, 10:42 AM |
 |
|
Advanced Member
  
Group: Members
Posts: 153
Member No.: 11636
Joined: 28-August 04

|
The audio part of my avi files are in PCM. You can download my files: Film Mariage-film 2-partie 01.avi, composed of the following files: Film Mariage-film 2-partie 01-part1.avi Film Mariage-film 2-partie 01-part2.avi Film Mariage-film 2-partie 01-part3.avi Film Mariage-film 2-partie 01-part4.avi |
 |
| fccHandler |
| Posted: Sep 7 2007, 06:09 PM |
 |
|
Administrator n00b
  
Group: Moderators
Posts: 3961
Member No.: 280
Joined: 13-September 02

|
I downloaded your smallest file (part 2), and indeed its audio track is slightly shorter than its video track (72 milliseconds, to be exact). It's a small amount, but the difference will accumulate to a big amount if all of your pieces are like this.
VirtualDub joins the audio end-to-end when appending, so if the audio of part 1 is too short, then the audio of part 2 will start too early, and so on with additional parts.
There are at least two ways to fix this. As foxidrive said, you can trim a video frame or two from the end of the movie, and resave the file in direct stream copy mode, until the audio duration exactly matches the video duration. You'll need to do this for each part before you append them together. In your case, the formula you want to match is:
number of audio samples = number of video frames * 1920
You can see the number of audio samples in "File Information."
The other (more tedious) way is to manually edit the audio tracks by saving them as WAV files and loading the WAVs into an audio editor. Use the editor to add or remove samples as needed, until the duration is exactly correct, then import the WAV back into VirtualDub and resave the movie using direct stream copy.
-------------------- May the FOURCC be with you... |
 |