Page 1 of 1

[SVN 4254] BD source, possible MPEG-PS issue?

Posted: Mon Oct 24, 2011 6:04 pm
by Deleted User 11865
I originally intended to look into this before submitting a bug, but with my recent loss of hardware I was unable to.

I was encoding my Star Wars Blu-ray collection (UK release, though the discs should have the same contents as the US discs) with svn4170. Ripped to ISO with AnyDVD HD in a VM. I included 3 audio tracks:

1) English DTS-HD MA 6.1, main audio, DTS-HD Passthrough

2) English AC-3 2.0, commentary 1, encoding to AAC (Core Audio)

3) English AC-3 2.0, commentary 2, encoding to AAC (Core Audio)

When encoding with 4170, there were neither gaps nor "audio went backwards" in the log, for any audio track.

At some point, I tried a quick encode with svn 4250 (+/- a few revs) (same audio settings, superfast x264 settings) and found 1 or 2 "audio went backwards" messages for the AC3 tracks. IMO, the difference was most likely introduced in one of the many MPEG-PS/TS patches committed between those 2 revs.

Not sure which revision is correct, but I can no longer investigate it. Unfortunately, I no longer have either the logs or the BD rips. Nor can I remember the disc for wich I noticed the difference.

Feel free to investigate if you're bored and/or have too much time on your hands.

Re: SVN 4220-ish, possible MPEG-PS regression (?) - BD sourc

Posted: Mon Oct 24, 2011 8:07 pm
by JohnAStebbins
I just encoded my US version of the Star Wars saga recently. I didn't use the same audio tracks, so my results probably don't mean much. But my logs don't show any "audio went backwards" messages.

I'll pop them in the queue again with the same audios and see what I get.

Re: [SVN 4254] BD source, possible MPEG-PS issue?

Posted: Fri Dec 09, 2011 12:41 am
by Deleted User 11865
https://trac.handbrake.fr/changeset/4254

The Phantom Menace (ripped with MakeMKV), chapters 1 to 5:

SVN 4253

Code: Select all

HandBrake Activity Log for /Users/tim/Desktop/THE_PHANTOM_MENACE 1-5 4253.mkv: 2011-12-09 01:17:50 +0100
Handbrake Version: 4253svn x86_64 (2011120901)

[01:17:50] macgui: Rip: Pending queue count is 0
[01:17:50] macgui: createQueueFileItem: Getting Audio from prepareAudioForQueueFileJob ...
[01:17:50] macgui: createQueueFileItem: Returned getting audio from prepareAudioForQueueFileJob
[01:17:50] macgui: getNextPendingQueueIndex next pending encode index is:0
[01:17:50] macgui: scanning specifically for title: 66
[01:17:50] hb_scan: path=/Volumes/Macintosh HD 1/SW_BD/THE_PHANTOM_MENACE, title_index=66
[01:17:50] scan: BD has 66 title(s)
[01:17:50] bd: scanning title 66
[01:17:50] bd: playlist 00800.MPLS
[01:17:50] bd: duration is 02:16:10 (8170912 ms)
[01:17:50] bd: video id=0x1011, stream type=H.264, format 1080p
[01:17:50] bd: aspect = 1.77778
[01:17:50] bd: audio id=0x711100, lang=English (DTS), 3cc=eng
[01:17:50] bd: audio id=0x1100, lang=English (DTS-HD MA), 3cc=eng
[01:17:50] bd: audio id=0x1101, lang=English (AC3), 3cc=eng
[01:17:50] bd: audio id=0x1102, lang=Espanol (AC3), 3cc=spa
[01:17:50] bd: audio id=0x1103, lang=Francais (AC3), 3cc=fra
[01:17:50] bd: audio id=0x1104, lang=Francais (DTS), 3cc=fra
[01:17:50] bd: audio id=0x1105, lang=Portugues (AC3), 3cc=por
[01:17:50] bd: audio id=0x1106, lang=English (AC3), 3cc=eng
[01:17:50] bd: audio id=0x1107, lang=English (AC3), 3cc=eng
[01:17:50] bd: chap 1 packet=960, 21104 ms
[01:17:50] bd: chap 2 packet=70351296, 91633 ms
[01:17:50] bd: chap 3 packet=568181952, 362612 ms
[01:17:50] bd: chap 4 packet=2474841984, 120620 ms
[01:17:50] bd: chap 5 packet=3111531264, 82791 ms
[01:17:50] bd: chap 6 packet=3567573888, 125416 ms
[01:17:50] bd: chap 7 packet=4288377600, 85627 ms
[01:17:50] bd: chap 8 packet=4780238208, 144435 ms
[01:17:50] bd: chap 9 packet=5519119104, 206706 ms
[01:17:50] bd: chap 10 packet=6639380352, 104354 ms
[01:17:50] bd: chap 11 packet=7242657216, 167584 ms
[01:17:50] bd: chap 12 packet=8167522560, 259926 ms
[01:17:50] bd: chap 13 packet=9420108864, 128670 ms
[01:17:50] bd: chap 14 packet=10152731904, 250250 ms
[01:17:50] bd: chap 15 packet=11454210432, 296838 ms
[01:17:50] bd: chap 16 packet=13029495168, 207749 ms
[01:17:50] bd: chap 17 packet=14042420928, 468259 ms
[01:17:50] bd: chap 18 packet=16454269056, 179262 ms
[01:17:50] bd: chap 19 packet=17391469632, 204078 ms
[01:17:50] bd: chap 20 packet=18471908544, 239781 ms
[01:17:50] bd: chap 21 packet=19757389824, 185310 ms
[01:17:50] bd: chap 22 packet=20848056384, 273898 ms
[01:17:50] bd: chap 23 packet=22434395904, 71029 ms
[01:17:50] bd: chap 24 packet=22795219968, 303011 ms
[01:17:50] bd: chap 25 packet=24344483712, 107148 ms
[01:17:50] bd: chap 26 packet=24925664448, 138263 ms
[01:17:50] bd: chap 27 packet=25627771584, 231814 ms
[01:17:50] bd: chap 28 packet=26871345024, 146604 ms
[01:17:50] bd: chap 29 packet=27674490624, 189939 ms
[01:17:50] bd: chap 30 packet=28634265600, 67692 ms
[01:17:50] bd: chap 31 packet=29007412032, 126126 ms
[01:17:50] bd: chap 32 packet=29701161216, 252877 ms
[01:17:50] bd: chap 33 packet=31020874368, 104896 ms
[01:17:50] bd: chap 34 packet=31598698368, 207415 ms
[01:17:50] bd: chap 35 packet=32668226496, 127836 ms
[01:17:50] bd: chap 36 packet=33321115776, 97680 ms
[01:17:50] bd: chap 37 packet=33858648000, 108483 ms
[01:17:50] bd: chap 38 packet=34424712960, 137220 ms
[01:17:50] bd: chap 39 packet=35165741184, 382715 ms
[01:17:50] bd: chap 40 packet=37355829504, 145395 ms
[01:17:50] bd: chap 41 packet=38230986432, 78328 ms
[01:17:50] bd: chap 42 packet=38690659200, 49924 ms
[01:17:50] bd: chap 43 packet=38961219072, 62062 ms
[01:17:50] bd: chap 44 packet=39312342144, 93593 ms
[01:17:50] bd: chap 45 packet=39843359040, 78161 ms
[01:17:50] bd: chap 46 packet=40247614080, 70862 ms
[01:17:50] bd: chap 47 packet=40618228800, 57182 ms
[01:17:50] bd: chap 48 packet=40907596032, 65815 ms
[01:17:50] bd: chap 49 packet=41294481984, 84542 ms
[01:17:50] bd: chap 50 packet=41767824000, 377126 ms
[01:17:50] bd: chap 51 packet=43446316032, 250 ms
[01:17:50] bd: title 66 has 51 chapters
[01:17:50] scan: decoding previews for title 66
[01:17:50] scan: title angle(s) 9
[01:17:50] scan: audio 0x711100: DCA, rate=48000Hz, bitrate=1536000 English (DTS) (5.1 ch)
[01:17:50] scan: audio 0x1104: DCA, rate=48000Hz, bitrate=768000 Francais (DTS) (5.1 ch)
[01:17:50] scan: audio 0x1100: dca, rate=48000Hz, bitrate=1536000 English (DTS-HD MA) (5.1 ch)
[01:17:50] scan: audio 0x1106: AC-3, rate=48000Hz, bitrate=224000 English (AC3) (2.0 ch)
[01:17:50] scan: audio 0x1107: AC-3, rate=48000Hz, bitrate=224000 English (AC3) (2.0 ch)
[01:17:50] scan: audio 0x1101: AC-3, rate=48000Hz, bitrate=448000 English (AC3) (5.1 ch)
[01:17:50] scan: audio 0x1102: AC-3, rate=48000Hz, bitrate=448000 Espanol (AC3) (5.1 ch)
[01:17:50] scan: audio 0x1103: AC-3, rate=48000Hz, bitrate=448000 Francais (AC3) (5.1 ch)
[01:17:50] scan: audio 0x1105: AC-3, rate=48000Hz, bitrate=448000 Portugues (AC3) (5.1 ch)
[01:17:52] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 132/132/0/0, aspect 16:9, PAR 1:1
[01:17:52] stream: 9 good frames, 0 errors (0%)
[01:17:52] scan: title (0) job->width:1920, job->height:816
[01:17:52] libhb: scan thread found 1 valid title(s)
[01:17:53] macgui: ScanDone state received from fQueueEncodeLibhb
[01:17:53] macgui: Preset: Ultrafast MKV
[01:17:53] macgui: processNewQueueEncode number of passes expected is: 1
[01:17:53] macgui: Start / Stop set to chapters
[01:17:53] macgui: prepareJob exiting
[01:17:53] 1 job(s) to process
[01:17:53] starting job
[01:17:53] sync: expecting 16297 video frames
[01:17:53] job configuration:
[01:17:53]  * source
[01:17:53]    + /Volumes/Macintosh HD 1/SW_BD/THE_PHANTOM_MENACE
[01:17:53]    + title 66, chapter(s) 1 to 5
[01:17:53]  * destination
[01:17:53]    + /Users/tim/Desktop/THE_PHANTOM_MENACE 1-5 4253.mkv
[01:17:53]    + container: Matroska (.mkv)
[01:17:53]      + chapter markers
[01:17:53]  * video track
[01:17:53]    + decoder: h264
[01:17:53]      + bitrate 200 kbps
[01:17:53]    + frame rate: same as source (around 23.976 fps)
[01:17:53]    + dimensions: 1920 * 1080 -> 320 * 128, crop 132/132/0/0, mod 16
[01:17:53]    + encoder: H.264 (x264)
[01:17:53]      + options: ref=1:bframes=16:weightp=1:me=dia:subq=1:rc-lookahead=0:mbtree=0:analyse=i8x8,i4x4:trellis=0
[01:17:53]      + quality: 51.00 (RF)
[01:17:53]  * audio track 1
[01:17:53]    + decoder: English (DTS-HD MA) (5.1 ch) (track 1, id 0x1100)
[01:17:53]    + DTS-HD Passthru
[01:17:53]  * audio track 2
[01:17:53]    + decoder: English (AC3) (2.0 ch) (track 7, id 0x1106)
[01:17:53]      + bitrate: 224 kbps, samplerate: 48000 Hz
[01:17:53]    + mixdown: Stereo
[01:17:53]    + dynamic range compression: 1.000000
[01:17:53]    + encoder: AAC (CoreAudio)
[01:17:53]      + bitrate: 160 kbps, samplerate: 48000 Hz
[01:17:53]  * audio track 3
[01:17:53]    + decoder: English (AC3) (2.0 ch) (track 8, id 0x1107)
[01:17:53]      + bitrate: 224 kbps, samplerate: 48000 Hz
[01:17:53]    + mixdown: Stereo
[01:17:53]    + dynamic range compression: 1.000000
[01:17:53]    + encoder: AAC (CoreAudio)
[01:17:53]      + bitrate: 160 kbps, samplerate: 48000 Hz
[01:17:53] reader: first SCR 1044806 id 0x1011 DTS 1044806
[01:17:53] encx264: min-keyint: 24, keyint: 240
[01:17:53] encx264: Encoding at constant RF 51.000000
x264 [warning]: --psnr used with psy on: results will be invalid!
x264 [warning]: --tune psnr should be used if attempting to benchmark psnr!
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
x264 [info]: profile High, level 1.2
[01:17:53] h264: "Chapter  1" (1) at frame 0 time 3754
[01:17:54] sync: first pts is 3754
[01:18:03] h264: "Chapter  2" (2) at frame 506 time 1904414
[01:19:05] h264: "Chapter  3" (3) at frame 2684 time 10080082
[01:23:16] h264: "Chapter  4" (4) at frame 11397 time 42786036
[01:24:44] h264: "Chapter  5" (5) at frame 14289 time 53641881
[01:25:44] reader: end of chapter 5 (media 5) reached at media chapter 6
[01:25:44] reader: done. 5 scr changes
[01:25:45] work: average encoding speed for job is 34.565540 fps
[01:25:45] sync: got 16274 frames, 16297 expected
[01:25:45] h264-decoder done: 16274 frames, 0 decoder errors, 0 drops
[01:25:45] render: lost time: 0 (0 frames)
[01:25:45] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: frame I:173   Avg QP:45.78  size:   396  PSNR Mean Y:29.07 U:39.31 V:39.32 Avg:30.57 Global:28.56
x264 [info]: frame P:7375  Avg QP:47.74  size:    41  PSNR Mean Y:25.18 U:36.09 V:36.73 Avg:26.72 Global:25.42
x264 [info]: frame B:8726  Avg QP:49.35  size:    15  PSNR Mean Y:27.67 U:38.29 V:38.23 Avg:28.93 Global:27.10
x264 [info]: consecutive B-frames: 30.7%  6.6%  6.9% 12.1% 13.9% 17.0%  6.8%  0.7%  0.3%  0.3%  0.4%  0.2%  0.2%  0.2%  0.4%  0.0%  3.3%
x264 [info]: mb I  I16..4: 61.2% 37.9%  0.9%
x264 [info]: mb P  I16..4:  2.1%  0.8%  0.0%  P16..4:  4.0%  0.0%  0.0%  0.0%  0.0%    skip:93.1%
x264 [info]: mb B  I16..4:  0.1%  0.0%  0.0%  B16..8:  0.5%  0.0%  0.0%  direct: 0.2%  skip:99.2%  L0:41.4% L1:57.9% BI: 0.7%
x264 [info]: 8x8 transform intra:32.4% inter:30.8%
x264 [info]: coded y,uvDC,uvAC intra: 10.4% 29.2% 4.2% inter: 0.1% 0.7% 0.0%
x264 [info]: i16 v,h,dc,p: 49% 28% 18%  6%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 12% 47%  8%  3%  3%  3%  4%  6%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 11% 62%  1%  2%  2%  1%  2%  1%
x264 [info]: i8c dc,h,v,p: 85%  7%  8%  0%
x264 [info]: Weighted P-Frames: Y:4.9% UV:2.7%
x264 [info]: SSIM Mean Y:0.6861351 ( 5.033db)
x264 [info]: PSNR Mean Y:26.556 U:37.300 V:37.562 Avg:27.946 Global:26.266 kb/s:5.96
[01:25:45] dca-decoder done: 0 frames, 0 decoder errors, 0 drops
[01:25:45] mux: track 0, 16274 frames, 498795 bytes, 5.88 kbps, fifo 32
[01:25:45] mux: track 1, 63566 frames, 412621884 bytes, 4862.93 kbps, fifo 512
[01:25:45] mux: track 2, 31805 frames, 13602947 bytes, 160.32 kbps, fifo 256
[01:25:45] mux: track 3, 31805 frames, 13736903 bytes, 161.90 kbps, fifo 256
[01:25:45] stream: 16275 good frames, 0 errors (0%)
[01:25:45] libhb: work result = 0
SVN 4254

Code: Select all

HandBrake Activity Log for /Users/tim/Desktop/THE_PHANTOM_MENACE 1-5 4254.mkv: 2011-12-09 01:29:30 +0100
Handbrake Version: 4254svn x86_64 (2011120901)

[01:29:30] macgui: Rip: Pending queue count is 0
[01:29:30] macgui: createQueueFileItem: Getting Audio from prepareAudioForQueueFileJob ...
[01:29:30] macgui: createQueueFileItem: Returned getting audio from prepareAudioForQueueFileJob
[01:29:30] macgui: getNextPendingQueueIndex next pending encode index is:0
[01:29:30] macgui: scanning specifically for title: 66
[01:29:30] hb_scan: path=/Volumes/Macintosh HD 1/SW_BD/THE_PHANTOM_MENACE, title_index=66
[01:29:30] scan: BD has 66 title(s)
[01:29:30] bd: scanning title 66
[01:29:30] bd: playlist 00800.MPLS
[01:29:30] bd: duration is 02:16:10 (8170912 ms)
[01:29:30] bd: video id=0x1011, stream type=H.264, format 1080p
[01:29:30] bd: aspect = 1.77778
[01:29:30] bd: audio id=0x711100, lang=English (DTS), 3cc=eng
[01:29:30] bd: audio id=0x1100, lang=English (DTS-HD MA), 3cc=eng
[01:29:30] bd: audio id=0x1101, lang=English (AC3), 3cc=eng
[01:29:30] bd: audio id=0x1102, lang=Espanol (AC3), 3cc=spa
[01:29:30] bd: audio id=0x1103, lang=Francais (AC3), 3cc=fra
[01:29:30] bd: audio id=0x1104, lang=Francais (DTS), 3cc=fra
[01:29:30] bd: audio id=0x1105, lang=Portugues (AC3), 3cc=por
[01:29:30] bd: audio id=0x1106, lang=English (AC3), 3cc=eng
[01:29:30] bd: audio id=0x1107, lang=English (AC3), 3cc=eng
[01:29:30] bd: chap 1 packet=960, 21104 ms
[01:29:30] bd: chap 2 packet=70351296, 91633 ms
[01:29:30] bd: chap 3 packet=568181952, 362612 ms
[01:29:30] bd: chap 4 packet=2474841984, 120620 ms
[01:29:30] bd: chap 5 packet=3111531264, 82791 ms
[01:29:30] bd: chap 6 packet=3567573888, 125416 ms
[01:29:30] bd: chap 7 packet=4288377600, 85627 ms
[01:29:30] bd: chap 8 packet=4780238208, 144435 ms
[01:29:30] bd: chap 9 packet=5519119104, 206706 ms
[01:29:30] bd: chap 10 packet=6639380352, 104354 ms
[01:29:30] bd: chap 11 packet=7242657216, 167584 ms
[01:29:30] bd: chap 12 packet=8167522560, 259926 ms
[01:29:30] bd: chap 13 packet=9420108864, 128670 ms
[01:29:30] bd: chap 14 packet=10152731904, 250250 ms
[01:29:30] bd: chap 15 packet=11454210432, 296838 ms
[01:29:30] bd: chap 16 packet=13029495168, 207749 ms
[01:29:30] bd: chap 17 packet=14042420928, 468259 ms
[01:29:30] bd: chap 18 packet=16454269056, 179262 ms
[01:29:30] bd: chap 19 packet=17391469632, 204078 ms
[01:29:30] bd: chap 20 packet=18471908544, 239781 ms
[01:29:30] bd: chap 21 packet=19757389824, 185310 ms
[01:29:30] bd: chap 22 packet=20848056384, 273898 ms
[01:29:30] bd: chap 23 packet=22434395904, 71029 ms
[01:29:30] bd: chap 24 packet=22795219968, 303011 ms
[01:29:30] bd: chap 25 packet=24344483712, 107148 ms
[01:29:30] bd: chap 26 packet=24925664448, 138263 ms
[01:29:30] bd: chap 27 packet=25627771584, 231814 ms
[01:29:30] bd: chap 28 packet=26871345024, 146604 ms
[01:29:30] bd: chap 29 packet=27674490624, 189939 ms
[01:29:30] bd: chap 30 packet=28634265600, 67692 ms
[01:29:30] bd: chap 31 packet=29007412032, 126126 ms
[01:29:30] bd: chap 32 packet=29701161216, 252877 ms
[01:29:30] bd: chap 33 packet=31020874368, 104896 ms
[01:29:30] bd: chap 34 packet=31598698368, 207415 ms
[01:29:30] bd: chap 35 packet=32668226496, 127836 ms
[01:29:30] bd: chap 36 packet=33321115776, 97680 ms
[01:29:30] bd: chap 37 packet=33858648000, 108483 ms
[01:29:30] bd: chap 38 packet=34424712960, 137220 ms
[01:29:30] bd: chap 39 packet=35165741184, 382715 ms
[01:29:30] bd: chap 40 packet=37355829504, 145395 ms
[01:29:30] bd: chap 41 packet=38230986432, 78328 ms
[01:29:30] bd: chap 42 packet=38690659200, 49924 ms
[01:29:30] bd: chap 43 packet=38961219072, 62062 ms
[01:29:30] bd: chap 44 packet=39312342144, 93593 ms
[01:29:30] bd: chap 45 packet=39843359040, 78161 ms
[01:29:30] bd: chap 46 packet=40247614080, 70862 ms
[01:29:30] bd: chap 47 packet=40618228800, 57182 ms
[01:29:30] bd: chap 48 packet=40907596032, 65815 ms
[01:29:30] bd: chap 49 packet=41294481984, 84542 ms
[01:29:30] bd: chap 50 packet=41767824000, 377126 ms
[01:29:30] bd: chap 51 packet=43446316032, 250 ms
[01:29:30] bd: title 66 has 51 chapters
[01:29:30] scan: decoding previews for title 66
[01:29:30] scan: title angle(s) 9
[01:29:30] scan: audio 0x711100: DCA, rate=48000Hz, bitrate=1536000 English (DTS) (5.1 ch)
[01:29:30] scan: audio 0x1104: DCA, rate=48000Hz, bitrate=768000 Francais (DTS) (5.1 ch)
[01:29:30] scan: audio 0x1100: dca, rate=48000Hz, bitrate=1536000 English (DTS-HD MA) (5.1 ch)
[01:29:30] scan: audio 0x1106: AC-3, rate=48000Hz, bitrate=224000 English (AC3) (2.0 ch)
[01:29:30] scan: audio 0x1107: AC-3, rate=48000Hz, bitrate=224000 English (AC3) (2.0 ch)
[01:29:30] scan: audio 0x1101: AC-3, rate=48000Hz, bitrate=448000 English (AC3) (5.1 ch)
[01:29:30] scan: audio 0x1102: AC-3, rate=48000Hz, bitrate=448000 Espanol (AC3) (5.1 ch)
[01:29:30] scan: audio 0x1103: AC-3, rate=48000Hz, bitrate=448000 Francais (AC3) (5.1 ch)
[01:29:30] scan: audio 0x1105: AC-3, rate=48000Hz, bitrate=448000 Portugues (AC3) (5.1 ch)
[01:29:33] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 132/132/0/0, aspect 16:9, PAR 1:1
[01:29:33] stream: 9 good frames, 0 errors (0%)
[01:29:33] scan: title (0) job->width:1920, job->height:816
[01:29:33] libhb: scan thread found 1 valid title(s)
[01:29:33] macgui: ScanDone state received from fQueueEncodeLibhb
[01:29:33] macgui: Preset: Ultrafast MKV
[01:29:33] macgui: processNewQueueEncode number of passes expected is: 1
[01:29:33] macgui: Start / Stop set to chapters
[01:29:33] macgui: prepareJob exiting
[01:29:33] 1 job(s) to process
[01:29:33] starting job
[01:29:33] sync: expecting 16297 video frames
[01:29:33] job configuration:
[01:29:33]  * source
[01:29:33]    + /Volumes/Macintosh HD 1/SW_BD/THE_PHANTOM_MENACE
[01:29:33]    + title 66, chapter(s) 1 to 5
[01:29:33]  * destination
[01:29:33]    + /Users/tim/Desktop/THE_PHANTOM_MENACE 1-5 4254.mkv
[01:29:33]    + container: Matroska (.mkv)
[01:29:33]      + chapter markers
[01:29:33]  * video track
[01:29:33]    + decoder: h264
[01:29:33]      + bitrate 200 kbps
[01:29:33]    + frame rate: same as source (around 23.976 fps)
[01:29:33]    + dimensions: 1920 * 1080 -> 320 * 128, crop 132/132/0/0, mod 16
[01:29:33]    + encoder: H.264 (x264)
[01:29:33]      + options: ref=1:bframes=16:weightp=1:me=dia:subq=1:rc-lookahead=0:mbtree=0:analyse=i8x8,i4x4:trellis=0
[01:29:33]      + quality: 51.00 (RF)
[01:29:33]  * audio track 1
[01:29:33]    + decoder: English (DTS-HD MA) (5.1 ch) (track 1, id 0x1100)
[01:29:33]    + DTS-HD Passthru
[01:29:33]  * audio track 2
[01:29:33]    + decoder: English (AC3) (2.0 ch) (track 7, id 0x1106)
[01:29:33]      + bitrate: 224 kbps, samplerate: 48000 Hz
[01:29:33]    + mixdown: Stereo
[01:29:33]    + dynamic range compression: 1.000000
[01:29:33]    + encoder: AAC (CoreAudio)
[01:29:33]      + bitrate: 160 kbps, samplerate: 48000 Hz
[01:29:33]  * audio track 3
[01:29:33]    + decoder: English (AC3) (2.0 ch) (track 8, id 0x1107)
[01:29:33]      + bitrate: 224 kbps, samplerate: 48000 Hz
[01:29:33]    + mixdown: Stereo
[01:29:33]    + dynamic range compression: 1.000000
[01:29:33]    + encoder: AAC (CoreAudio)
[01:29:33]      + bitrate: 160 kbps, samplerate: 48000 Hz
[01:29:33] reader: first SCR 1044806 id 0x1011 DTS 1044806
[01:29:33] encx264: min-keyint: 24, keyint: 240
[01:29:33] encx264: Encoding at constant RF 51.000000
x264 [warning]: --psnr used with psy on: results will be invalid!
x264 [warning]: --tune psnr should be used if attempting to benchmark psnr!
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
x264 [info]: profile High, level 1.2
[01:29:33] h264: "Chapter  1" (1) at frame 0 time 3754
[01:29:34] sync: first pts is 3754
[01:29:43] h264: "Chapter  2" (2) at frame 506 time 1902518
[01:30:45] h264: "Chapter  3" (3) at frame 2684 time 10078186
[01:30:50] sync: audio 0x1106 time went backwards 23 ms, dropped 1 frames (start 10820959, next 10823040)
[01:30:50] sync: audio 0x1107 time went backwards 23 ms, dropped 1 frames (start 10820959, next 10823040)
[01:34:58] h264: "Chapter  4" (4) at frame 11397 time 42784140
[01:36:25] h264: "Chapter  5" (5) at frame 14289 time 53639985
[01:37:25] reader: end of chapter 5 (media 5) reached at media chapter 6
[01:37:25] reader: done. 5 scr changes
[01:37:26] work: average encoding speed for job is 34.515377 fps
[01:37:26] sync: got 16274 frames, 16297 expected
[01:37:26] h264-decoder done: 16274 frames, 0 decoder errors, 0 drops
[01:37:26] render: lost time: 0 (0 frames)
[01:37:26] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: frame I:173   Avg QP:45.78  size:   396  PSNR Mean Y:29.07 U:39.31 V:39.32 Avg:30.57 Global:28.56
x264 [info]: frame P:7375  Avg QP:47.74  size:    41  PSNR Mean Y:25.18 U:36.09 V:36.73 Avg:26.72 Global:25.42
x264 [info]: frame B:8726  Avg QP:49.35  size:    15  PSNR Mean Y:27.66 U:38.28 V:38.23 Avg:28.92 Global:27.10
x264 [info]: consecutive B-frames: 30.7%  6.6%  6.9% 12.1% 13.9% 17.0%  6.8%  0.7%  0.3%  0.3%  0.4%  0.2%  0.2%  0.2%  0.4%  0.0%  3.3%
x264 [info]: mb I  I16..4: 61.2% 37.9%  0.9%
x264 [info]: mb P  I16..4:  2.1%  0.8%  0.0%  P16..4:  4.0%  0.0%  0.0%  0.0%  0.0%    skip:93.1%
x264 [info]: mb B  I16..4:  0.1%  0.0%  0.0%  B16..8:  0.5%  0.0%  0.0%  direct: 0.2%  skip:99.2%  L0:41.4% L1:57.9% BI: 0.7%
x264 [info]: 8x8 transform intra:32.4% inter:30.8%
x264 [info]: coded y,uvDC,uvAC intra: 10.4% 29.2% 4.2% inter: 0.1% 0.7% 0.0%
x264 [info]: i16 v,h,dc,p: 49% 28% 18%  6%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 12% 47%  8%  3%  3%  3%  4%  6%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 11% 62%  1%  2%  2%  1%  2%  1%
x264 [info]: i8c dc,h,v,p: 85%  7%  8%  0%
x264 [info]: Weighted P-Frames: Y:4.9% UV:2.7%
x264 [info]: SSIM Mean Y:0.6861254 ( 5.032db)
x264 [info]: PSNR Mean Y:26.554 U:37.298 V:37.560 Avg:27.943 Global:26.266 kb/s:5.96
[01:37:26] dca-decoder done: 0 frames, 0 decoder errors, 0 drops
[01:37:26] mux: track 0, 16274 frames, 498795 bytes, 5.88 kbps, fifo 32
[01:37:26] mux: track 1, 63566 frames, 412621884 bytes, 4863.23 kbps, fifo 512
[01:37:26] mux: track 2, 31804 frames, 13602411 bytes, 160.32 kbps, fifo 256
[01:37:26] mux: track 3, 31804 frames, 13735414 bytes, 161.89 kbps, fifo 256
[01:37:26] stream: 16275 good frames, 0 errors (0%)
[01:37:26] libhb: work result = 0
The frame number is the same for each chapter, but the times where chapters 2-5 are reached differ (offset of 4 ticks), plus:

Code: Select all

[01:30:50] sync: audio 0x1106 time went backwards 23 ms, dropped 1 frames (start 10820959, next 10823040)
[01:30:50] sync: audio 0x1107 time went backwards 23 ms, dropped 1 frames (start 10820959, next 10823040)
I noticed a similar difference with a Revenge Of The Sith ISO image ripped using AnyDVD HD.

Re: [SVN 4254] BD source, possible MPEG-PS issue?

Posted: Wed Dec 14, 2011 1:08 pm
by Deleted User 11865
FWIW, I can get rid of the dropped frames by reverting just this part of the changeset:

http://paste.handbrake.fr/pastebin.php?show=2840

Code: Select all

Index: libhb/reader.c
===================================================================
--- libhb/reader.c	(revision 4375)
+++ libhb/reader.c	(working copy)
@@ -22,7 +22,6 @@
 
 typedef struct
 {
-    int    startup;
     double average; // average time between packets
     int64_t last;   // last timestamp seen on this stream
     int id;         // stream id
@@ -110,7 +109,6 @@
                                            (double)job->vrate;
     r->stream_timing[0].last = -r->stream_timing[0].average;
     r->stream_timing[0].valid = 1;
-    r->stream_timing[0].startup = 10;
     r->stream_timing[1].id = -1;
 
     r->demux.last_scr = -1;
@@ -230,7 +228,6 @@
         }
         st->id = buf->id;
         st->average = 30.*90.;
-        st->startup = 10;
         st->last = -st->average;
         if ( ( st->is_audio = is_audio( r, buf->id ) ) != 0 )
         {
@@ -259,15 +256,7 @@
     // Protect against spurious bad timestamps
     if ( dt > -5 * 90000LL && dt < 5 * 90000LL )
     {
-        if( st->startup )
-        {
-            st->average += ( dt - st->average ) * (1./2.);
-            st->startup--;
-        }
-        else
-        {
-            st->average += ( dt - st->average ) * (1./32.);
-        }
+        st->average += ( dt - st->average ) * (1./32.);
         st->last = buf->renderOffset;
     }
     st->valid = 1;
Meaning that the following changes are not causing the difference:

http://paste.handbrake.fr/pastebin.php?show=2841

Code: Select all

Index: libhb/reader.c
===================================================================
--- libhb/reader.c	(revision 4253)
+++ libhb/reader.c	(working copy)
@@ -245,6 +245,13 @@
 static void update_ipt( hb_work_private_t *r, const hb_buffer_t *buf )
 {
     stream_timing_t *st = id_to_st( r, buf, 1 );
+
+    if( buf->renderOffset < 0 )
+    {
+        st->last += st->average;
+        return;
+    }
+
     double dt = buf->renderOffset - st->last;
     // Protect against spurious bad timestamps
     if ( dt > -5 * 90000LL && dt < 5 * 90000LL )
@@ -281,7 +288,6 @@
     //hb_log("id %x last %ld avg %g nxt %ld renderOffset %ld scr_offset %ld",
     //    buf->id, last, st->average, nxt, buf->renderOffset, r->scr_offset);
     r->scr_changes = r->demux.scr_changes;
-    st->last = nxt;
 }
 
 /***********************************************************************
@@ -587,16 +593,17 @@
                 }
                 if ( buf->renderOffset != -1 )
                 {
-                    if ( r->scr_changes == r->demux.scr_changes )
-                    {
-                        // This packet is referenced to the same SCR as the last.
-                        // Adjust timestamp to remove the System Clock Reference
-                        // offset then update the average inter-packet time
-                        // for this stream.
-                        buf->renderOffset -= r->scr_offset;
-                        update_ipt( r, buf );
-                    }
+                    // This packet is referenced to the same SCR as the last.
+                    // Adjust timestamp to remove the System Clock Reference
+                    // offset then update the average inter-packet time
+                    // for this stream.
+                    buf->renderOffset -= r->scr_offset;
+                    update_ipt( r, buf );
                 }
+                else
+                {
+                    update_ipt( r, buf );
+                }
                 if ( !r->start_found )
                 {
                     hb_buffer_close( &buf );
Index: libhb/stream.c
===================================================================
--- libhb/stream.c	(revision 4253)
+++ libhb/stream.c	(working copy)
@@ -161,6 +161,8 @@
         int     pcr_in;         // sequence number of most recent input pcr
         int64_t pcr;            // most recent input pcr
         int64_t pcr_current;    // circular buffer of output pcrs
+        int64_t last_timestamp; // used for discontinuity detection when
+                                // there are no PCRs
 
         uint8_t *packet;        // buffer for one TS packet
         hb_ts_stream_t *list;
@@ -4412,8 +4414,9 @@
         // checked at once.
         int64_t bufpcr = b->pcr;
         int64_t curpcr = stream->ts.pcr_current;
-        if ( b->cur < stream->ts.pcr_out &&
-             bufpcr != -1 && curpcr != -1 && curpcr - bufpcr > 200*90LL )
+        if ( stream->ts.found_pcr &&  b->cur < stream->ts.pcr_out &&
+             bufpcr != -1 && curpcr != -1 && 
+             (uint64_t)( curpcr - bufpcr ) > 200*90LL )
         {
             // we've sent up a new pcr but have a packet referenced to an
             // old pcr and the difference was enough to trigger a discontinuity
@@ -4423,6 +4426,18 @@
             buf->stop = -1;
             buf->pcr = -1;
         }
+        else if ( b->cur < stream->ts.pcr_out &&
+                  bufpcr != -1 && curpcr != -1 && 
+                  ( curpcr - bufpcr > 200*90LL || bufpcr - curpcr > 200*90LL ) )
+        {
+            // we've sent up a new pcr but have a packet referenced to an
+            // old pcr and the difference was enough to trigger a discontinuity
+            // correction. smash the timestamps or we'll mess up the correction.
+            buf->start = -1;
+            buf->renderOffset = -1;
+            buf->stop = -1;
+            buf->pcr = -1;
+        }
         else
         {
             if ( stream->ts.pcr_out != stream->ts.pcr_in )
@@ -4641,6 +4656,7 @@
             ++stream->frames;
 
             // if we don't have a pcr yet use the dts from this frame
+            // to attempt to detect discontinuities
             if ( !stream->ts.found_pcr )
             {
                 // PES must begin with an mpeg start code & contain
@@ -4652,8 +4668,16 @@
                     return NULL;
                 }
                 // if we have a dts use it otherwise use the pts
-                stream->ts.pcr = pes_timestamp( pes + ( pes[7] & 0x40?14:9 ) );
-                ++stream->ts.pcr_in;
+                int64_t timestamp;
+                timestamp = pes_timestamp( pes + ( pes[7] & 0x40?14:9 ) );
+                if( stream->ts.last_timestamp < 0 ||
+                    timestamp - stream->ts.last_timestamp > 90 * 600 ||
+                    stream->ts.last_timestamp - timestamp > 90 * 600 )
+                {
+                    stream->ts.pcr = timestamp;
+                    ++stream->ts.pcr_in;
+                }
+                stream->ts.last_timestamp = timestamp;
             }
         }
 
@@ -4749,6 +4773,7 @@
     stream->ts.pcr_in = 0;
     stream->ts.pcr = -1;
     stream->ts.pcr_current = -1;
+    stream->ts.last_timestamp = -1;
 
     stream->frames = 0;
     stream->errors = 0;

Re: [SVN 4254] BD source, possible MPEG-PS issue?

Posted: Wed Dec 14, 2011 5:26 pm
by JohnAStebbins
Looks like we have a bit of a tradeoff situation. That code gets the average frame duration calculation to converge more quickly at startup so that discontinuities early in the stream can be handled better. I had a stream that this fixed some issues in. But if the early packet durations are not representative of latter packet durations, this change could cause problems similar to the problem it was designed to fix :roll:. We can keep it or drop it. Kind of difficult to decide which direction to go without larger sample statistics of how many it fixes vs breaks.

EDIT: Ultimately, I would like to move all this discontinuity and timestamp handling from reader (at the beginning of the pipeline where frame durations and frame order are unknown) to sync (where both frame durations and frame order have been established by the decoder). This would eliminate a lot of the guesswork that's going on in reader.